issue with finding an object in my data set

students=read.csv("C:\\Users\\user\\Documents\\PDFA individual assignment '22\\student.csv", header=TRUE)
students
View(students)
head(students)
data.frame(students)

famsize=nrow(sample_data[sample_data$students=="famsize",])
famsize
famrl=nrow(sample_data[sample_data$students=="famrel",])
famrel
ggplot (students , aes(x = famzise, y = famrel)) + geom_line () + geom_point()

i keep getting this error : Error in FUN(X[[i]], ...) : object 'famzise' not found

typo, you swapped z for s

hi! thanks for your reply,really appreciate it,ive been staring at it too long i didnt even realise haha but im still getting this error? "Error in fortify():
! data must be a data frame, or other object coercible by fortify(), not a character vector.
Run rlang::last_error() to see where the error occurred."

students=c("index","school","sex","age","address","famsize","Pstatus","Medu","Fedu","Mjob","Fjob","reason","guardian","traveltime","studytime","failures","schoolsup","famsup","paid","activities","nursery","higher","internet","romantic","famrel","freetime","goout","Dalc","Walc","health","absences","G1","G2","G3")
data.frame(students)
ggplot (students , aes(x = famsize, y = famrel)) + geom_line () + geom_point()

this is the code i have right now!

students is a vector ie. c(" ....")
its not a data.frame
In your earlier code students was a data.frame, and you perhaps could have used that, but in this code you make it as a plain vector.
you do have a line immediately after that involves passing the plain vector into data.frame (as if to construct one). but this isnt assigned to any object (theres no name with <- pointing to it , or = sign) and there wouldnt seem any point/value to doing that as it would be just text, with no numbers (so not plot worthy, unless perhaps a histogram)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.