- Part 0: A little bit of set up!
- Part 1: reading in manually (point and click)
- Part 2: reading in directly & working directories
- Part 3: checking data & multiple file formats
We will cover Output a bit later!
We will cover Output a bit later!
Let’s make an R Project so we can stay organized in the next steps.
Click the new R Project button at the top left of RStudio:
In the New Project Wizard, click “New Directory”:
Click “New Project”:
Type in a name for your new folder.
Store it somewhere easy to find, such as your Desktop:
You now have a new R Project folder on your Desktop!
Make sure you add any scripts or data files to this folder as we go through today’s lesson. This will make sure R is able to “find” your files.
We will review this in lab.
jhur
packageYouth Tobacco Survey (YTS) dataset:
“The YTS was developed to provide states with comprehensive data on both middle school and high school students regarding tobacco use, exposure to environmental tobacco smoke, smoking cessation, school curriculum, minors’ ability to purchase or otherwise obtain tobacco products, knowledge and attitudes about tobacco, and familiarity with pro-tobacco and anti-tobacco media messages.”
>
File>
Import Dataset>
From Text (readr
)>
paste the url (http://jhudatascience.org/intro_to_r/data/Youth_Tobacco_Survey_YTS_Data.csv)>
click “Update” and “Import”You see a preview of the data on the top left pane.
You see a new object called Youth_Tobacco_Survey_YTS_Data
in your environment pane (top right). The table button opens the data for you to view.
R ran some code in the console (bottom left).