R command

ls() – list variable names in workspace memory
save.image(file=”R_workspace”) – saving variables to a file
save(new.var, legal.var.name, file = “R_workspace”) – save specified variables
load(“R_workspace”) – load variables saved in a file
system(“ls -al”) – executes a command in the shell, for example ls -al

scalar
numeric, integer, logical

ordered factor

current.season = factor("summer", levels = c("summer", "fall", "winter", "spring"), ordered = TRUE)

x = c(4,3,3,4,3,1)
outcome: 433431
length(x)
outcome: length = 6
y = vector(mode=”logical”, length=4)
outocome: y= FALSE FALSE FALSE FALSE
z = vector(length=3, mode==”numeric”)
outcome: z = 0 0 0

q = rep(3.2, times = 10)
q = 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2 3.2
w = seq(0, 1 by=0.1)
w – 0.0 0.1 0.2 … 0.9 1.0
w = seq(0, 1, length.out 11)

w <= 0.5 0.0 0.1 0.2 0.3 0.4 0.5 any(w <= 0.5) TRUE all(w <= 0.5) FALSE which(w <= 0.5) 1 2 3 4 5 6