<-is known as an “assignment operator” – it means “Make the object named to the left equal to the output of the code to the right”
&means AND, in Boolean logic
|means OR, in Boolean logic
!means NOT, in Boolean logic
"United States", or
"2016-07-26". Numbers are not quoted
c, for combine, with the values separated by commas, for example:
c(1:10)creates a list of integers (whole numbers) from one to ten.
<greater than less than
<=greater than or equal to, less than or equal to
!=not equal to
==tests whether the objects on either end are equal. This is often used in filtering data
=makes an object equal to a value, which is similar to
<-but used within a function.
is.na(x)looks for nulls within variable
!is.na(x) looks for non-null values within variablex`
is.na() is a function. Functions are followed by parentheses, and act on code/data in the parentheses.
Object and variable names in R should not contain spaces
||List current working directory|
||Change the current working directory to my directory|
||List the objects in the current work space|
||Save specific objects to a file|
||Load a work space into the current session (default = .RData)|
Mac users may need to alter their security preferences to allow apps authored by non-Apple developers to install. If you notice an error, try to change your system preferences.
||Help on function foo (the quotation marks are optional)|
||Search the help system for instances of the string foo|
||Examples of function foo (the quotation marks are optional)|
search() #what packages are loaded
\in a path name on Windows
setwd("c:\mydata")will generate an error. Use
str_trim()is contained in the stringr package.
© Copyright 2018, Andrew Ba Tran
© Copyright 2018, Andrew Tran