rjsonio

R package with dependency on shiny gives RJSONIO warning

会有一股神秘感。 提交于 2019-12-13 14:05:27
问题 My package CTDesignExplorer uses shiny (and shinyIncubator). When I include Depends: shiny in the DESCRIPTION file, there are warnings upon loading the package in RStudio: Warning in .simpleDuplicateClass(def, prev) : the specification for S3 class “AsIs” in package ‘RJSONIO’ seems equivalent to one from >package ‘BiocGenerics’ and is not turning on duplicate class definitions for this class In command line R, loading shiny gets multiples warnings; in addition to "AsIs", with "connect", "file

Strange behaviour in fromJSON in RJSONIO package

雨燕双飞 提交于 2019-12-13 05:31:13
问题 Ok, I'm trying to convert the following JSON data into an R data frame. For some reason fromJSON in the RJSONIO package only reads up to about character 380 and then it stops converting the JSON properly. Here is the JSON:- "{\"metricDate\":\"2013-05-01\",\"pageCountTotal\":\"33682\",\"landCountTotal\":\"11838\",\"newLandCountTotal\":\"8023\",\"returnLandCountTotal\":\"3815\",\"spiderCountTotal\":\"84\",\"goalCountTotal\":\"177.000000\",\"callGoalCountTotal\":\"177.000000\",\"callCountTotal\"

Problems reading JSON file in R

我的梦境 提交于 2019-12-12 13:44:46
问题 I have a JSON file (an export from mongoDB) that I'd like to load into R. The document is about 890 MB in size with roughly 63,000 rows of 12 fields. The fields are numeric, character and date. I'd like to end up with a 63000 x 12 data frame. lines <- readLines("fb2013.json") result: jFile has all 63,000 elements in char class and all fields are lumped into one field. Each file looks something like this: "{ \"_id\" : \"10151271769737669\", \"comments_count\" : 36, \"created_at\" : { \"$date\"

How to replace “unexpected escaped character” in R

我怕爱的太早我们不能终老 提交于 2019-12-12 11:10:17
问题 When I try to parse JSON from the character object from a Facebook URL I got "Error in fromJSON(data) : unexpected escaped character '\o' at pos 130". Check this out: library(RCurl) library(rjson) data <- getURL("https://graph.facebook.com/search?q=multishow&type=post&limit=1500", cainfo="cacert.perm") fbData <- fromJSON(data) Error in fromJSON(data) : unexpected escaped character '\o' at pos 130 #with RSONIO also error > fbData <- fromJSON(data) Erro em fromJSON(content, handler, default

R 3.2.2: “rjson” and “RJSONIO” package installed, but error using “fromJSON”

你。 提交于 2019-12-12 05:58:13
问题 I've been having a lot of trouble using the "fromJSON" command. I'm trying to collect instagram data using their API, and this command isn't working. I'm using R and I have both packages for converting JSON to R installed, but I keep getting the following error: Error: could not find function "fromJSON" I use R Studio and R 3.2.2 for Windows 8 x64. I tried searching and couldn't find a solution. Any help would be appreciated. 回答1: Installing the package alone doesn't suffice. You need to load

How to pass a variable in url in fromJSON command

爷,独闯天下 提交于 2019-12-11 08:53:30
问题 I am trying to pass a variable in the url and flatten using jsonlite, but i am not able to pass variable pages using the loop. How do i loop using FromJSON? pages<- list() for(i in 1:20) { mydata <- fromJSON("https:www.example.com/page="+i+"&access_token=xyz", flatten = TRUE) } filings <-rbind.pages(pages) 回答1: What about this? pages<- list() for(i in 1:20) { mydata <- fromJSON(paste("https:www.example.com/page=", i, "&access_token=xyz", sep = "+"), flatten = TRUE) } filings <-rbind.pages

Simplifying a POSIX node with RJSONIO::fromJSON()

杀马特。学长 韩版系。学妹 提交于 2019-12-08 14:34:04
问题 I have the following vector of double values, x , where each element represents a POSIX date-time x <- c(1417621083, 1417621204, 1417621384, 1417621564, 1417621623) I am using the RJSONIO package, and would like to continue to do so. As an exercise, I'd like to convert these values into JSON text and then read them back into R again, but am having trouble getting the date-time representations into a nice simplified list result. In JSON, the dates need to be in a special format so the values

Converting a matrix/dataframe in R to JSON object with some constraints

梦想的初衷 提交于 2019-12-08 08:52:29
问题 REDITED: I have to convert a matrix in R to a JSON object with some structure in it. I am using the rjson package. Through an example, let me illustrate what I want. My specific case is the output of a recommender system code in R where the X2 X3 are the 2 closest items to a particular item X1. Also, X4,X5 are the scores of similarity associated with (X1,X2) and (X1,X3) for that row. I want all the recommended items for every item as JSON objects and every item along with its recommended JSON

Parsing data frame to JSON (via RJSONIO)

核能气质少年 提交于 2019-12-08 02:06:31
问题 I have an issue with RJSONIO. I have a data frame like df df <- data.frame(a = c(1:3), b = c(4:6), c = c(7:9) ) df a b c 1 1 4 7 2 2 5 8 3 3 6 9 Now what I need is to use this data frame and generate the rows in the following JSON structure. So in the end it would look something like this: { "job_id": "1", "page": "1", "rows": [ { "row": [ "1", "4", "7" ] }, { "row": [ "2", "5", "8" ] }, { "row": [ "3", "6", "9" ] } ] } I started with this chunk of code but there is problem with quotes inside

Converting a matrix/dataframe in R to JSON object with some constraints

做~自己de王妃 提交于 2019-12-07 04:40:33
REDITED: I have to convert a matrix in R to a JSON object with some structure in it. I am using the rjson package. Through an example, let me illustrate what I want. My specific case is the output of a recommender system code in R where the X2 X3 are the 2 closest items to a particular item X1. Also, X4,X5 are the scores of similarity associated with (X1,X2) and (X1,X3) for that row. I want all the recommended items for every item as JSON objects and every item along with its recommended JSON object- items as a bigger JSON objects.The scores should also be incorporated into the JSON structure.