I am in statistics class and for the life of me cannot figure out how to code a histogram from my file
the file is
download.file("http://www.openintro.org/stat/data/bdims.RData", destfile = "bdims.RData")
load("bdims.RData")
I need to plot the males height and the females height M=0 F=1 How do I do that? I am so confused and ready to quit.
What have you tried?
You should change the title so that it is briefly explains what you are trying to do (histogram).
I have tried hist(0,dims) that gets me an error of
hist(0,dimnames())
Error in dimnames() : 0 arguments passed to 'dimnames' which requires 1
I need to plot the height of the females and the height of the males. Is there a manual that I could read that would help me? I feel like I am just guessing at this point. The files are called fdims and mdims
Thanks
Tracy
Please take a look at these links and update your question.
Can I ask questions from a course I am taking here?
General questions are always welcome!
Please do ask general questions about things like:
How to use R
How to use the RStudio IDE or RStudio Cloud
How to work with tidyverse packages
Where to find resources to help you learn or solve problems
Specific questions can be OK, if you follow these rules:
Never copy-paste instructions from an assignment (even for online courses).
Explicitly mention the course you are taking and use the #homework tag.
Ask your question as a reproducible example (reprex) , preferably prepared for posting using the reprex package .
Want to maximize your chances of getting the help you need? Keep readin…
Why reprex?
Getting unstuck is hard. Your first step here is usually to create a reprex, or reproducible example. The goal of a reprex is to package your code, and information about your problem so that others can run it and feel your pain. Then, hopefully, folks can more easily provide a solution.
What's in a Reproducible Example?
Parts of a reproducible example:
background information - Describe what you are trying to do. What have you already done?
complete set up - include any library() calls and data to reproduce your issue.
data for a reprex: Here's a discussion on setting up data for a reprex
make it run - include the minimal code required to reproduce your error on the data…
your data is called bdims not dims...
also its not clear what the 0 is intending to achieve ?
I generally prefer ggplot2 to base plotting.
like:
library(tidyverse)
(info_of_interest <- select(bdims,
hgt,sex))
ggplot(data=info_of_interest) +
aes(x=hgt,color=sex,fill=sex) +
geom_histogram(bins = 25)
system
Closed
February 12, 2021, 4:29pm
6
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.