Top "R-faq" questions

The r-faq tag is created to group a limited number of questions discussing problems that come up regularly on the R tag.

How to use a variable to specify column name in ggplot

I have a ggplot command ggplot( rates.by.groups, aes(x=name, y=rate, colour=majr, group=majr) ) inside a …

r ggplot2 r-faq
Access variable value where the name of variable is stored in a string

Similar questions have been raised for other languages: C, sql, java, etc. But I'm trying to do this in R. …

r variables r-faq
Get filename without extension in R

I have a file ABCD.csv The length before the .csv is not fixed and vary to any length. How …

r r-faq
How to end a 'debug' mode?

In RStudio, I started a debug mode by debug(ls) ls() Then I do not know how to end this …

r debugging rstudio r-faq
How do you use "<<-" (scoping assignment) in R?

I just finished reading about scoping in the R intro, and am very curious about the <<- assignment. …

r scoping lexical-scope r-faq
Multiline Comment Workarounds?

I (sort of) already know the answer to this question. But I figured it is one that gets asked so …

r comments r-faq
Error in <my code> : target of assignment expands to non-language object

I received the error Error in <my code> : target of assignment expands to non-language object or Error in &…

r r-faq
How to load packages in R automatically?

Could you suggest me a way for loading packages in R automatically? I mean, I want to start a session …

r loading r-package r-faq defaults
Dollar sign before a variable

I have this sample code to create a new data frame 'new_data' from the existing data frame 'my_data'. …

r dataframe r-faq dollar-sign
How to subtract years?

I have a date in R, e.g.: dt = as.Date('2010/03/17') I would like to subtract 2 years from …

r date date-arithmetic r-faq