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...
Hello! I figured out to take out the $ and it worked fine. But I was unaware that I was in a global environement. How can I differentiate?
By the way, thanks for your time. It wouldn't be possible to get thru this muck without some direction.