
r - How to use dplyr to generate a frequency table - Stack Overflow
I like to create a table that has the frequency of several columns in my data frame. I am copying part of my data frame below. The table is supposed to have frequency (both n and %) of "red" in C...
r - How to get summary statistics by group - Stack Overflow
Mar 24, 2012 · I'm trying to get multiple summary statistics in R/S-PLUS grouped by categorical column in one shot. I found couple of functions, but all of them do one statistic per call, like aggregate(). data &...
Export data from R to Excel - Stack Overflow
Oct 17, 2013 · delimit.table (Corrvar,"Name the csv.csv") ## Corrvar is a name of an object from an output I had on scaled variables to run a regression. However I tried this same code for an output from another analysis (occupancy models model selection output) and it did not work.
r - If/else statement in a table - Stack Overflow
Sep 1, 2012 · Let say, I have a table named table with headers which looks like A B 1 2 2 1 What I want to do is adding a new column table$C such that if table$A < table$B then ...
r - How to reshape data from long to wide format - Stack Overflow
A much more canonical answer can be found at the question linked about, now with the name Reshape three column data frame to matrix ("long" to "wide" format). In my opinion, it would have been better for this one to have been closed as a duplicate of that.
r - How do you delete a column by name in data.table? - Stack …
Feb 9, 2012 · Very simple option in case you have many individual columns to delete in a data table and you want to avoid typing in all column names #careadviced dt <- dt[, -c(1,4,6,17,83,104)]
r - When should I use the := operator in data.table? - Stack Overflow
Aug 11, 2011 · data.table objects now have a := operator. What makes this operator different from all other assignment operators? Also, what are its uses, how much faster is it, and when should it be avoided?
R table with where condition - Stack Overflow
Sep 3, 2013 · I have a simple table (age by marital status) for individuals in a range of geographical zones. I'd like to produce a table for each of these, would this be possible to do using a where statement,
r - How to sum a variable by group - Stack Overflow
Which comes close to the timings when the dataset was split in subdatasets per group. A benchmark on different methods shows that for summing up a single column collapse::fsum was two times faster than Rfast::group.sum and 7 times faster than rowsum. They were followed by tapply, data.table, by and dplyr. xtabs and aggregate are the slowest.
r - Extracting specific columns from a data frame - Stack Overflow
I have an R data frame with 6 columns, and I want to create a new data frame that only has three of the columns. Assuming my data frame is df, and I want to extract columns A, B, and E, this is the...