Sorry new to stack overflow - but went back to some code using rAltmetric in R (used in in May), but now appears to not be working, have gone back and used some DOI and ISBN from previous comments on rAltmetric to illustrate new error I am receiving (tried also getting package from guthub) - I am wondering if they have closed the window to get into altmetrics
library(rAltmetric)
altmetrics(isbn = "978-3-319-25557-6")
Error: lexical error: invalid char in json text.
The API key you supplied was no
(right here) ------^
In addition: Warning message:
In altmetrics(isbn = "978-3-319-25557-6") : Unauthorized (HTTP 401).
altmetrics(doi = "10.1038/465860a")
Error: lexical error: invalid char in json text.
The API key you supplied was no
(right here) ------^
In addition: Warning message:
In altmetrics(doi = "10.1038/465860a") : Unauthorized (HTTP 401).
Have others recently started having a problem with rAltmetric
Any help welcome.
MalcB
It doesn't appear to be an API key problem. Something is up with their query function.
I created a simplified version of the function that works, here: https://gist.github.com/mathzero/f1d1b3b94f6f76019a5861d1bed7d597
... but haven't had time to identify exactly what the issue is.
In the mean time I suggest raising a query on their github.
Related
I'm trying to use the Microsoft Translator API to translate the following dataset into English, using the following function from the translateR library:
Test <- ("草")
microsoftTranslate(Test, api.key = 'my api key', source.lang = 'zh-Hans', target.lang = 'en')
However, I keep getting the following error:
Error in x[["translations"]] :
object of type 'externalptr' is not subsettable
I've searched Stack Overflow and the Web, but couldn't seem to find similar issues in this context or clear discussion on the topic. Seem to have found indication that this could be due to parsing issue, have since tried different languages in Roman script, but the same error prevails. I'll have several thousand strings to translate across multiple languages. Grateful for any kind help. Thanks.
I am trying to write inside a sharepoint list from my R script but I keep getting this error :
Error: node stack overflow
Error during wrapup: node stack overflow
I am using the package sharepointr that I found in this github repository : https://github.com/LukasK13/sharepointr
I used the sp_WriteListData but it doesn't seem to work. I tried to execute the function step by step with its code, which can be found here : https://rdrr.io/github/LukasK13/sharepointr/src/R/sharepoint_list_post.R
The function always stops at the last step when I execute this line of code :
sp_request(con, request = request, verb = "POST", body = data).
Does anyone know how to get rid of this error ?
Thank you very much !
I am attempting to use the streamR in R to download and analyze Twitter, under the pretense that this library can overcome the limitations from the twitteR package.
When downloading data everything seems to work fabulously, using the filterStream function (just to clarify, the function captures Twitter data, just running it will provide the json file -saved in the working directory- that needs to be used in further steps):
filterStream( file.name="tweets_test.json",
track="NFL", tweets=20, oauth=credential, timeout=10)
Capturing tweets...
Connection to Twitter stream was closed after 10 seconds with up to 21 tweets downloaded.
However, when moving on to parse the json file, I keep getting all sorts of errors:
readTweets("tweets_test.json", verbose = TRUE)
0 tweets have been parsed.
list()
Warning message:
In readLines(tweets) : incomplete final line found on 'tweets_test.json'
Or with this function from the same package:
tweet_df <- parseTweets(tweets='tweets_test.json')
Error in `$<-.data.frame`(`*tmp*`, "country_code", value = NA) :
replacement has 1 row, data has 0
In addition: Warning message:
In stream_in_int(path.expand(path)) : Parsing error on line 0
I have tried reading the json file with jsonlite and rjson with the same results.
Originally, it seemed that the error came from special characters ({, then \) within the json file that I tried to clean up following the suggestion from this post, however, not much came out of it.
I found out about the streamR package from this post, which shows the process as very straight forward and simple (which it is, except for the parsing part!).
If any of you have experience with this library and/or these parsing issues, I'd really appreciate your input. I have been searching non stop but haven't been able to locate a solution.
Thanks!
Working through a download script for CPS data found here. Using the script verbatim, per recent update, except for the Java modification that I added for my environment (below) to fix a previous error in loadnamespace. While I am familiar with the basics of R, this is my first foray into MonetDBLite.
# configure Java
if (Sys.getenv("JAVA_HOME")!="")
Sys.setenv(JAVA_HOME="")
library(rJava)
Now I am getting the following error, which generally comes after 380,000 of the 400,000 cps asec lines are processed.
Warning message:
In readLines(url) :
incomplete final line found on 'http://thedataweb.rm.census.gov/pub/cps/march/asec2015early_pubuse.dd.txt'
Error in dbConnect(MonetDBLite::MonetDBLite(), dbfolder) :
error in evaluating the argument 'drv' in selecting a method for function 'dbConnect': Error: 'MonetDBLite' is not an exported object from 'namespace:MonetDBLite'
MonetDBLite has just been updated on CRAN, please reinstall.
I would like to retrieve power hedging data using Rbbg bloomberg package in R and I know this formula works in excel :
=BDH("VATT SS Equity","BI_%_ELECTRIC_POWER_HEDGED","01/01/2000","","GEOGRAPHIC_LOCATION_OVERRIDE=EUCN","BI_CONTRACT_MATURITY_OVERRIDE=CY12","FUND_PER=Q")
But when I try this in R :
conn<-blpConnect(log.level="off")
data<-bdh(conn,"VATT SS Equity","BI_PER_ELECTRIC_POWER_HEDGED","20000101","","GEOGRAPHIC_LOCATION_OVERRIDE=EUCN","BI_CONTRACT_MATURITY_OVERRIDE=CY12","FUND_PER=Q")
I get the following error message :
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
org.findata.blpwrapper.WrapperException: response error: Invalid override field id specified [nid:217]
What should I change in the formula to make it work ?
Thanks
Edit: Indeed it is BI_PCT_ELECTRIC_POWER_HEDGED, however the problem does not come from here but from the overrides.
This returns an empty variable for me, but it doesn't throw an error so it might get you on the right track.
The way you specify options is different in the current version it seems.
data<-bdh(conn,"VATT SS Equity", "BI_PER_ELECTRIC_POWER_HEDGED","20000101","",
override_fields=c("GEOGRAPHIC_LOCATION_OVERRIDE",
"BI_CONTRACT_MATURITY_OVERRIDE",
override_values=c("EUCN","CY12"),
option_names="periodicitySelection",
option_values="QUARTERLY")
The doc where I found the correct syntax is here: RBloomberg. It was written in 2010 for the predecessor package (before Bloomberg complained about using their name) but I guess it works! I think the convention of enumerating the list of option names then the option values is odd compared to your assumption that OPTION=VALUE was correct, but there you go.