Here is the input:
name<-c("Joe", "John", "Nancy")
sex <- c("M", "M", "F")
age <- c(27, 26, 26)
df <- data.frame(name, sex, age)
result <-data.frame(name$age, name$sex)
print(result)
comes back as:
Error in name$age : $ operator is invalid for atomic vectors
but I thought I was creating a dataframe!
Also it automatically prints out the result of the last equation which is kind of strange...