[R] Read fst files
Jeff Reichman
re|chm@nj @end|ng |rom @bcg|ob@|@net
Wed Jun 9 15:12:37 CEST 2021
Duncan
Yea that will work. It appears to be related to setting my working dir, for what ever reason neither seem to work
(1) knitr::opts_knit$set(root.dir ="~/My_Reference_Library/Regression") # from R Notebook or
(2) setwd("C:/Users/reichmaj/Documents/My_Reference_Library/Regression") # from R chunk
So it appears I can either (as you suggested) use two steps or combine but I need to enter the full path. Why other file types don't seem to need the full path ....?????
myObject <- read_fst(unz("C:/Users/reichmaj/Documents/My_Reference_Library/Regression/Datasest.zip", filename = "myFile.fst"))
Thank you. I guess just one of those R things
Jeff
-----Original Message-----
From: Duncan Murdoch <murdoch.duncan using gmail.com>
Sent: Wednesday, June 9, 2021 7:27 AM
To: reichmanj using sbcglobal.net; 'Eric Berger' <ericjberger using gmail.com>
Cc: 'R mailing list' <r-help using r-project.org>
Subject: Re: [R] Read fst files
It looks as though read_fst wants a filename, not a connection.
You should do it in two steps:
unzip("Dataset.zip", files = "myFile.fst")
myObject <- read_fst("myFile.fst")
This is obviously untested; you didn't even say what package read_fst() comes from.
Duncan Murdoch
On 09/06/2021 8:18 a.m., Jeff Reichman wrote:
> Eric
>
>
>
> Typo on my point.
>
>
>
> setwd("C:/Users/reichmaj/Documents/My_Reference_Library /Regression")
>
> myObject <- read_fst(unz("Dataset.zip", filename = "myFile.fst")) #
> read fst file
>
>
>
> Error in path.expand(path) : invalid 'path' argument
>
>
>
> So then I tried
>
>
>
> myObject <-
> read_fst(unz("C:/Users/reichmaj/Documents/My_Reference_Library
> /Regression /Dataset.zip", filename = "myFile.fst"))
>
>
>
> Error in path.expand(path) : invalid 'path' argument
>
>
>
> Error in the path??
>
>
>
> Because this works just fine
>
>
>
> myObject <-
> read.csv(unz("C:/Users/reichmaj/Documents/My_Reference_Library
> /Regression /Dataset.zip", filename = "myFile.csv"))
>
>
>
> My only though is I can’t use the two function s together when dealing with fst files ??
>
>
>
> From: Eric Berger <ericjberger using gmail.com>
> Sent: Wednesday, June 9, 2021 3:50 AM
> To: reichmanj using sbcglobal.net
> Cc: R mailing list <r-help using r-project.org>
> Subject: Re: [R] Read fst files
>
>
>
> You are missing the second closing parenthesis. This is what the error message is telling you.
>
>
>
>
>
> On Wed, Jun 9, 2021 at 2:44 AM Jeff Reichman <reichmanj using sbcglobal.net <mailto:reichmanj using sbcglobal.net> > wrote:
>
> R-Help Forum
>
>
>
> Anyone know why the following line of code would error out: myObject
> <- read_fst(unz("Dataset.zip", filename = "filename.fst"))
>
>
>
> Error: Incomplete expression: filename <- read_fst(unz("Dataset.zip",
> filename = "filename.fst")
>
>
>
> I often use similar code with *.csv files in a zipped folder. For example:
> myObject <- read.csv(unz("Dataset.zip", filename = "filename.csv")),
> which works just fine.
>
>
>
> Jeff Reichman
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org <mailto: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.
>
>
> [[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