Palmerpenguin dataset not loading correctly with skim_without_charts() function.

Hello, please, I am newbie on Rstudio, and I encountered the following difficulties below: Kindly assist me and advise on further steps to take in order to overcome my challenge in this instance. Thanks you.

1. Steps taken to install, load and use the 'Palmer penguins' dataset.

install.packages("palmerpenguins")
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/diuto/AppData/Local/R/win-library/4.2’
(as β€˜lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/palmerpenguins_0.1.1.zip'
Content type 'application/zip' length 3004890 bytes (2.9 MB)
downloaded 2.9 MB

package β€˜palmerpenguins’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\AppData\Local\Temp\Rtmp0mi4sj\downloaded_packages

library(palmerpenguins)

skim_without_charts("palmerpenguins")
── Data Summary ────────────────────────
Values
Name "palmerpenguins"
Number of rows 1
Number of columns 1


Column type frequency:
character 1


Group variables None

── Variable type: character ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
skim_variable n_missing complete_rate min max empty n_unique whitespace
1 data 0 1 14 14 0 1 0

data(palmerpenguins)
Warning message:
In data(palmerpenguins) : data set β€˜palmerpenguins’ not found
head(palmerpenguins)
Error in head(palmerpenguins) : object 'palmerpenguins' not found
head("palmerpenguins")
[1] "palmerpenguins"
View(palmerpenguins)
Error in View : object 'palmerpenguins' not found
library("palmerpenguins")
skim_without_charts("palmerpenguins")
── Data Summary ────────────────────────
Values
Name "palmerpenguins"
Number of rows 1
Number of columns 1


Column type frequency:
character 1


Group variables None

── Variable type: character ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
skim_variable n_missing complete_rate min max empty n_unique whitespace
1 data 0 1 14 14 0 1 0

2. I decided to check for the dataset further using the installed. packages () function
installed.packages() gave the information below:

palmerpenguins NA NA NA "no" "4.2.1"
[ reached getOption("max.print") -- omitted 76 rows ]

Hi @Yvy !

When you install the palmerpenguins package, it downloads two csv files to the package directory.

Before you do anything to the data, you'll need to pull in the csv files to R.

First get the filepath to the first csv by running this line:

palmerpenguins::path_to_file(path = "penguins.csv")

Then once you have the filepath (note: should looks something like this: "/Library/Frameworks/R.framework/Versions/3.6/Resources/library/palmerpenguins/extdata/penguins.csv"

Paste that into the read.csv() function that is defining a dataframe:
penguins <- read.csv("the-copied-filepath-from-previous-step/penguins.csv")

In this case, I named the dataframe penguins, so I can now check out the data with something like head(penguins) or View(penguins) to make sure that it got pulled in properly.

To get the second csv file, called penguins_raw.csv all you need to do is create another variable, say penguins_raw to make it simple, and pass the read.csv() function the same filepath, but change the last bit to penguins_raw.csv instead of just penguins.csv.

Then you'll have all the penguin data! If you run into other similar issues, the help pane in RStudio is very helpful. Clicking on the packages tab in RStudio will take you to the list of packages you have installed. Search for palmerpenguins in there and click on it. It will have relevant information on how to use the package and other functions included in it.

Hope that helps!

3 Likes

Thank you so much, Jonesey441,
Your response was both timely and helpful!

Blessings...
Yvy

In my experience, once the {palmerpenguins} package is loaded the penguins data frame should be available without any further steps.

skim_without_charts(palmerpenguins) did not work because that function is for a data frame, not a package. skim_without_charts(penguins) and skim_without_charts(penguins_raw) should both work.

For the reprex below I used the summary() function instead because the {skimr} package is not installed on this computer.

library(palmerpenguins)
summary(penguins)
#>       species          island    bill_length_mm  bill_depth_mm  
#>  Adelie   :152   Biscoe   :168   Min.   :32.10   Min.   :13.10  
#>  Chinstrap: 68   Dream    :124   1st Qu.:39.23   1st Qu.:15.60  
#>  Gentoo   :124   Torgersen: 52   Median :44.45   Median :17.30  
#>                                  Mean   :43.92   Mean   :17.15  
#>                                  3rd Qu.:48.50   3rd Qu.:18.70  
#>                                  Max.   :59.60   Max.   :21.50  
#>                                  NA's   :2       NA's   :2      
#>  flipper_length_mm  body_mass_g       sex           year     
#>  Min.   :172.0     Min.   :2700   female:165   Min.   :2007  
#>  1st Qu.:190.0     1st Qu.:3550   male  :168   1st Qu.:2007  
#>  Median :197.0     Median :4050   NA's  : 11   Median :2008  
#>  Mean   :200.9     Mean   :4202                Mean   :2008  
#>  3rd Qu.:213.0     3rd Qu.:4750                3rd Qu.:2009  
#>  Max.   :231.0     Max.   :6300                Max.   :2009  
#>  NA's   :2         NA's   :2

Created on 2022-09-22 with reprex v2.0.2

2 Likes

Thank you so much, I was stuck the whole day because of this. Thanks again, this was helpful.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.