I am continuing to have problems downloading data as prescribed in books about R such as ?Analyzing Baseball Data with R?. In chapter 3 (page 67) the instructions to download baseball Hall of Fame data from the package tidyverse are: library(tidyverse) -- Attaching packages --------------------------------------- tidyverse 1.3.0 -- v ggplot2 3.2.1 v purrr 0.3.3 v tibble 2.1.3 v dplyr 0.8.3 v tidyr 1.0.0 v stringr 1.4.0 v readr 1.3.1 v forcats 0.4.0 -- Conflicts ------------------------------------------ tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() x dplyr::lag() masks stats::lag() Warning messages: 1: package ?tidyverse? was built under R version 3.6.2 2: package ?purrr? was built under R version 3.6.2 The package seems to load correctly but when I try to call up the data I get an error message. ***********************************************************************************************> hof <- read_csv("data/hofbatting.csv")Error: 'data/hofbatting.csv' does not exist in current working directory ('C:/Users/Owner/Documents'). *********************************************************************************************** I have no idea where the data is hiding. Can someone give me some directions.
On 27/02/2020 10:05 a.m., Phillip Heinrich wrote:> I am continuing to have problems downloading data as prescribed in books > about R such as ?Analyzing Baseball Data with R?. > > In chapter 3 (page 67) the instructions to download baseball Hall of Fame > data from the package tidyverse are: > > library(tidyverse) > -- Attaching packages --------------------------------------- tidyverse > 1.3.0 -- v ggplot2 3.2.1 > v purrr 0.3.3 v tibble 2.1.3 > v dplyr 0.8.3 v tidyr 1.0.0 v stringr 1.4.0 > v readr 1.3.1 v forcats 0.4.0 > > -- Conflicts ------------------------------------------ > tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() > x dplyr::lag() masks stats::lag() > Warning messages: 1: package ?tidyverse? was built under R version 3.6.2 2: > package ?purrr? was built under R version 3.6.2 > > The package seems to load correctly but when I try to call up the data I get > an error message. > *********************************************************************************************** > >> hof <- read_csv("data/hofbatting.csv") > > Error: 'data/hofbatting.csv' does not exist in current working directory > ('C:/Users/Owner/Documents'). > > *********************************************************************************************** > I have no idea where the data is hiding. Can someone give me some > directions.It's not clear from your message whether you have the file on your disk or not. If you do, then instead of giving the name, try using the file.choose() function, e.g. filename <- file.choose() hof <- read_csv(filename) That will open a standard dialog to allow you to specify the filename correctly. If you don't know where to look for it, I can't help: presumably instructions are given in the book, but I don't have a copy. You'll just have to read more of it. Duncan Murdoch
>From the "Companion to Analyzing Baseball Data with R" on GitHub(https://github.com/maxtoki/baseball_R) it says: "In order to have a working copy of the code in the book, download the zip file of this repository and extract the content of the zip file in a folder of your convenience. The data folder contains datasets used in the book, except those downloadable from websites. In order to get the missing datasets, read the readme.txt files stored inside the lahman, sqldumps and wizardry subfolders of the data folder. The script folder contains one script named _setWorkingDir.R. Before running any code, open that file, change the path to reflect the folder of your installed files and run it." So it seems like you downloaded the zip file but still have to make sure that the working directory is set correctly (see third paragraph in the instructions above). Hope that helps! Stefan On Thu, 27 Feb 2020 at 08:05, Phillip Heinrich <herd_dog at cox.net> wrote:> > I am continuing to have problems downloading data as prescribed in books > about R such as ?Analyzing Baseball Data with R?. > > In chapter 3 (page 67) the instructions to download baseball Hall of Fame > data from the package tidyverse are: > > library(tidyverse) > -- Attaching packages --------------------------------------- tidyverse > 1.3.0 -- v ggplot2 3.2.1 > v purrr 0.3.3 v tibble 2.1.3 > v dplyr 0.8.3 v tidyr 1.0.0 v stringr 1.4.0 > v readr 1.3.1 v forcats 0.4.0 > > -- Conflicts ------------------------------------------ > tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() > x dplyr::lag() masks stats::lag() > Warning messages: 1: package ?tidyverse? was built under R version 3.6.2 2: > package ?purrr? was built under R version 3.6.2 > > The package seems to load correctly but when I try to call up the data I get > an error message. > *********************************************************************************************** > > > hof <- read_csv("data/hofbatting.csv") > > Error: 'data/hofbatting.csv' does not exist in current working directory > ('C:/Users/Owner/Documents'). > > *********************************************************************************************** > I have no idea where the data is hiding. Can someone give me some > directions. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.