I really have a hard time trying to translate 1.5k responses to an open ended question from french to english. I want to use the R-Package "translateR" with the Microsoft-API. Microsoft because I got an Azure-Account due to my University without the need of spending Creditcard-Information.
Actually I am not sure if I am doing it wrong because of beeing unable to fill in the right parameter for "client id" and "client secret" or if its just outdated package which does not work with Microsoft API anymore due to migration by Microsoft or something. I researched some similar questions at stackoverflow but did not found any answer or solution already.
Here is some code to maybe replicate the problem. An exampledataset is used which is integrated in "translateR".
#install.packages("translateR")
library(translateR)
data(enron)
google.dataset.out <- translateR::translate(dataset = enron,
content.field = 'email',
microsoft.client.id = my.client.id,
microsoft.client.secret = my.client.secret,
source.lang = 'en',
target.lang = 'de')
I am constantly getting this output:
Error in function (type, msg, asError = TRUE) :
Could not resolve host: datamarket.accesscontrol.windows.net
I am quite new to using R-Language, pls be kind if I did something totaly stupid. Can anyone confirm that it is not possible to use "translateR" with microsoft API anymore? Can anyone give me advise how to deal with my data if translation is not possible with the package anymore?
The R-Package is outdated but the development version has been updated more recently. For installation the package "devtools" needs to be installed before using the following command:
###Install devtools###
install.packages("devtools")
###Install development version of translateR###
devtools::install_github("ChristopherLucas/translateR")
Within the development version the commandsyntax changed aswell.
library(translateR)
data(enron)
dataset.out <- translateR::translate(dataset = enron,
content.field = 'email',
microsoft.api.key = 'my.ms.api.key',
source.lang = 'en',
target.lang = 'de')
For more information read this:
translateR documentation update on github
Related
Please can someone help me figure out what is going on? I used the mastodon library in R Studio to extract some data from the fediverse successfully a while ago. Here is the code I used:
tokens <- login("https://mastodon.social/",user = user,pass = password)
"user" is my email address.
It worked well initially, but trying it again, I am getting this annoying error message, which I do not understand:
Error in UseMethod("content", x) :
no applicable method for 'content' applied to an object of class "response"
Please can any good samaritan out there who has used this library in R Studio help me figure out what is going on? I need to prepare a report on this project. Thanks in advance of your help.
It is possible that some functions may have masked the function. By calling this on a fresh R session, it did work
tokens <- login("https://mastodon.social/",user = user,pass = password)
tokens$instance
[1] "https://mastodon.social/"
I am trying to use TranslateR package in R to translate the column of the data from Korean to English. I tried using the following code:
install.packages("devtools")
library(devtools)
library(translateR)
##Install development version of translateR
devtools::install_github("ChristopherLucas/translateR")
foodcode_translated <- translateR::translate(dataset = food_code,
content.field = '식품코드명',
google.api.key =
"XXXXXXXXXXXXXXXX",
source.lang = 'ko',
target.lang = 'en')
I successfully got the google API key.
The codes above do not show any error but there is no change in the data frame after the codes are run.
Can anybody tell me what the issue is?
Thanks
I am trying to use the acs package in R to download Census data for a basic map, but I am unable to download the data and I'm receiving a confusing error message.
My code is as follows:
#Including all packages here in case this is somehow the issue
install.packages(c("choroplethr", "choroplethrMaps", "tidycensus", "tigris", "leaflet", "acs", "sf"))
library(choroplethr)
library(choroplethrMaps)
library(tidycensus)
library(tigris)
library(leaflet)
library(acs)
library(sf)
library(tidyverse)
api.key.install("my_api_key")
SD_geo <- geo.make(state="CA", county = 73, tract = "*", block.group = "*")
median_income <- acs.fetch(endyear = 2015, span = 5, geography = SD_geo, table.number = "B19013", col.names="pretty")
Everything appears to work until the final command, when I receive the following error message:
trying URL 'http://web.mit.edu/eglenn/www/acs/acs-variables/acs_5yr_2015_var.xml.gz'
Content type 'application/xml' length 735879 bytes (718 KB)
downloaded 718 KB
Error in if (url.test["statusMessage"] != "OK") { :
missing value where TRUE/FALSE needed
In addition: Warning message:
In (function (endyear, span = 5, dataset = "acs", keyword, table.name, :
XML variable lookup tables for this request
seem to be missing from ' https://api.census.gov/data/2015/acs5/variables.xml ';
temporarily downloading and using archived copies instead;
since this is *much* slower, recommend running
acs.tables.install()
This is puzzling to me because 1) it appears like something is in fact being downloaded at first? and 2) 'Error in if (url.test["statusMessage"] != "OK") { :
missing value where TRUE/FALSE needed' makes no sense to me. It doesn't align with any of the arguments in the function.
I have tried:
Downloading the tables using acs.tables.install() as recommended in the second half of the error message. Doesn't help.
Changing the endyear and span to be sure that I'm falling within the years of data supported by the API. I seem to be, according to the API documentation. Have also used the package default arguments with no luck.
Using 'variable =' and the code for the variable as found in the official API documentation. This returns only the two lines with the mysterious "Error in if..." message.
Removing colnames = "pretty"
I'm going to just download the datafile as a CSV and read it into R for now, but I'd like to be able to perform this function from the script for future maps. Any information on what's going on here would be appreciated. I am running R version 3.3.2. Also, I'm new to using this package and the API. But I'm following the documentation and can't find evidence that I'm doing anything wrong.
Tutorial I am working off of:
http://zevross.com/blog/2015/10/14/manipulating-and-mapping-us-census-data-in-r-using-the-acs-tigris-and-leaflet-packages-3/#get-the-tabular-data-acs
And documentation of the acs package: http://eglenn.scripts.mit.edu/citystate/wp-content/uploads/2013/02/wpid-working_with_acs_R2.pdf
To follow up on Brandon's comment, version 2.1.1 of the package is now on CRAN, which should resolve this issue.
Your code runs for me. My guess would be that the Census API was temporarily down.
As you loaded tidycensus and you'd like to do some mapping, you might also consider the following code:
library(tidycensus)
census_api_key("your key here") # use `install = TRUE` to install the key
options(tigris_use_cache = TRUE) # optional - to cache the Census shapefile
median_income <- get_acs(geography = "block group",
variables = "B19013_001",
state = "CA", county = "San Diego",
geometry = TRUE)
This will get you the data you need, along with feature geometry for mapping, as a tidy data frame.
I emailed Ezra Haber Glenn, the author of the package, about this as I was having the same issue. I received a response within 30 minutes and it was after midnight, which I thought was amazing. Long story short, the acs package version 2.1.0 is configured to work with the changes the Census Bureau is making to their API later this summer, and it is currently presenting some problems windows users in the mean time. Ezra is going to be releasing an update with a fix, but in the mean time I reverted back to version 2.0 and it works fine. I'm sure there are a few ways to do this, but I installed the devtools package and ran:
require(devtools)
install_version("acs", version = "2.0", repos = "http://cran.us.r-project.org")
Hope this helps anyone else having a similar issue.
When ever I try to run this line or any other line which uses key(following document in http://h2o-release.s3.amazonaws.com/h2o/rel-lambert/5/docs-website/Ruser/rtutorial.html)
iris.hex = h2o.uploadFile(localH2O, path = irisPath, key = "iris.hex")
I get an error in the key calling it as unused argument.
This is the first time I am using H2O and I am new to R as well. Please let me know what is the function of key and only when I run this, I get error. I could create a dataframe with the following statement. But still I would want to understand this key error
h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)
irisPath = system.file("extdata", "iris.csv", package = "h2o")
iris.hex = h2o.uploadFile(path = prosPath, destination_frame = "iris.hex")
iris.data.frame<- as.data.frame(iris.hex)
summary(iris.data.frame)
H2O may be very good in various areas. but unfortunately lack of documentation and tutorial makes it's really difficult to learn...
Hoping that they watch these type of comments and improve their documentation.
At least launching one tutorial of 12GB airlines data processing can help a lot for multiple enthusiastic people who really wanted to explore H2O.
This is a very outdated version of the H2O docs and there have been some major API changes since H2O 3.0. The latest R docs can always be found at: http://h2o-release.s3.amazonaws.com/h2o/latest_stable_Rdoc.html
Our main docs landing page has a link to the latest R docs, Python docs, and a bunch of other links you may find useful. We also have a Google Group called h2ostream for posting new questions and searching through old questions. Welcome to H2O!
This is my first question to the community. I've read through the guidelines and am doing my best to ask an appropriate question and including a minimal, complete, and verifiable example. That being said, please feel free to suggest ways in which I can ask better questions going forward.
I am having trouble with the choroplethrMaps package, which I have never used in the past. I have had issues installing packages on my work computer before, but have gotten around this issue by pasting the package and its dependencies in my library directory. Part of my issues may stem from that, but I'm not sure.
Here is the code that replicates the issue on my machine.
library(choroplethrMaps)
library(choroplethrAdmin1)
library(choroplethr)
data(state.map)
df<-data.frame(region=unique(x = state.map$region),value=rnorm(n = 51,mean = 500,sd = 45))
debug(state_choropleth)
state_choropleth(df = df,title = "", legend = "", num_colors = 1)
After debugging the state_choropleth function, it looks like there is an error with the "render" portion of the code. When I execute the above code, I get the following error message.
Error in withCallingHandlers(tryCatch(evalq((function (..., call. = TRUE, :
object '.rcpp_warning_recorder' not found
Note that I am only using state_choropleth because when running the choroplethr function, I was advised to use state_choropleth instead. It seems as though choroplethr is out of date.