Talk:Starting in R
From AWF-Wiki
Some tips
# A simple sequence of integer numbers can also be generated like this: 1:9 # Thus example 1 in the article can be simplified v <- c(1,2,4,5,6,7,8,9) # same as: v <- 1:9 # The 'which()' command in the last code snippet is not necessary! # It returns the positions (indices) of all 'v>=6' in the vector, # which is sometimes useful in programming. which(v>=6) # These are the indices: all numbers >= 6 are located at positions 6 to 9 v[which(v>=6)] # ...thus returns the numbers at position 6 to 9 v[>=6] # also does the trick