palmerpenguins comes bundled with two csv files in its inst/extdata directory. This function make them easy to access.

path_to_file(path = NULL)

Arguments

path

Name of file in quotes with extension; "penguins.csv" and "penguins_raw.csv" will work. If NULL, the example files will be listed.

Source

This function is adapted from readxl::readxl_example().

Details

The data in each file is the same as penguins and penguins_raw, but without the variable types.

Examples

path_to_file()
#> [1] "penguins_raw.csv" "penguins.csv"
path_to_file("penguins_raw.csv")
#> [1] "/Users/runner/work/_temp/Library/palmerpenguins/extdata/penguins_raw.csv"
head(read.csv(path_to_file("penguins.csv")))
#> species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g #> 1 Adelie Torgersen 39.1 18.7 181 3750 #> 2 Adelie Torgersen 39.5 17.4 186 3800 #> 3 Adelie Torgersen 40.3 18.0 195 3250 #> 4 Adelie Torgersen NA NA NA NA #> 5 Adelie Torgersen 36.7 19.3 193 3450 #> 6 Adelie Torgersen 39.3 20.6 190 3650 #> sex year #> 1 male 2007 #> 2 female 2007 #> 3 female 2007 #> 4 <NA> 2007 #> 5 female 2007 #> 6 male 2007