Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am totally new to R programming. When I start working on a dat.file without he

ID: 3151885 • Letter: I

Question

I am totally new to R programming. When I start working on a dat.file without headers, I got the result as follow.

> sleep<-read.table("D:\ucla fight fight fight\econ 144\data\SleepData.dat",header=F)
> names(sleep) <- c("age","black","case","clerical","construc","educ"," earns74","gdhlth","inlf","leis1","leis2","leis3","smsa","lhrwage","lothinc","male","marr","prot","rlxall","selfe","sleep","slpnaps","south","spsepay","spwrk75","totwrk","union","worknrm","workscnd","exper","yngkid","yrsmarr","hrwage","agesq")
> hist(age)
Error in hist(age) : object 'age' not found

Can someone explain how can I get rid of the error and plot the histogram of varibles?

Explanation / Answer

you must put age inside inverted commas

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote