Skip to content
R in 3 Months is now open for twice-annual registration. Learn more.
R for the Rest of Us Logo

This lesson is locked

Get access to all lessons in this 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.

Your Turn

  1. Create a new R script file and save it as import.R

  2. Add the line library(tidyverse) at the top of your R script file and run it to load the tidyverse package.

  3. Use the read_csv() function (not read.csv()) to import the penguins_data.csv file

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Bhumika Bhattacharya

Bhumika Bhattacharya

September 28, 2023

I copied the penguins data into my directory and it is also showing up in the 'files' section in the project but when I am running the code - read_csv("penguins_data.csv"), I am getting this output in the console :(

read_csv("penguins_data.csv") Error: 'penguins_data.csv' does not exist in current working directory ('C:/Users/rajab/OneDrive/Desktop/New project week 2').

Bhumika Bhattacharya

Bhumika Bhattacharya

September 28, 2023

This comment was supposed to go under "start a new project" my bad

Gracielle Higino

Gracielle Higino

September 28, 2023

Hi Bhumika! It might be that you are not working on the same directory. Can you share on Discord a screenshot of your session? When this happens to me, I usually start running these codes on the terminal, just to quickly check if I'm working in the right place.

get_wd() # to get the exact directory I'm working on
dir() # to check the files on my current directory

You can inspect that using the posit interface too! For example, your working directory will be displayed on your console panel along with your R version.

Let me know if this helps and ping me on Discord to let me know how it went! =D

I think we got it worked out in office hours! Just needed to have the project open in order for the code to run.

Samreen Chhabra

Samreen Chhabra

October 11, 2023

Hi! I'm getting this response for the library(tidyverse) code: Error: package or namespace load failed for ‘tidyverse’: .onAttach failed in attachNamespace() for 'tidyverse', details: call: NULL error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘utf8’

David Keyes

David Keyes

October 12, 2023

For some reason, the tidyverse package didn't install correctly. It looks like this is because one package as part of the tidyverse didn't successfully install. Please run this in the console and then try again:

install.packages("utf8")

Let me know if that helps! Your other question should also be solved by this.

Samreen Chhabra

Samreen Chhabra

October 13, 2023

Hi, it worked! Thank you so much!

Sindhu Palle

Sindhu Palle

December 23, 2023

Hello, I got the same error and when I tried installing the package, it tells me package 'uft8' is not available for this version of R

What version of R are you using? If it's older, you may need to update it before installing the package.

Sindhu Palle

Sindhu Palle

December 27, 2023

I am using Version 2023.12.0+369 (2023.12.0+369) on my MacOS Catalina 10.15.7

Samreen Chhabra

Samreen Chhabra

October 11, 2023

Also, for the read_csv("penguins_data.csv") code, this is what I get, despite working in getting-started-main. Any help would be appreciated, thank you!- read_csv("penguins_data.csv") Error in read_csv("penguins_data.csv") : could not find function "read_csv"

Charles Obiorah

Charles Obiorah

February 27, 2024

I'm excited I seem to getting along, though I have to do playback, and rewind many times. Furthermore I was going to wonder, if the sex and species variables are the same character, and age and weight are the same numericals (dbl), why did it limit those ones that were not shown

I'm not quite sure I understand your question. Can you elaborate please?