TalkingQuickly's Today I Learned

3 posts about #data-science

R Packages

Install R packages with:


Load them for use at runtime with:


Tidyverse is a collection of packages for R which seem to be widely referenced as well written R code ( They're used extensively in the excellent book R for Data Scientists

Really Basic R Concepts

For assignment should always use <- rather than =

Can use class(VAR) to get the type of an object

R functions allow both positional and name based matching. So class(5) and class(x=5) are both valid invocations, class(y=5) is not because class does not have an argument named y. Default arguments for functions are supported.

Use ?method for docs, e.g. ?class. Running this in RStdudio triggers a wonderful bit of magic where docs are displayed in the output panel rather than the console.

Great overview:

R has lots of built in example data sets

The package datasets contains a selection of example datasets which can be used for testing out and playing with R functions.

You can get a list of all available datasets by running data() in a console. Each dataset is available by default in a variable the name of which is outputted in data(), e.g. AirPassengers or cars.

A summary of the data can be generated using the R function summary, e.g. summary(cars).