[R] Analyzing Baseball Data With R

William Michels wjm1 @end|ng |rom c@@@co|umb|@@edu
Tue Mar 17 07:33:11 CET 2020

Hi Phillip,

Generally these problems come down to knowing/setting your working
directory. The first question is whether you have a directory named
"data" inside your "C:/Users/Owner/Documents" directory? You may need
to create this directory first, outside of R and/or RStudio (using
your Windows OS).

Below is some example code (on a Mac). You might want to try 1)
creating the "data" directory in Windows as mentioned earlier, 2)
setting your working directory to "C:/Users/Owner/Documents/data",
then 3) re-running your src_sqlite() command giving "pitchrx.sqlite”
as the database file name.

> getwd()
[1] "/Users/homedir/R_Dir"
> setwd("/Users/homedir/R_Dir/data")
Error in setwd("/Users/homedir/R_Dir/data") :
  cannot change working directory

HTH, Bill.

W. Michels, Ph.D.

On Mon, Mar 16, 2020 at 3:35 PM Phillip Heinrich <herd_dog using cox.net> wrote:
> Can’t get past first step of Chapter 7 page 164.
> Opened a new RStudio window.  Loaded tidyverse and keyed in library(tidyverse) which of course includes dplyr.  The working directory is: C:/Users/Owner/Documents.
> Then keyed in: db <- src_sqlite(“data/pitchrx.sqlite”,create=TRUE)
> And got the following error: Error: Could not connect to database:
>                                             unable to open database file
> Googled everything I could think of to find the sqlite function and the pitchrx.sqlite empty data base.  Can someone give me some direction?
> I wondering if I have configured RStudio incorrectly.  Why doesn’t my by RStudio point to the correct data file?
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help using 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.

More information about the R-help mailing list