-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drive_read()? #81
Comments
Not yet but it could happen. Question is: what sort of object do you read it into? Sheets are one thing and will be handled by googlesheets. But what else might you want to read straight into an R object? 🤔 Curious to hear the use you have in mind. |
While I do use Google Drive to create and edit spreadsheets, I also use it as cloud-based data storage for file formats that aren't editable through the Drive interface. These file formats include So I guess I'd like a function that could serve a wrapper around the Something like: ## this code is for illustration purpose - not a functional reprex
# Upload file to Drive
write.csv(chickwts, "chickwts.csv")
drive_chickwts <- drive_upload("chickwts.csv")
# Read that file back into R
drive_read(obj = drive_chickwts , fun = read_csv, fun_args = list()) # fun_args would be passed to the read function's params |
It's been a while but if you still care about this @tiernanmartin, I'd love to hear if it meets your needs. See #363. There are tons of examples, which I may have to move to an article, because they involve packages that googledrive has no formal relationship with. |
Nice! This looks great. I am not sure whether it will meet my particular needs. I work with a lot of geopackage (.gpkg) files that I store on google drive, and my naïve attempt to access one of those with this new function returned an error. Here's a reprex: library(tidyverse)
library(sf)
library(googledrive)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
st_write(nc, "nc.gpkg")
nc_in_drive <- drive_upload("nc.gpkg")
drive_read(nc_in_drive) %>%
st_read()
## Error in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, :
## Expecting a single value: [extent=167936].
## In addition: Warning message:
## In if (nchar(dsn) < 1) { :
## the condition has length > 1 and only the first element will be used |
I'm looking at the docs for https://r-spatial.github.io/sf/reference/st_read.html The first argument
It does not surprise me that piping the result of For this to "just work", you need to see that the primary input can be a raw vector, which is presumably what you're getting from It is possible that by explicitly requesting
|
A great example of the type of function that
|
Note that |
Thanks for these suggestions, Jenny. I played around with a couple combinations of file types but I didn't come across any that worked. I am ok with that. Your documentation is very clear about what types of files are supported, so I was not really expecting it to "just work" with something exotic like a geopackage. I appreciate you taking the time to brainstorm some possible approaches--and who knows maybe someone else will chime in with a solution at some point. Thanks for bringing Issue closed! +1 |
I’m going to reopen and let the PR merge close this. We might use this issue as a demo re: PR review in an upcoming group meeting. |
Is there a way to read a data object out of a
dribble
(similar toreadr::read()
orgooglesheets::gs_read()
)?The text was updated successfully, but these errors were encountered: