, 16 tweets, 5 min read Read on Twitter
Getting ready to start our Intro to R Workshop! #rstats #RLadies
The fabulous instructors for today’s workshop! @nikkirubinstein @goknurginer #RLadies
For those who are new, the #RLadies community is extremely supportive and welcoming!
The basic structure of RStudio consists of: a script, the console, the environment and the viewer pane. We’ll be exploring all of these during today’s workshop
A great use of the console is as a calculator! But remember that there is no memory in the console, which is why we use variables to store information in our environment. To create a variable use the <- to assign names and values. E.g. x <- 1 stores the value “1” as variable “x”
There are 3 data types in R: numbers, strings (need to be in quotes), and logicals (TRUE/FALSE). A quick way to check what data type you are working with is to use the function “class()”. E.g. class(5) returns “numeric”
A vector is a data structure that stores data types in a list format but the data type of all values has to be the same. If you do include other data types R will force them to be the same data type. To create a vector store all the values using c(). E.g. my_vector <- c(1, 2, 3)
If you are unsure of what a function does you can look up its help page by using ? before the function name.
🔎 To return specific values in your vector you can use [] or c() to select values based on their position in the vector, and to exclude values you can use a - in front. E.g. my_vector[1] or my_vector[c(1,3)] or my_vector[-2]
Data frames are another kind of data structure in R where, unlike vectors, you can store variables with different data types. Data frames are are similar to tables in Excel
🔎 To return specific values in your data frame you can use $ to select variables and you can also use conditionals to further select data. E.g. my_dataframe$variable or my_dataframe$variable == “condition”
That’s a wrap on part 1 of the workshop led by @nikkirubinstein covering the basics of R!
Now for part 2 led by @goknurginer giving us a guide to using R for everyday data analysis! 📊
🗂 to easily open files use setwd() to set your working directory and then use file.choose() to find your file and copy its location path. Then depending on your file type you can use read.csv(), read.table(), or read.delim(“location_path”) to import your file.
In real life datasets there are often NAs or missing values. To ignore NAs when computing certain functions you can use na.rm = TRUE. E.g. mean(variable, na.rm = TRUE)
A handy trick to display all the possible arguments for a particular function (including the default arguments) use ?function_name or use tab when entering the function arguments
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to R-Ladies Melbourne
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!