Beginning Question

Hello, I have absolutely no knowledge of coding but I am taking a stats class where I need to use this program and I am struggling because I have little guidance. I want to make a histogram of the variable "Exercise" from a data set (attaching a screenshot) and whenever I type hist(exercise) it tells me the object was not found. I am sure I am making an error, does anyone know what to do? Thanks so much.

Try hist(StudentSurvey$Exercise)

Also, don't attach screenshots. Create a reproducible example next time.

1 Like

ls() will show the objects in namespace; that will confirm that the message in the screenshot is correct. See also the upper right hand quadrant: "Global environment is empty." That indicates that nothing at all has been loaded.

When the "StudentSurvey" object has been loaded, use

str(StudentSurvey)

to see what types of variable are contained. Only numeric variables can be plotted as histograms.

An alternative display is provided by stem

stem(mtcars$mpg)
#> 
#>   The decimal point is at the |
#> 
#>   10 | 44
#>   12 | 3
#>   14 | 3702258
#>   16 | 438
#>   18 | 17227
#>   20 | 00445
#>   22 | 88
#>   24 | 4
#>   26 | 03
#>   28 | 
#>   30 | 44
#>   32 | 49

Created on 2020-09-18 by the reprex package (v0.3.0)

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.