In Session II of this R workshop, we plan to cover the following:
To return to the list of sessions at the rpubs website, click here
sqrt() # square root
exp() # exponential function
abs() # absolute value
log() # natural logarithms
min() # minimum value
max() # maximum value
mean() # mean value
sd() # standard deviation
median() # sample median
quantile() # sample quantiles
var() # variance
sum() # sum
length() # get or set the length of vectors (including lists) and factors
read.table() # reads a text file in table format and creates a data frame from it
read.csv() # reads a csv file in table format and creates a data frame from it
read.xls() # reads a Microsoft Excel file into a data frame
readClipboard() # reads the clipboard into a data frame (only available on Windows)
read.table(file="clipboard", sep="\t", header=TRUE) # reads the clipboard into a data frame
head() # returns the first part of a vector, matrix, table, data frame or function
tail() # returns the last part of a vector, matrix, table, data frame or function
summary() # returns summaries of various object classes
dim() # retrieve or set the dimension of an object
for(condition){instructions} # executes instructions for a certain number of times
# can also be written:
for(condition){
instruction 1
instruction 2
}
if(condition){instructions}else{instructions} # checks whether condition is true and executes instructions
# can also be written:
if(condition){
instruction 1
instruction 2
}else{ # else needs to be on the same line as } and {
instruction 1
instruction 2
}
while(condition){instructions} # executes instructions while condition is true
# can also be written:
while(condition){
instruction 1
instruction 2
}
Adapted from https://www.datacamp.com/community/tutorials/r-tutorial-read-excel-into-r