# The Guerilla Guide to R

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**Optinalysis**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**Update:**Okay. I’ve uploaded a new template and things seem to be fine now.

**Update:**I am aware the table of contents is not being displayed in bullet form as I intended. The web template I’m using seems to be buggy. It also seems to think this page is in Indonesian…Working on it!

__Table of Contents:__**Reading/Writing Files**- How to write lines of text into a file
- Trimming a huge (3.5GB) csv file to read into R
- Quickly reading large dataframes into R
- How can I tell if my R dataset is going to be too large?
- Standard logging library for R
**Dataframes**- How do you write a CSV in R with matrix names dimnames(M) intact?
- How to join dataframes in R (inner, outer, left, right)?
- Dropping Columns in Dataframes
- Dropping factor levels in a subsetted dataframe
- Remove rows with NA in your dataframe
- Creating an R dataframe row by row
- Fastest way to merge/join dataframes
**Lists and Vectors**- How to correctly use lists in R?
- Levels – what sorcery is this?
- R function for testing if a vector contains a given element?
- Converting lists to dataframe
- In R, what is the difference between [] and [[]] notations accessing the elements of a list
- How to convert a factor to an integer/numeric without a loss of information
- How to access the last value of a vector
- Removing an element from a list
- Extracting the last n characters from a string
**Exceptions and Gotchas**- What is the biggest R gotcha you’ve run across?
- Exception handling in R
- Reading commandline parameters from an R script
- Assignment operators in R: ‘=’ vs ‘<- a="">
- Why is not (explicitly) calling return faster or better, and thus preferable?
- Why does TRUE == “TRUE” in R?
- What is the difference between ‘1L’ and ‘1’?
- Why does the number 1e99999 (31 9’s) cause problems?
- Examples of the perils of globals in R and Stata
- How to count TRUE values in a logical vector
**Sorting**- Letter “y” comes after “i” when sorting?
- How to sort a dataframe by column(s) in R?
- Fastest way to find the second (or third) highest/lowest value in a vector or column
**Plotting**- Plotting 2 graphs in the same plot
- How to plot 2 histograms together in R
- Histogram with a logarithmic scale
- The most underutilized visualization
- Rotating and spacing axis labels in ggplot2
- Shading a kernal density plot between 2 points
- Choosing between qplot() and ggplot() in ggplot2
- Intelligent point label placement in R
- Plotting a correlation matrix
- Plotting a 3D surface plot with contour map overlay, using R
- Side-by-side plots using ggplot2
- Ggplot2 cheat sheet
- Plot a human body in 2D
- Plotting 2 variables as lines using ggplot2
- Getting rid of axis values in an R plot
**Grouping Functions and Speed**- R grouping functions: sapply vs lapply vs apply vs tapply vs etc.
- Why is ‘[‘ better than the subset function?
- Confused by …()
- Speeding up “group by” functions
- Options for caching/memoization/hashing in R
**Random**- Making XKCD style plots in R
- Developing geographic thematic maps with R
- What can Matlab do that R cannot do?
- Where to learn C code to speed up your R functions
- How to organize large R programs
- The difference between library() and require()
- Unloading a package without restarting R
- What is the difference between R.exe, Rterm.exe, Rscript.exe, and Rcmd.exe?
- What is your preferred style for naming variables in R?
- In R, what exactly is the problem with having objects with the same base name as functions?
- Easter eggs in R
- Drawing an excellent cow
- Display a time clock on the R commandline
- What are slots?
**Case Studies**

**About:**Stack Overflow is awesome. Some of the worlds most brilliant programmers frequent the website and answer tough questions. Wouldn’t that make it a great place to learn from? Yeah, I think so too.

This is why I’ve collated,

**The Guerilla Cookbook for R**. It’s basically a number of Stack Overflow links organized and ordered in a way to help R programmers learn their way to the next level. If you are proficient in R, I hope these resources will help you get closer to being amazing. If you are just getting started with R, I’d suggest adding this page to your bookmarks and returning when you are familiar with the basics of R programming.

The cool thing is, this “book” essentially writes itself since most of the experts (and peer-reviewers) are answering the questions. Most of the questions are “real-world” and are asked by novice or intermediate programmers. We can easily add/remove/reorganize the contents as necessary.

**How Was The Content Selected?:**I personally searched through Stack Overflow to find my favorite questions and shared them here.

The table of contents will have to be updated/reorganized over time as links are added and removed. But use whatever you can for now!

To

**leave a comment**for the author, please follow the link and comment on their blog:**Optinalysis**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.