r-box / boxr Goto Github PK
View Code? Open in Web Editor NEW:package: A high-level R interface for the box.com API
Home Page: https://r-box.github.io/boxr
License: Other
:package: A high-level R interface for the box.com API
Home Page: https://r-box.github.io/boxr
License: Other
Add a function to perform a 'fresh' auth, for users having authentication problems.
I get the following error after I run the follwing two lines of code (this package worked fine last week?)
require(boxr)
box_auth()
Reading client id from .Renviron
Reading client secret from .Renviron
Auto-refreshing stale OAuth token.
Error in refresh_oauth2.0(self$endpoint, self$app, self$credentials) :
client error: (400) Bad Request
Probably a good idea once you have search done. Something like (psuedo code):
box_search("raw_data.csv") %>%
box_read() %>%
group_by(blah, blah) %>%
summarise(average = mean(var)) %>%
box_write_csv("aggregated_data.csv") %>%
box_comment("Aggregated version of 'raw_data'")
Otherwise behaviour (though 'correct') appears buggy to new users
Trying to use this function from command line but got this Error: oauth_listener() needs an interactive environment
. It happens also when interactive = FALSE
.
boxr::box_auth(
client_id = client_id,
client_secret = client_secret,
interactive = TRUE,
write.Renv = FALSE
)
https://github.com/jimhester/covr
E.g. karthik's rDrop2: https://github.com/karthik/rdrop2/blob/master/.travis.yml
After updating to R version 3.3.2, I get the following error message, when trying to authenticate:
box_auth()
Reading client id from .Renviron
Reading client secret from .Renviron
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in curl::curl_fetch_memory(url, handle = handle) :
Failure when receiving data from the peer
Important for new users. Link to the auth page, and explain the general process.
Including paths.
There's been quite a few changes; you need to RTFM with a red pen.
Boring to write, very useful for people trying to figure out what to do.
As returned by box_dir_create
.
Make sure that any functions which take a box folder id, can also accept the new object.
It might be a useful function for users
Could modify box_ul / box_dl, or add something else
Currently relies on a combination of the sha-1 hash, and timezone corrected timestamps. You need to make this very explicit for users in the documentation. The code that handles this process is the box_dir_diff function.
Not essential, but might be useful to some.
See: https://developers.box.com/docs/#comments-comment-object
Great package! I noticed that you provide functions to read different files directly, e.g. csv or excel files. Would it be useful to include a generic function that allows the user to specify which R function to parse the file with?
For example, Mike Love's excellent tximport function / package includes the parser function, e.g. read.csv
or readr::read_delim
, as an argument. That way, the function is useful in many different contexts. At the same time, Mike didn't have to write multiple different functions for the various file formats.
Food for thought?
Best,
Thomas
Add examples to the Rd/Roxygen. 'Not run', of course!
Sorry I tried doing a pull request but it wasn't working.
In the roxygen comment for box_auth pakcage should be package.
I am running the following code from command line (works fine in interactive session),
require(boxr)
box_auth()
box_setwd("3862567703")
NULL
[1] "0"
Error in cont$type : $ operator is invalid for atomic vectors
Calls: box_setwd
Execution halted
here is my session info
sessionInfo(package=NULL)
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] sqldf_0.4-10 gsubfn_0.6-6 proto_0.3-10 RSQLite_1.0.0
[5] DBI_0.3.1 RODBC_1.3-12 boxr_0.3.1 RCurl_1.95-4.7
[9] bitops_1.0-6 XLConnect_0.2-11 XLConnectJars_0.2-9
loaded via a namespace (and not attached):
[1] assertthat_0.1 bit_1.1-12 bit64_0.9-5 chron_2.3-47
[5] curl_0.9.3 digest_0.6.8 grid_3.1.3 httr_1.0.0
[9] jsonlite_0.9.17 lattice_0.20-33 lubridate_1.3.3 magrittr_1.5
[13] memoise_0.2.1 plyr_1.8.3 R6_2.1.1 rCharts_0.4.5
[17] Rcpp_0.12.0 RGoogleAnalytics_0.1.1 rJava_0.9-7 RJSONIO_1.3-0
[21] rstudioapi_0.3.1 stringi_0.5-5 stringr_1.0.0 tcltk_3.1.3
[25] tools_3.1.3 whisker_0.3-2 yaml_2.1.13
At the moment it excludes files (e.g. .gitignore
) but it doesn't exclude dirs (e.g. .git
).
Change this behaviour!
first off, awesome package!
It is working well on two of my machines, but fails authentication on our HPCC server. I am trying to investigate the issue, but the error message seems generic.
Specially I see:
box_auth(interactive = TRUE)
Reading client id from .Renviron
Reading client secret from .Renviron
Auto-refreshing stale OAuth token.
Error in box_auth(interactive = TRUE) :
Login at box.com failed; unable to connect to API.
further looking at the step at which it fails I see:
Browse[2]> test_req
Response [https://api.box.com/2.0/folders/0]
Date: 2016-01-29 19:41
Status: 200
Content-Type: application/json
Size: 2.27 kB
No encoding supplied: defaulting to UTF-8.
note
Since a browser is not accessible, I have copied the .boxr-oauth from my personal machine to the HPCC.
Hi I am receiving this error while fetching files
Error in class(out) <- "boxr_object_list" :
attempt to set an attribute on NULL
Any idea on what went wrong?
At the moment, the auth process gets as far as launching a new browser window and the 'grant access' button. However, R can't read the results.
The tab stayed open with a URL like this: http://localhost:1410/?state=2WnJOcTuKG&code=cYWy4jBcMc0cHDkw3DjJcEuUVh1MiX1w
It may well be that this contains enough information for a user to copy and paste it back in to the console, and for a httr
token object to be constructed.
You'd need to write a little function, and apply it to msg_list in returnDwOp
It might be possible to use the box file picker, and httpuv.
Here's the httr code you might want to ape, to launch a browser and listen for events: https://github.com/hadley/httr/blob/e746e973e18504996f3d4916c9f2bba334a85ac8/R/oauth-listener.r .
Annoyingly, it looks like the box js is set up in a way which would mean that you'd have to launch one window, so the file picker would launch in another, but you might be able to do the first window silently.
At the moment, the behavior is probably going to be pretty unclear to people.
I'm trying to use box_read_excel()
to load in a fairly small .xls file hosted on box. I don't get any errors but prints some output along the lines of:
DEFINEDNAME: 07 b9 2b 08 7c 33 b2 83 88 f7 78 24 1c b5 f7 22 36 7e 10 43 a6 3b ff 5c 31 6b b4 a8 f2 0c
and then R subsequently crashes (I assume that it is running out of memory, but the file itself is pretty small, say only 200 rows and 20 columns).
Do you have any idea about what is going wrong here? Sorry if this is a completely silly question!
In other words, wrapping local write functions (writing to tempfiles), and immediately uploading, returning a file reference.
Hi,
First to say that this is a lifesaver of a package, thanks!
I am finding a weird and difficult to reproduce error (due to all the side effects), but the upshot is this, if I have a box.com directory with more than 100 files, some of the files are ignored in a box_fetch()
operation. The updater will show 1/100, ..., 100/100.
Have you come across this behavior?
Also, I realize there may be a box.com setting that I am not aware of, so I'll try to look around for such a thing.
Thanks for any light you can cast on the situation!
Thanks,
Ian
To summarize what's just happened. Currently ends on the last statement printed via catif().
It's suggested for httr, but needed to do the OAuth2.0 dance for boxr
Make readxl
an 'optional dependency', and use it to read excel files if detected with box_read
, or explicitly with box_read_excel
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.