dmcglinn / quant_methods

Applied Quantitative Methods course at the College of Charleston
http://dmcglinn.github.io/quant_methods/
Other
18 stars 26 forks source link

getting data for acer and abies #42

Closed Mckenziematt closed 5 years ago

Mckenziematt commented 5 years ago

Hi there,

This may be a super simple question but I'm struggling here. I am trying to perform box plots on the acer and abies data for the "cover" variable. When I use this code it gives me the cover data for all species in the tree data set. How do I tell R to specifically give me the cover data for just abies and acer and perform a box plot. boxplot(cover ~ species, data = tree, xlab='species', ylab = 'cover')

jensenac commented 5 years ago

You might need to create a subset first. For example, I used the following script to isolate only the Acer rubrum data.

ACE<-subset(trees, species == 'Acer rubrum', select =c(species:beers)) ACE

With the subset you should be able to work with only what you want. Hope this helps.

dmcglinn commented 5 years ago

Did that answer your question? If so please close the issue. Thanks!

On Feb 4, 2019, at 4:05 PM, jensenac notifications@github.com wrote:

You might need to create a subset first. For example, I used the following script to isolate only the Acer rubrum data.

ACE<-subset(trees, species == 'Acer rubrum', select =c(species:beers)) ACE

With the subset you should be able to work with only what you want. Hope this helps.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

dmcglinn commented 5 years ago

One thing I forgot to note is that remember that boxplots are best when you are comparing a continuous variable (like cover) to a categorical variable. The only categorical explanatory variable in the trees dataset is disturb so to make a boxplot for that variable would look something like this:

acer <- subset(trees, species == "Acer rubrum")
boxplot(cover ~ disturb, data = acer)