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.

Convert data.frame column format from character to factor

I would like to change the format (class) of some columns of my data.frame object (mydf) from charactor to …

r dataframe character r-faq
How to save a plot as image on the disk?

I plot a simple linear regression using R. I would like to save that image as PNG or JPEG, is …

r plot ggplot2 lattice r-faq
Replace all 0 values to NA

I have a dataframe with some numeric columns. Some row has a 0 value which should be considered as null in …

r r-faq
How to import multiple .csv files at once?

Suppose we have a folder containing multiple data.csv files, each containing the same number of variables but each from …

r csv import r-faq
Order Bars in ggplot2 bar graph

I am trying to make a bar graph where the largest bar would be nearest to the y axis and …

r ggplot2 r-faq
Generate a dummy-variable

I have trouble generating the following dummy-variables in R: I'm analyzing yearly time series data (time period 1948-2009). I have …

r r-faq
ggplot with 2 y axes on each side and different scales

I need to plot a bar chart showing counts and a line chart showing rate all in one chart, I …

r ggplot2 r-faq
How to make a great R reproducible example

When discussing performance with colleagues, teaching, sending a bug report or searching for guidance on mailing lists and here on …

r r-faq
Combine two data frames by rows (rbind) when they have different sets of columns

Is it possible to row bind two data frames that don't have the same set of columns? I am hoping …

r dataframe r-faq
How can I trim leading and trailing white space?

I am having some troubles with leading and trailing white space in a data.frame. For example, I like to …

r whitespace trim removing-whitespace r-faq