r/RStudio • • 8d ago

Coding help ANOVA Statistics Help

Hello RStudio community!

I'm a graduate student trying to conduct an ANOVA on some data I have; it is 5 columns of data all outlining the density of bats in a cave, with the number of samples per opening ranging from 15 to 30 samples. I'd like to conduct a 1 way anova due to the variance in samples and also the relatively low sample size per opening.

I'm trying to use the aov() function, but I'm not sure how to use all 5 columns (might it be easier to shift it around to have the openings as row headers?) at once for my ANOVA.

Thanks in advance!

5 Upvotes

6 comments sorted by

5

u/Hybodont 8d ago

You need two columns in total: one for density observations (quantitative), and a second column specifying which cave opening is associated with each observation (categorical).

2

u/RnbwTurtle 8d ago

This fixed it!!! Thank you!

3

u/sam-salamander 8d ago

Adding on, look into pivot_longer() to get your data into this format.

6

u/Capable-Dirt-6033 8d ago

This subreddit is just the evolution of Andy buying 36 watermelons at Costco.

2

u/SalvatoreEggplant 8d ago

As a off-the-question-topic comment:

If you haven't done so, it would be helpful to consult with someone in your department familiar with running statistics on this type of data.

You didn't say exactly what you're measuring, but it sounds like it might be count data (counts of bats ?).

Often traditional general linear model / anova is not appropriate for ecological data, and people get in a pickle when their work goes to review (by graduate committee or journal reviewer) and they have to re-do all the analyses.

1

u/AutoModerator 8d ago

Looks like you're requesting help with something related to RStudio. Please make sure you've checked the stickied post on asking good questions and read our sub rules. We also have a handy post of lots of resources on R!

Keep in mind that if your submission contains phone pictures of code, it will be removed. Instructions for how to take screenshots can be found in the stickied posts of this sub.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.