Putting the dir_id using boxr package in R - r

I am trying to setup the working directory-using the url-"https:\..."
Code:
box_setwd(url)
Error:-
Error in box_id(dir_id) :
box.com API ids must be (coercible to) 64-bit integers.
I am exploring bit64 package meanwhile it will be great to have a workaround.
I hope the details are enough.

the dir and other ids pertaining to the boxr commands are the numeric extensions in the url- it's available in the documentation

Related

Why is R library not loading in app.powerbi.com?

I keep getting the following error on app.powerbi.com:
"Error in pivot_wider(data, names_from=names,values_from=values): could not find function "pivot_wider""
I load the 'tidyr' package as a required library.
I get the same error when using "spread" instead of pivot_wider.
When I specify the function using:
tidyr::pivot_wider(data, names_from=names, values_from=values)
I get a different error:
"Error in loadNamespace(name): there is no package called 'tidyr'".
PowerBI Desktop everything works perfectly fine. It's only on the published PowerBI report that I get the error.
What can I do to resolve this issue?
Alternative library / function to 'pivot_wider' or 'spread'?
I was able to verify using print statements that the report on powerbi.com was not able to access the r packages that were installed.
I was using a .libPaths()[3] to point to the location where my libraries were installed, but this didn't work in powerbi.com.
I ended up re-installing R to a location where I could install packages to, since admin rights are necessary to write to the C:/users/program files location.

Error using map function in edgarWebR 1.1.0

I wrote a script for downloading and analyzing 13F filing from a select number of fund managers using the great package edgarWebR in R. Unfortunately the script stopped working after my update to version 1.1.0 of edgarWebR. I get the following error message whilst running this part of the script:
map(filings_incl_href$href, filing_details)
filings_incl_href$href contains the hrefs of all the fund managers 13F-filings, e.g. the first one is: https://www.sec.gov/Archives/edgar/data/1540531/000154053121000004/0001540531-21-000004-index.htm
Here's the error message:
No encoding supplied: defaulting to UTF-8.
Error in check_result(res) :
EDGAR request blocked from Undeclared Automated Tool.
Please visit https://www.sec.gov/developer for best practices.
See https://mwaldstein.github.io/edgarWebR/index.html#ethical-use--fair-access for your responsibilities
Consider also setting the environment variable 'EDGARWEBR_USER_AGENT
Not sure what is causing this. Any help would be greatly appreciated.

Deploy custom R script as web service Azure ML Studio

I have an R script which takes as input an excel file with two columns containing dates-values and it gives as output 3 dates with the corresponding prediction values. I have already successfully implemented it in Azure Machine Learning Studio using three nodes. One containing the zipped packages I use, one with the input .csv file and the last one with the R script.
The problem is when I deploy it as a web service and I try to give as input new values for Col1 and Col2, I receive the following error.
FailedToParseValue: Failed to parse value '90000, 950000, 970000' as type 'System.Double'., Error code: LibraryExecutionError, Http status code:400
The zipped libraries I use attached are: Hmisc, gdata, forecast, lubridate, fma, expsmooth, ggplot2, tsibble, fpp2, and plyr. I have also tried using the notebooks provided but no good luck as I always face some kind of problem with package installation. Moreover, I tried to follow this approach https://azure.github.io/azureml-sdk-for-r/articles/train-and-deploy-to-aci/train-and-deploy-to-aci.html locally from R Studio but I have difficulty in adapting it to my case.
Any help would be greatly appreciated!
I didn't have any success installing packages via a zip. However the following worked for me in an Execute R Script and installed all dependancies also.
if(!require(package)) install.packages("package",repos = "https://ftp.heanet.ie/mirrors/cran.r-project.org/")
Make sure that your repo is from CRAN in your country.

Weird issue while testing R package: package `[package name]` found more than once, using the first from [file path]

I'm working on a somewhat complex package (that I unfortunately can't share) that involves a Shiny app, and it an issue has surfaced where I'm getting these warnings when testing:
package [package name] found more than once, using the first from [file path]
In library(testthat) : package ‘testthat’ already present in search()
The first one occurs because I'm using system.file to pull a file in inst that I use for testing.
I've tried to do some debugging with .libPaths and by forcing system.file to go to the .libPaths default with the lib.loc argument, but that doesn't do anything.
I've tried uninstalling the package, which works because then there are not multiple results for find.package.
It seems like testthat adds the current directory to the library paths while it's running, and this creates the issue with system.file and consequently, find.package.
I'm really confused as to what's causing this. I'm combing through the changes I've made and I can't seem to find anything. Any ideas are helpful. I've tried googling this error messages and all that comes up is the source.
The issue here was with changing the option setting for verbose. That caused more output to result from the code, which broke a lot of tests. I hope this helps someone in the future.

Neo4j spatial server plugin fails on withinDistance and closest java.lang.NoClassDefFoundError

I know that the plugin is being loaded properly, as other methods work such as spatial.procedures and spatial.addNode etc.
The error results after a call like this:
CALL spatial.withinDistance('profile_geo', [43.524, 96.7341], 500)
and the error that results is this:
Failed to invoke procedure `spatial.withinDistance`: Caused by: java.lang.NoClassDefFoundError: org/neo4j/cypher/internal/compiler/v3_0/commands/expressions/GeographicPoint
The same error appears when trying to use the closest function as well. Any help would be appreciated.
It looks that you are missing required Jar for GeographicalPoint class.
Please make sure you have this class in your Jars. I know this class exists in neo4j-cypher-compiler-3.0-3.0.3.jar but it is not going to work for you as it is residing in different namespace. If you will not be able to pinpoint the corresponding Jar in your environment please have a look at Maven repository and try to find it there.
short answer: upgrade to 3.0.3 (both neo4j and plugin)
long answer:
I ran into the exact same issue today. I was running version 3.0.2 with server plugin version 3.0.2 and ran the cypher query:
CALL spatial.withinDistance("spatial_records",{lon:20.0,lat:50.0},100000000)
Joran mentioned in the comments above that the REST API was a working alternative. So I tried that out and found he was indeed correct.
I tested this using httpie, with the following command:
cat tmp.json | http :7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance
where tmp.json looks like:
{"layer" : "spatial_records","pointX" :3.9706,"pointY" : 46.7907,"distanceInKm" :10000000000}
While this works, using CYPHER with stored procedures would be nice. So upon further investigation, I noticed that a recent commit contained the following changes:
- <neo4j.version>3.0.1</neo4j.version>
+ <neo4j.version>3.0.3</neo4j.version>
...
-import org.neo4j.cypher.internal.compiler.v3_0.commands.expressions.GeographicPoint;
+import org.neo4j.cypher.internal.compiler.v3_0.GeographicPoint;
So I ended up downloading version 3.0.3 of both neo4j and the spatial plugin. Whatever the issue was before, seems to be fixed in this version. The call to the stored procedure now works as expected!

Resources