Skip to content

Latest commit

 

History

History
83 lines (42 loc) · 8.19 KB

Canonicals.md

File metadata and controls

83 lines (42 loc) · 8.19 KB

Plot with 2 y axes, one y axis on the left, and another y axis on the right I need to plot a bar chart showing counts and a line chart showing rate all in one chart, I can do both of them separately, but when I put them together, I scale of the first layer (i.e. the geom_bar) is overlapped by the second layer (i.e. the geom_line).

Mean per group in a data.frame I have a data.frame and I need to calculate the mean per group (i.e. per Month, below).

Reshape three column data frame to matrix I have a data.frame that looks like this. [...] I want this in matrix form so I can feed it to heatmap to make a plot. The result should look something like:

Subset by group with data.table Assume I have a data table containing some baseball players: [...] For each player (given by id), I want to find the row corresponding to the year in which they played the most games.

Interleave lists in R Let's say that I have two lists in R, not necessarily of equal length, What is the best way to construct a list of interleaved elements where, once the element of the shorter list had been added, the remaining elements of the longer list are append at the end?

How to join (merge) data frames (inner, outer, left, right)? Given two data frames How can I do database style, i.e., sql style, joins?

Reshape data from long to wide format R I want to reshape it so that each unique "name" variable is a rowname, with the "values" as observations along that row and the "numbers" as colnames. Sort of like this:

Reshaping data.frame from wide to long format I want to transform wide into a long data.frame

Why are these numbers not equal? floating point error

How to sum a variable by group? I want to sort the data by Category and sum the Frequencies:

R Grouping functions: sapply vs. lapply vs. apply. vs. tapply vs. by vs. aggregate I've never quite understood the differences between them, so I often just go through them all until I get what I want. Can someone explain how to use which one when?

Is there an aggregate FUN option to count occurrences?

Count number of observations/rows per group and add result to data frame

Counting unique / distinct values by group in a data frame

How to add count of unique values by group to R data.frame

split comma-separated column into separate rows

What is the difference between %>% and %,% in magrittr? Github developmental version of magrittr includes some cool new function for piping but I do not exactly catch de difference between %>% and %,%. Is this only formal with %>% for value and %,% for functions, or there is some specific peculiarity?

What does %>% mean in R

Split a column of a data frame to multiple columns

Split column at delimiter in data frame Split column in multiple columns.

Aggregating by unique identifier and concatenating related values into a string

Collapse / concatenate / aggregate a column to a single comma separated string within each group

How can I view the source code for a function?

Assignment operators in R: '=' and '<-' What are differences in the assignment operators = and <- in R

Numbering rows within groups in a data frame How to add a counter variable by group.

as.Date with dates in format m/d/y in R Converting numeric dates.

as.Date returning NA while converting from 'ddmmmyyyy' Converting dates with month abbreviations.

Converting year and month ("yyyy-mm" format) to a date in R? Reading dates only consisting of year-month pairs.

Using aggregate to apply several functions on several variables in one call

multiple functions in a single tapply or aggregate statement

Subset data frame based on number of rows per group

Understanding the order() function I wanted ranks and I find order does not work as expected.

Aggregate / summarize multiple variables per group (i.e. sum, mean, etc)

Select rows from a data frame based on values in a vector: subsetting by comparing to values in a vector.

Merge with replacement based on multiple non-unique columns update join based on multicolumn key, not specific to a particular package

Reshaping multiple sets of measurement columns (wide format) into single columns (long format)

Finding ALL duplicate rows, including “elements with smaller subscripts”

Count number of rows within each group

Conditional merge/replacement in R a simple update join

Generate a dummy-variable

How to process and combine data.frames in a list with faster way read in and stack similar files with rbindlist or bind_rows

Remove groups with less than three unique observations