How can I get this code correct?
library("data.world")
file_df <- download_file_as_data_frame(
"jonloyens/an-intro-to-dataworld-dataset",
"fatal-police-shootings-data.csv")
Error in auth_token() : API authentication must be configured before any functions can be invoked. To configure, use dwapi::configure().
So to illustrate why I wrote that comment:
packageDescription('data.world')
Package: data.world
Title: Functions and Add-Ins for Working with 'data.world' Data Sets and Projects
Version: 1.2.2
Authors#R: c( person("Rafael", "Pereira", email = "rafael.pereira#data.world", role =
c("aut", "cre")), person("Triet", "Le", email = "triet.le#data.world", role =
c("aut")), person("Bryon", "Jacob", email = "bryon.jacob#data.world", role =
c("aut")), person("Scott", "Came", email = "scott#cascadia-analytics.com",
role = c("aut")))
Description: High-level tools for working with 'data.world' data sets. 'data.world' is
a platform where you can find interesting data, store and showcase your own
data and data projects, and find and collaborate with other members. In
addition to exploring, querying and charting data on the data.world site, you
can access data via 'API' endpoints and integrations. Use this package to
access, query and explore data sets, and to publish your insights. Visit
<https://data.world>, for additional information.
Depends: R (>= 3.3.0), dwapi (>= 0.1.3)
Imports: httr, ini, miniUI, shiny, stringi
Suggests: covr, knitr, lintr, readr, rmarkdown, testthat (>= 2.0.0)
License: Apache License 2.0
Encoding: UTF-8
LazyData: true
URL: https://github.com/datadotworld/data.world-r
BugReports: https://github.com/datadotworld/data.world-r/issues
RoxygenNote: 6.0.1
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2018-04-04 20:36:39 UTC; root
Author: Rafael Pereira [aut, cre], Triet Le [aut], Bryon Jacob [aut], Scott Came [aut]
Maintainer: Rafael Pereira <rafael.pereira#data.world>
Repository: CRAN
Date/Publication: 2018-04-04 22:29:14 UTC
Built: R 3.6.1; ; 2019-09-16 05:09:34 UTC; unix
Every package accepted by CRAN needs a DESCRIPTION file and that shows how you can access from your console. It's a text file with specific requirements. One of the functions is to point you to other packages that are needed for successful functioning as well as external sources of code or in this case data. You should, therefore, go to the value for the "URL:" line, ie. https://github.com/datadotworld/data.world-r and educate yourself. Other times you may need to install System packages, although this particular package does not list any.
Documentation for dwapi::configure() can be found in the Configuration section of that README on Github.
In short, requests to the data.world API require a user token (even a free user token), and the error indicates that a token is not being sent properly.
Related
I can not find how to replicate the internal CRAN test for the URLs healthy.
It is important that this test is run only on the Debian winbuilder (yes, debian under winbuilder). As this test is not run on the Windows machine so we could NOT use the https://win-builder.r-project.org/upload.aspx website service to replicate it.
The example error message from the CRAN server, as the website was moved.
Such message is producing the NOTE so the package is not automatically processed.
Found the following (possibly) invalid URLs:
URL: http://blog.obeautifulcode.com/R/How-R-Searches-And-Finds-Stuff/
From: inst/doc/tinyverse.html
Status: Error
Message: Could not resolve host: blog.obeautifulcode.com
Edit:
There is a useful source with CRAN policy in this area https://cran.r-project.org/web/packages/URL_checks.html
(Promoting comment to answer as suggested...)
The test code has been pulled out of R itself and made into a package you can install. Other than that it is of course part of any (recent enough) R or R-devel build.
FWIW I also wrapped this into a convenience script I call all the time on my systems.
I'm trying to use git from within RStudio to send my project to github. I'm using HTTPS authentication and with this, I can create repository(locally and remotely) and commit changes. However, when i check my github, only repository is created but my R files not found.
This is what i tried
library(usethis)
edit_r_environ()
GITHUB_PAT = 'xxxx...X' #restart R session
use_github(protocol = 'https', auth_token = Sys.getenv("GITHUB_PAT")) #created a protocol with Access
token generated from PAT
#Are title and description ok?
1: No way
2: Definitely
3: Absolutely not
#i typed 2 and entered
After the above code, repository was created on github but my R codes are missing. I wanted to use push in git connection but the push/pull was greyed out.
Am aware of other approaches but help using the usethis package in R would be apreciated
Working on first R package ever.
A data package for medical datasets for teaching.
Using the usethis workflow as described by Emil Hvitfelt
on Macbook Air with MacOS 10.15.3 Cataline
Project seems ok.
R> proj_sitrep()
working_directory: '/Users/peterhiggins/Documents/Rcode/medicaldata'
active_usethis_proj: '/Users/peterhiggins/Documents/Rcode/medicaldata'
active_rstudio_proj: '/Users/peterhiggins/Documents/Rcode/medicaldata'
I appear to be stuck on the GitHub connection
I have an account with repos, I have a PAT.
but
R> git_sitrep()
Git user
Name: 'Peter Higgins'
Email: 'higgi13425#yahoo.com'
Vaccinated: TRUE
usethis + git2r
Default usethis protocol: 'https'
git2r supports SSH: FALSE
Credentials: ''
GitHub
Personal access token: ''
User: 'higgi13425'
Name: 'Peter Higgins'
Repo
Path: '/Users/peterhiggins/Documents/Rcode/.git'
Local branch -> remote tracking branch: '' -> ''
GitHub pull request readiness
:information_source: This repo has neither 'origin' nor 'upstream' remote on GitHub.com.
and
R> use_github()
:heavy_check_mark: Checking that current branch is 'master'
Error: Detached head; can't continue
Not sure how to get past this problem.
Ideas welcome.
and any explanation of how I borked this also welcome.
thanks!
I'm trying to upload a Shiny App to shinyapps.io in Showcase mode. According to those directions, one includes a text file named DESCRIPTION (no extension) with the following fields (this is from the example linked above:
Title: Hello Shiny!
Author: RStudio, Inc.
AuthorUrl: http://www.rstudio.com/
License: GPL-3
DisplayMode: Showcase
Tags: getting-started
Type: Shiny
This answer describes the same process - but, it seems like it doesn't work any longer.
When I try to publish a Shiny App with a DESCRIPTION file like the one int he example, the following error is returned:
Preparing to deploy application...DONE
Uploading bundle for application: 88219...Error in readDcf(file.path(project, "DESCRIPTION"))[, "Package"] :
subscript out of bounds
Calls: <Anonymous> ... suppressMessages -> withCallingHandlers -> <Anonymous> -> unname
Execution halted
For what it's worth, I tried excluding different fields from the DESCRIPTION file, even trying one with only DisplayMode: Showcase included. I also tried saving the file in different editors.
This Google Groups thread seems to suggest this is a bug, but since there doesn't seem to be a question posted about it other than when this worked, I hoped to see if anyone had found or could suggest a fix.
EDIT: I posted an Issue on the Shiny Apps GitHub page.
Installing the latest version of packrat from GitHub (i.e., devtools::install_github("rstudio/packrat") did the trick, thanks to this GitHub Issue suggestion. Installing the latest CRAN version (install.packages("packrat")) did not work.
I open my shinyapp on the shiny server in Showcase mode using DESCRIPTION file with additional fields that were not described in documentation and it works.
Package: MyShinyApp
Version: 1.0
Title: Hello Shiny!
Author: RStudio, Inc.
AuthorUrl: http://www.rstudio.com/
License: GPL-3
DisplayMode: Showcase
Tags: getting-started
Type: Shiny
Adding fields Package and Version will resolve this error ERROR system error 71 (Protocol error) [description=Version field not found in...]
Mac64 R> install.packages("quantmod")
Yields a discouraging message. Namely,
Warning: unable to access index for repository http://www.ibiblio.org/pub/languages /R/CRAN/bin/macosx/leopard/contrib/2.12
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘quantmod’ is not available
No big deal, just pass in a different repo, like this:
Mac64 R> install.packages("quantmod", repo="http://R.research.att.com")
And all is well. But how do you set the default repo so you don't need to pass it in every time? In Ubuntu, there is a file that manages this but the documentation for Mac OS X is a bit sparse.
Can't tell if you are using the R64.app GUI but guessing that you may not be. You can set the default repository in the r/Preferences/ panels if you are using R64.app. Personally I use the repository at the same facility that hosts StatLib which shows up on some dialogs something like USA (PA 1) but on my Preferences pane is http://lib.stat.cmu.edu/R/CRAN . Here is a bit of ?options that may be of interest:
repos:
URLs of the repositories for use by update.packages. Defaults to
c(CRAN="#CRAN#"), a value that causes some utilities to prompt for
a CRAN mirror. To avoid this do set the CRAN mirror, by something
like local({r <- getOption("repos"); r["CRAN"] <- "http://my.local.cran";
options(repos=r)}).
Note that you can add more repositories (Bioconductor and Omegahat, notably)
using setRepositories().
At the moment my "other repository" setting in the the R64.app is http://www.stats.ox.ac.uk/pub/RWin/bin/macosx/leopard/contrib/2.12/ , because I was doing something to get a package that was only at Ripley's site but it is usually set to R--Forge: http://r-forge.r-project.org/
See the help for function setRepositories; you can manage your list of repositories in a GUI or by editing the file R_HOME/etc/repositories.
You can know what is your R_HOME directly in R:
> R.home()
[1] "/usr/lib/R"
http://cran.r-project.org/doc/manuals/R-admin.html#Managing-libraries
Try creating the folders and files as suggested for UNIX-like systems; chances are that R will check for them on OS X as well when looking for repo settings.