Code Monkey home page Code Monkey logo

boxr's Introduction

boxr

cran version R-CMD-check codecov monthly_downloads

A lightweight, opinionated, high-level R interface to the box.com API, standing on the shoulders of httr.

Box is a cloud content-management and file-sharing service. The goal of the boxr package is to make it easier for you to integrate your Box account into your R workflow.

New in boxr 0.3.6 (development)

Bug fixes

  • Harmonizes the default location for tokens; ~ resolves to the home directory for all platforms. A patch is applied offering to move tokens from “old” locations. This bug appeared on Windows only.

All changes are detailed in the NEWS.

Installation

You can install boxr from CRAN, with:

install.packages("boxr")

If you’d like to install the development version from GitHub, use:

# install.packages("devtools")
devtools::install_github("r-box/boxr")

Documentation

The package-documentation website is created and maintained using pkgdown. The documentation website consists of:

Usage

We have a Get-started article that goes into more detail on interacting with your Box account using R.

Authentication

If you have access to client_id and client_secret for a Box-app, you can use box_auth() to authenticate:

box_auth(client_id = "your_client_id", client_secret = "your_client_secret")

This will kick off a process that, all being well, will keep you authenticated for the rest of the R session. By saving this information to your .Renviron file, at your next R session you can use, without arguments:

box_auth()

If you don’t have access to client_id and client_secret, you should read the authentication article to determine your next steps. In most cases, this next step will be to create an interactive Box-app

Basic operations

Advanced operations

Alternatives

Other ways to interact with a Box account include:

Contributing

Always very welcome! If you’d like to submit a pull request for a new feature, ideally it would be documented, come with an addition to NEWS.md, and have a test or two. This project has a standard Code of Conduct.

License

The MIT License (MIT)

Copyright (c) 2015-2022 boxr contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

boxr's People

Contributors

alexbrodersen avatar awong234 avatar botan avatar brendan-r avatar chainsawriot avatar ijlyttle avatar j450h1 avatar malcolmbarrett avatar nathancday avatar romainfrancois avatar vfulco avatar zedseayou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

boxr's Issues

Add S3 class for box folders

As returned by box_dir_create.

Make sure that any functions which take a box folder id, can also accept the new object.

Add box_write functions

In other words, wrapping local write functions (writing to tempfiles), and immediately uploading, returning a file reference.

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

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

running BoxR from command line - Error in cont$type : $ operator is invalid for atomic vectors

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

Error while fetching

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?

Add `box_read_excel`

Make readxl an 'optional dependency', and use it to read excel files if detected with box_read, or explicitly with box_read_excel.

Interactive environment needed

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
  )

typo in box_auth

Sorry I tried doing a pull request but it wasn't working.

In the roxygen comment for box_auth pakcage should be package.

Error after updating to R version 3.3.2

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

Feature suggestion: pass parser function as an argument to box_read_*

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

box_fetch() seems to be limited maximum 100 files per directory

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

Issues in authenticating on a specific server.

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.

R crashes when using box_read_excel()

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!

Add piping example

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'")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.