This is a clear, step by step guide to investigating your data in your R project on R-Studio / Posit cloud. This includes the code you need to write, as well as explanations as to what different parts of the code means to help ensure code annotations are informed, which is needed for your final por...
Skills for Biologists: Data Science
Investigating your data in R- Studio / Posit Cloud
You should have a R project set up and your data uploaded at this point 😊
For the purposes of explaining, there are 3 packages I’ll explain how to install and
run, and like before the data set I will be using to explain is nicknamed bird.
Don’t forget that R doesn’t like spaces and is case sensitive!
Now you have your data uploaded into your files folder, we are going to go back to
your first panel and input 6 lines of code that are going to install and run 3 packages.
You will input and run the following:
install.packages(“ggplot2”)
Once you run this, your panel 2 should show lines of red text – this is completely
fine, it is installing the package. You then need to input:
library(ggplot2)
Running this will just show you the same text repeated in your second panel, but it
has enabled R to load the package, meaning you are now able to use it.
You should now repeat this with the packages “tidyverse” and “patchwork”, this is
done in the same way as the ggplot2 package. Once you’ve installed and run these
two packages, you should have six lines of code that look like this:
install.packages(“ggplot2”)
library(ggplot2)
install.packages(“tidyverse”)
library(tidyverse)
install.packages(“patchwork”)
library(patchwork)
Now, unless you have already done so, you need to tell R to read your data. To do
this, I always make sure I have files open in my panel 4 to make sure I do not
misspell the name of my uploaded document. I also suggest you give your data set a
one-word nickname that is relevant to the data. To explain it here, I will be using data
named bird_feeder.csv and will nickname it bird.
To tell R to read your data you need to input the following code (obviously changing
where it says bird and bird_feeder to the relevant things):
bird<-read.csv(“data/bird_feeder.csv”)
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller kayleighsheppard. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £3.99. You're not tied to anything after your purchase.