Gang Of Coders
Home
About Us
Contact Us
All R Faq Solutions on Gang of Coders
Total of 160 R Faq Solutions
rank and order in R
R
Sorting
R Faq
Error: unexpected symbol/input/string constant/numeric constant/SPECIAL in my code
R
R Faq
Simultaneously merge multiple data.frames in a list
R
List
Merge
Dataframe
R Faq
How and when should I use on.exit?
R
R Faq
Split data frame string column into multiple columns
R
String
Dataframe
Split
R Faq
Create an ID (row number) column
R
Dataframe
R Faq
Combine two data frames by rows (rbind) when they have different sets of columns
R
Dataframe
R Faq
Export data from R to Excel
R
Excel
R Faq
Reshaping multiple sets of measurement columns (wide format) into single columns (long format)
R
Reshape
Tidyr
Reshape2
R Faq
ggplot with 2 y axes on each side and different scales
R
Ggplot2
R Faq
Subset rows in a data frame based on a vector of values
R
Subset
R Faq
Numeric comparison difficulty in R
R
Floating Point
Comparison
Comparison Operators
R Faq
Why are these numbers not equal?
R
Floating Point
Floating Accuracy
R Faq
How do I get a list of built-in data sets in R?
R
Dataset
R Faq
How to debug "contrasts can be applied only to factors with 2 or more levels" error?
R
Regression
Lm
Glm
R Faq
Determine path of the executing script
R
File
Path
Rscript
R Faq
Convert integer to class Date
R
Date
R Faq
How to import multiple .csv files at once?
R
R Faq
Add regression line equation and R^2 on graph
R
Ggplot2
Linear Regression
R Faq
Grouping functions (tapply, by, aggregate) and the *apply family
R
Lapply
Sapply
Tapply
R Faq
What are the main differences between R data files?
R
R Faq
Rdata
Rda
Change R default library path using .libPaths in Rprofile.site fails to work
R
Rstudio
R Faq
Library Path
Find the day of a week
R
Date
R Faq
How do I make a list of data frames?
R
List
Dataframe
R Faq
Use dynamic name for new column/variable in `dplyr`
R
Dplyr
R Faq
ggplot2 line chart gives "geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?"
R
Ggplot2
R Faq
Remove rows with all or some NAs (missing values) in data.frame
R
Dataframe
Filter
Missing Data
R Faq
Drop data frame columns by name
R
Dataframe
R Faq
Use of ~ (tilde) in R programming Language
R
R Faq
R Formula
Reshaping data.frame from wide to long format
R
Dataframe
Reshape
R Faq
Numbering rows within groups in a data frame
R
Dataframe
R Faq
What are the differences between "=" and "<-" assignment operators in R?
R
Assignment Operator
R Faq
Speed up the loop operation in R
Performance
R
Loops
Rcpp
R Faq
Error: could not find function ... in R
R
Function
Error Handling
R Faq
Remove duplicated rows
R
Duplicates
R Faq
How to find common elements from multiple vectors?
R
Vector
R Faq
How to remove all whitespace from a string?
R
Regex
String
R Faq
Replace all 0 values to NA
R
R Faq
Replacing NAs with latest non-NA value
R
data.table
Zoo
R Faq
R memory management / cannot allocate vector of size n Mb
R
Matrix
Vector
Memory Management
R Faq
Convert data.frame column format from character to factor
R
Dataframe
Character
R Faq
Error in if/while (condition) {: missing Value where TRUE/FALSE needed
R
R Faq
Aggregate / summarize multiple variables per group (e.g. sum, mean)
R
Dataframe
data.table
Aggregate
R Faq
Filter data.frame rows by a logical condition
R
Dataframe
Subset
R Faq
What does %>% function mean in R?
R
Syntax
Dplyr
Magrittr
R Faq
Group by multiple columns in dplyr, using string vector input
R
Dplyr
R Faq
Add legend to ggplot2 line plot
R
Ggplot2
Legend
R Faq
Installing older version of R package
R
Installation
Version
R Faq
How do you use "<<-" (scoping assignment) in R?
R
Scoping
Lexical Scope
R Faq
How to use a variable to specify column name in ggplot
R
Ggplot2
Tidyeval
R Faq
Nse
Dynamically select data frame columns using $ and a character value
R
Dataframe
R Faq
Should I use a data.frame or a matrix?
R
Matrix
Dataframe
R Faq
Only read selected columns
R
Import
R Faq
Pass a data.frame column name to a function
R
Dataframe
R Faq
Order discrete x scale by frequency/value
R
Ggplot2
R Faq
Reorder levels of a factor without changing order of values
R
Sorting
Levels
R Faq
How to convert a factor to integer\numeric without loss of information?
R
Casting
R Faq
Plot two graphs in same plot in R
R
Plot
Ggplot2
R Faq
Count number of rows within each group
R
Dataframe
Aggregate
R Faq
Using R to download zipped data file, extract, and import data
R
Connection
Zip
R Faq
How should I deal with "package 'xxx' is not available (for R version x.y.z)" warning?
R
Installation
Repository
Package
R Faq
Convert UNIX epoch to Date object
R
Time
R Faq
Warning message: In `...` : invalid factor level, NA generated
R
Warnings
R Faq
Finding ALL duplicate rows, including "elements with smaller subscripts"
R
Duplicates
R Faq
Why can't R's ifelse statements return vectors?
R
If Statement
Vectorization
R Faq
How to read data when some numbers contain commas as thousand separator?
R
Csv
R Faq
Split comma-separated strings in a column into separate rows
R
String
Split
R Faq
Combine two or more columns in a dataframe into a new column with a new name
R
Dataframe
Multiple Columns
R Faq
How can I view the source code for a function?
R
Function
R Faq
What is the difference between require() and library()?
R
Package
R Faq
Controlling number of decimal digits in print output in R
R
Precision
Digits
R Faq
Output Formatting
What does "S3 methods" mean in R?
R
Oop
R Faq
R S3
R S4
How to unload a package without restarting R
R
Package
R Faq
Select the row with the maximum value in each group
R
Dataframe
R Faq
How to search for "R" materials?
R
Search
R Faq
The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe
R
List
Dataframe
Extract
R Faq
Test if a vector contains a given element
R
Vector
R Faq
Unique combination of all elements from two (or more) vectors
R
R Faq
Error in <my code> : object of type 'closure' is not subsettable
R
R Faq
Scheduling R Script
R
Windows
Schedule
R Faq
Drop unused factor levels in a subsetted data frame
R
Dataframe
R Factor
R Faq
General suggestions for debugging in R
R
Debugging
R Faq
Set default CRAN mirror permanent in R
R
Cran
R Faq
How to make a great R reproducible example
R
R Faq
Create an empty data.frame
R
Dataframe
R Faq
Multiline Comment Workarounds?
R
Comments
R Faq
Confusion between factor levels and factor labels
R
R Factor
R Faq
Paste multiple columns together
R
Paste
R Faq
Quickly reading very large tables as dataframes
R
Import
Dataframe
R Faq
List distinct values in a vector in R
R
Vector
Distinct Values
R Faq
How do you specifically order ggplot2 x axis instead of alphabetical order?
R
Ggplot2
R Faq
Rename multiple columns by names
R
Dataframe
Rename
R Faq
Converting year and month ("yyyy-mm" format) to a date?
R
Date
Posix
Zoo
R Faq
How to name variables on the fly?
R
Assign
R Faq
Convert a vector into a list, each element in the vector as an element in the list
R
R Faq
Fitting a density curve to a histogram in R
R
Histogram
Curve Fitting
R Faq
Apply several summary functions on several variables by group in one call
R
Aggregate
R Faq
Get filename without extension in R
R
R Faq
How to subset matrix to one column, maintain matrix data type, maintain row/column names?
R
Matrix
Subset
R Faq
Collapse / concatenate / aggregate a column to a single comma separated string within each group
R
Aggregate
R Faq
Read an Excel file directly from a R script
Excel
R
R Faq
Understanding the order() function
R
Sorting
R Faq
How to find the statistical mode?
R
Statistics
R Faq
Counting the number of elements with the values of x in a vector
R
Vector
Count
R Faq
Generate a dummy-variable
R
R Faq
How to sum a variable by group
R
Dataframe
Aggregate
R Faq
How to write trycatch in R
R
Exception
Exception Handling
Try Catch
R Faq
Select rows from a data frame based on values in a vector
R
Subset
R Faq
What does "The following object is masked from 'package:xxx'" mean?
R
R Faq
Counting unique / distinct values by group in a data frame
R
Dataframe
Distinct Values
R Faq
Pasting two vectors with combinations of all vectors' elements
R
R Faq
How do I deal with special characters like \^$.?*|+()[{ in my regex?
Regex
R
R Faq
How can two strings be concatenated?
R
String Concatenation
R Faq
How to plot all the columns of a data frame in R
R
Dataframe
Plot
R Faq
Calculate the mean by group
R
Dataframe
R Faq
Combine a list of data frames into one data frame by row
R
List
Dataframe
R Faq
How to add leading zeros?
R
Formatting
Number Formatting
R Faq
Why is `vapply` safer than `sapply`?
R
Apply
R Faq
Why is `[` better than `subset`?
R
Filter
Subset
R Faq
Extracting specific columns from a data frame
R
Dataframe
R Faq
R: what are Slots?
Oop
R
S4
Slot
R Faq
Convert a dataframe to a vector (by rows)
R
Dataframe
Vector
R Faq
How to plot a function curve in R
R
Ggplot2
Plot
Lattice
R Faq
How to split a data frame?
R
Split
Dataframe
R Faq
Subset / filter rows in a data frame based on a condition in a column
R
Dataframe
Subset
R Faq
Elegant way to check for missing packages and install them?
R
Packages
R Faq
Side-by-side plots with ggplot2
R
Ggplot2
Visualization
R Faq
Sample random rows in dataframe
R
Dataframe
Random
R Faq
Re-ordering factor levels in data frame
R
Dataframe
Levels
R Faq
Using ggplot2, can I insert a break in the axis?
R
Ggplot2
R Faq
Round up from .5
R
Rounding
R Faq
How to subtract/add days from/to a date?
R
Date
R Faq
How can I trim leading and trailing white space?
R
Whitespace
Trim
Removing Whitespace
R Faq
do-while loop in R
R
Loops
Repeat
Do While
R Faq
duplicate 'row.names' are not allowed error
R
Csv
R Faq
ending "+" prompt in R
R
R Faq
How does one reorder columns in a data frame?
R
Sorting
Dataframe
R Faq
Access variable value where the name of variable is stored in a string
R
Variables
R Faq
How to load packages in R automatically?
R
Loading
R Package
R Faq
Defaults
ggplot's qplot does not execute on sourcing
R
Ggplot2
R Faq
Test if characters are in a string
R
Regex
String
R Faq
Order Bars in ggplot2 bar graph
R
Ggplot2
R Faq
Plotting two variables as lines using ggplot2 on the same graph
R
Ggplot2
Graph
Time Series
R Faq
Why do R objects not print in a function or a "for" loop?
R
For Loop
Printing
R Faq
Split data.frame based on levels of a factor into new data.frames
R
Dataframe
R Faq
R round to nearest .5 or .1
R
Rounding
R Faq
How to join (merge) data frames (inner, outer, left, right)
R
R Faq
Sort (order) data frame rows by multiple columns
R
Sorting
Dataframe
R Faq
Cleaning up factor levels (collapsing multiple levels/labels)
R
R Factor
R Faq
How to reshape data from long to wide format
R
Reshape
R Faq
Count number of rows per group and add result to original data frame
R
Count
Aggregate
R Faq
How to sort a character vector where elements contain letters and numbers in R?
R
Sorting
R Faq
How can I remove an element from a list?
R
List
Indexing
R Faq
Evaluate expression given as a string
R
Eval
R Faq
How to save a plot as image on the disk?
R
Plot
Ggplot2
Lattice
R Faq
Formatting Decimal places in R
R
Formatting
Rounding
R Faq
How to subtract years?
R
Date
Date Arithmetic
R Faq
Why is it not advisable to use attach() in R, and what should I use instead?
R
Dataframe
R Faq
What's the biggest R-gotcha you've run across?
R
R Faq
Concatenate a vector of strings/character
R
String
R Faq