Summary of R commands you encounter in Week 1, from swirl lessons 1 and 3.
Command | Purpose | Example |
---|---|---|
? | pull up a help page | ?seq |
: | colon operator(generate regular sequence) | 1.5:4 |
<- | assignment | x <- 5 + 7 |
c | concatenate | c(1.1, 9, 3.14) |
seq, seq_along | sequence generation | seq(1,10,0.5) |
length | return the length of a vector | length(pi:100) |
rep | replicate elements of vectors | rep(c(1,2,3),5) |