Import Data
This lesson is called Import Data, part of the R in 3 Months (Fall 2021) course. This lesson is called Import Data, part of the R in 3 Months (Fall 2021) course.
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Loading transcript...
Your Turn
Create a new R script file and save it as
import.RAdd the line
library(tidyverse)at the top of your R script file and run it to load the tidyverse package.Use the
read_csv()function (notread.csv()) to import thepenguins_data.csvfile
Have any questions? Put them below and we will help you out!
Course Content
134 Lessons
1
Welcome to Getting Started with R
00:57
2
Install R
02:05
3
Install RStudio
02:14
4
Projects
07:54
5
Files in R
04:33
6
Packages
02:38
7
Import Data
05:24
8
Objects and Functions
03:16
9
Examine our Data
12:50
10
Import Our Data Again
07:11
11
Getting Help
07:46
12
Wrapping Up
13
R in 3 Months Fall 2021 Week 1 Live Session
54:07
1
Getting Started
03:01
2
The Tidyverse
12:11
3
select
05:48
4
mutate
04:08
5
filter
10:26
6
summarize
03:20
7
group_by
02:56
8
count
02:06
9
arrange
03:58
10
Create a New Data Frame
02:42
11
Crosstabs
06:58
12
Wrapping Up
13
R in 3 Months Fall 2021 Week 3 Project Assignment
06:03
14
R in 3 Months Fall 2021 Week 3 Office Hours
55:49
15
R in 3 Months Fall 2021 Week 3 Live Session
1:10:01
1
An Important Workflow Tip
05:00
2
The Grammar of Graphics
06:08
3
Scatterplots
05:15
4
Histograms
02:31
5
Bar Charts
06:32
6
color and fill
03:58
7
scales
09:14
8
Text and Labels
08:04
9
Plot Labels
06:06
10
Themes
03:56
11
Facets
05:57
12
Save Plots
05:17
13
Wrapping Up
14
You Did It!
15
R in 3 Months Fall 2021 Week 4 Project Assignment
04:40
16
R in 3 Months Week 4 Office Hours
56:30
17
R in 3 Months Fall 2021 Week 4 Live Session
1:05:25
1
What is Git? What is GitHub?
02:23
2
Why Should You Learn to Use Git and GitHub?
03:04
3
Update Everything
07:34
4
Install Git
04:04
5
Configure Git
02:10
6
Create a Local Git Repository
03:16
7
Commits
06:00
8
Commit History
04:28
9
GitHub Repositories
04:47
10
Connect RStudio and GitHub
05:06
11
Push an RStudio Project to a GitHub Repository
02:57
12
Pull a GitHub Repository to an RStudio Project
02:52
13
Keep RStudio and GitHub in Sync
02:27
14
R in 3 Months Week 6 Office Hours
59:43
15
R in 3 Months Fall 2021 Week 6 Project Assignment
07:55
16
R in 3 Months Fall 2021 Week 6 Live Session
54:10
1
Overview
2
Importing Data
15:45
3
Tidy Data
08:11
4
Reshaping Data
10:18
5
Dealing with Missing Data
04:56
6
Changing Variable Types
05:30
7
Advanced Variable Creation
19:26
8
Advanced Summarizing
10:00
9
Binding Data Frames
06:50
10
R in 3 Months Fall 2021 Week 7 Project Assignment
06:14
11
R in 3 Months Fall 2021 Week 7 Live Session
51:31
12
R in 3 Months Week 7 Office Hours
35:07
1
Data Visualization Best Practices
04:51
2
Tidy Data
04:01
3
Pipe Data Into ggplot
04:50
4
Reorder Plots to Highlight Findings
06:09
5
Line Charts
04:10
6
Use Color to Highlight Findings
08:25
7
Declutter
10:47
8
Use the scales Package for Nicely Formatted Values
03:42
9
Use Direct Labeling
11:43
10
R in 3 Months Fall 2021 Week 10 Project Assignment
04:47
11
R in 3 Months Week 10 Office Hours
52:28
12
R in 3 Months Fall 2021 Week 10 Live Session
1:13:30
1
Use Axis Text Wisely
03:15
2
Use Titles to Highlight Findings
03:33
3
Use Color in Titles to Highlight Findings
03:51
4
Use Annotations to Explain
04:52
5
Tweak Spacing
05:11
6
Customize Your Theme
02:48
7
Customize Your Fonts
08:18
8
Try New Plot Types
11:50
9
R in 3 Months Fall 2021 Week 11 Project Assignment
10
R in 3 Months Week 11 Office Hours
1:07:41
11
R in 3 Months Fall 2021 Week 11 Live Session
48:31
1
Advanced Markdown Text Formatting
10:52
2
Tables
19:33
3
Advanced YAML
11:49
4
Inline R Code
06:57
5
Making Your Reports Shine: Word Edition
06:53
6
Making Your Reports Shine: HTML Edition
06:32
7
Making Your Reports Shine: PDF Edition
08:21
8
Presentations
04:21
9
Dashboards
06:28
10
Other Formats
04:57
11
You Did It!
12
R in 3 Months Week 12 Project Assignment
08:22
13
R in 3 Months Week 12 Office Hours
54:19
14
R in 3 Months Week 12 Live Session
59:42
You need to be signed-in to comment on this post. Login.
S. Revi Sterling • March 17, 2021
> faketucky <- read.csv(data/faketucky.csv) Error in read.table(file = file, header = header, sep = sep, quote = quote, : object 'faketucky.csv' not found
Atlang Mompe • March 29, 2021
Hi David,
In your example you have double quotes around your syntax, but it wont work on my computer (using windows), unless I have single quotes, is that normal? This is the code that works for me: faketucky <-read_csv ('data/faketucky.csv')
Faythe Aiken • March 30, 2021
Hi David - I'm unable to load the read_csv function from tidyverse. When trying to install the tidyverse package, I get the following failure to download either the binary or source files. What's puzzling is I can download them directly in my browser but in R Studio. > install.packages("vctrs", type="binary") Installing package into ‘\pdcnt19/AikenF$/My Documents/R-local’ (as ‘lib’ is unspecified)
There is a binary version available (and will be installed) but the source version is later: binary source vctrs 0.3.6 0.3.7
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/vctrs_0.3.6.zip' Warning in install.packages : InternetOpenUrl failed: 'The operation timed out' Error in download.file(url, destfile, method, mode = "wb", ...) : cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/vctrs_0.3.6.zip' Warning in install.packages : download of package ‘vctrs’ failed > install.packages("vctrs", type="source") Installing package into ‘\pdcnt19/AikenF$/My Documents/R-local’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.7.tar.gz' Warning in install.packages : InternetOpenUrl failed: 'The operation timed out' Error in download.file(url, destfile, method, mode = "wb", ...) : cannot open URL 'https://cran.rstudio.com/src/contrib/vctrs_0.3.7.tar.gz' Warning in install.packages : download of package ‘vctrs’ failed
Lisa Janz • March 31, 2021
I can't figure out why, but the keep throwing the following error code: Error: object 'faketucky' not found Here is what I have done:> library(tidyverse) -- Attaching packages ---------------- tidyverse 1.3.0 -- v ggplot2 3.3.3 v purrr 0.3.4 v tibble 3.1.0 v dplyr 1.0.5 v tidyr 1.1.3 v stringr 1.4.0 v readr 1.4.0 v forcats 0.5.1 -- Conflicts ------------------- tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() > library(skimr) > faketucky->read_csv("faketucky.csv") Error: object 'faketucky' not found > setwd("C:/Users/ArcticFox/Desktop/getting-started-master/data") > faketucky->read_csv("faketucky.csv") Error: object 'faketucky' not found
Lisa Janz • March 31, 2021
And it doesn't work if I put the arrow going in the right direction either. I have used R pretty regularly and tried several things with this, but for some reason, I really can't get it to open the file.
Lisa Janz • March 31, 2021
> library(tidyverse) -- Attaching packages ---------------- tidyverse 1.3.0 -- v ggplot2 3.3.3 v purrr 0.3.4 v tibble 3.1.0 v dplyr 1.0.5 v tidyr 1.1.3 v stringr 1.4.0 v readr 1.4.0 v forcats 0.5.1 -- Conflicts ------------------- tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() > faketucky<-read_csv("faketucky.csv") Error: 'faketucky.csv' does not exist in current working directory ('C:/Users/ArcticFox/Desktop/getting-started-master').
Josh Rodriguez • May 14, 2021
Hey David, It appears I am getting the common issue noted in the comments here. That "faketucky does not exist in the current working directory." I looked at your response as a way to resolve the matter but it doesn't appear that faketucky is in my Rproj by default. This is where my R session is attempting to pull the data from by default
Scott Clark • July 18, 2021
Hi David. Tidyverse was installed and loaded. I could see and use read.csv, but not read_csv. I noticed readr wasn't listed in the packages:
> library(tidyverse) -- Attaching packages ---------------------------------------------------- tidyverse 1.3.1 -- v ggplot2 3.3.5 v dplyr 1.0.7 v tibble 3.1.2 v stringr 1.4.0 v tidyr 1.1.3 v forcats 0.5.1 v purrr 0.3.4
I was able to install and load readr separately to get around this, but is there a reason why it might not have installed with the rest of tidyverse? Could I be missing any other packages that I might need later?
Christine Mahoney • August 22, 2021
Difficult having issues. I keep receiving Error: 'faketucky.csv' does not exist in current working directory ('/Users/christinemahoney/Desktop/getting-started-master').
Prince Baawuah • October 12, 2021
I mostly work with very very large datasets. Are there any packages and/or tips on how to efficiently import and work with very very large datasets quickly(e.g. if parallel processing?) on the desktop?
Lukas Harringer • March 10, 2022
Hi, when I run the read_csv function, the data appears in my Console not in the Environment section.
Michael Steinhoff • March 17, 2022
could not find function "read_csv". Looked back at error code from loading tidyverse and have this: ** Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(j = 0.7.6 is required ** Seems like something is not up to date, but i'm not sure what
Jessica Brewer • October 5, 2022
What is meant by "the working directory"? The main folder in the Files environment?
Amy Williams • October 10, 2022
Hi, Im trying to import the data but I have a message saying the file is not in my current working directory ,library(tidyverse) > library(skimr) > #open up data file use code below > faketucky <-read_csv("data/faketucky.csv") Error: 'data/faketucky.csv' does not exist in current working directory
not sure how to change this?
Thank you
Hani Alnakhli • January 19, 2023
Hi David, I have got this text! Enter an item from the menu, or 0 to exit not pretty sure what was my mistake
Jessica Halmshaw • March 9, 2023
Hi, I'm not sure what is going wrong here, but I am getting this error message in response to my syntax - please note that I am putting a < and then a - in the syntax, but it convert this into an arrow when I type them within this question box faketucky <- read_csv(“data/faketucky.csv”) Error: unexpected input in "faketucky <- read_csv(“"
Any ideas? Thanks!
Mercy Abarike • March 26, 2023
I get this feedback anytime I try importing the faketucky data faketucky <-read_csv("data/faketucky.csv") Error: 'data/faketucky.csv' does not exist in current working directory ('C:/Users/Mrs.Mercy/OneDrive/Desktop/Nat 1').
ashwath gadapa • April 26, 2023
Hi David ,
I'm unable to load read_csv function . i have the below log for your reference
> install.packages("skimr") WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/ Installing package into ‘C:/Users/Admin/AppData/Local/R/win-library/4.3’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.3/skimr_2.1.5.zip' Content type 'application/zip' length 1236705 bytes (1.2 MB) downloaded 1.2 MB
package ‘skimr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in C:\Users\Admin\AppData\Local\Temp\Rtmpm8G3tz\downloaded_packages > library(skimr) > library(skimr) > faketucky faketucky <- read_csv("data/faektucky.csv") Error in read_csv("data/faektucky.csv") : could not find function "read_csv"
David Keyes Coach • April 30, 2023
Yes, that works on RStudio Desktop as well. Moving forward, though, I would work on installing packages yourself using
install.packages()because you won't always get this kind of help from RStudio Desktop or Posit Cloud.David Keyes Coach • July 1, 2023
Glad it worked!