[R] Help in modifying code to extract data from url
bh@@k@r@ko|k@t@ @end|ng |rom gm@||@com
Wed May 19 19:10:41 CEST 2021
I am trying to extract data from a url. The codes work well when the
data structure is as follows:
However, the code fails when the data structure has no number
under the 2nd column (shown below).I get the following error:
"Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 242, 241"
Can anyone please help me in how I can modify the codes ( shown below) to
adjust for the above mentioned condition
in the data structure.
url <- "abcd.com"
json_data <- fromJSON(file= url)
d3 <- lapply(json_data[], function(x) c(x["data"]))
d3 <- do.call(rbind, d3)
X_Dataframe = as.data.frame(unlist(d3[]))
b <- do.call("cbind", split(X_Dataframe, rep(c(1, 2), length.out =
[[alternative HTML version deleted]]
More information about the R-help