About R R is an open source language released in 2001 that’s ideal for data wrangling and data science. It has connectors to pretty every much every data source under the sun, allows you wrangle data like nobody’s business, build pretty much every type of model ever thought up, and visualise it in all the niftiest ways. These superlatives are not disingenuous, R really is that broad and amazing.
Basic operations Now that we have some datatypes, we can start learning what we can do with them.
Maths In R, we have our common operators that you’re probably used to if you’ve performed calculations on computers before.
Action Operator Example Subtract - 5 - 4 = 1 Add + 5 + 4 = 9 Multiply * 5 * 4 = 20 Divide / 5 / 4 = 1.
data.frames A data.frame is a table similar to what we’re used to working with in most data analysis tools. It will contain a number of rows with columns containing different pieces of information. Each column in a data.frame has a datatype but it does not have to be the same datatype as the other columns.
We can construct a data.frame from individual vectors via the data.frame() function.
And here we have it, spoiler alert, this is the last in the series! Enjoy!
R functions In previous sections we’ve seen R functions that are used on objects to perform some activity. Functions seen so far include:
class() and is.() functions for checking datatypes as. for converting to datatypes length() and names() for metadata head() and tail() for getting a small amount of elements from an object ncol(), nrow(), colnames(), and rownames() for getting data.