Social Media Research

02 R Data Analysis


Question

name <- c("Steve","Sophia","Oliver","Harry","Peter","Olivia","Marc")

determine the names of all users except the 2. and the 4.


Answer

name[c(-2, -4)]

or

name[c(1,3,5,6,7)]




Comments

Is name[-c(2,4)] also possible?


Yes it is:

> name[-c(2,4)]
[1] "Steve"  "Oliver" "Peter"  "Olivia" "Marc"