-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting 'argument "json.column" is missing' error, with no explanation why, cannot find troubleshooting documentation #119
Comments
Hello! Thanks for sharing!! Can you share:
It's hard to say what issue you're running into without that sort of information. The https://www.jessemaegan.com/post/so-you-ve-been-asked-to-make-a-reprex/ That said, I believe you need to |
Version: tidyjson v0.2.4 Reprex: library(tidyjson)
#>
#> Attaching package: 'tidyjson'
#> The following object is masked from 'package:stats':
#>
#> filter
workingDirectory <- "~/Desktop/R/LumpySportsPrincess"
setwd(workingDirectory)
result <- jsonlite::fromJSON("testdata.json")
colnames(result)
#> [1] "teams" "commenceTime" "homeTeam" "lastUpdate"
#> [5] "spread" "kenPom" "inpredictable"
result_flat <- result %>%
gather_array %>% # stack the users
spread_all %>%
select(teams) # select only what is needed
#> Error in eval(assertion, env): argument "json.column" is missing, with no default Created on 2020-03-07 by the reprex package (v0.3.0) |
Reprex of result_flat <- result %>% as.tbl_json() %>% spread_all()
#> Error in result %>% as.tbl_json() %>% spread_all(): could not find function "%>%" Created on 2020-03-07 by the reprex package (v0.3.0) |
Thanks for sharing! Please note that i.e.
|
Reprex (this time with the libraries loaded): library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tidyjson)
#>
#> Attaching package: 'tidyjson'
#> The following object is masked from 'package:dplyr':
#>
#> bind_rows
#> The following object is masked from 'package:stats':
#>
#> filter
workingDirectory <- "~/Desktop/R/LumpySportsPrincess"
setwd(workingDirectory)
result <- jsonlite::fromJSON("testdata.json")
result_flat <- result %>% as.tbl_json() %>% spread_all()
#> Error in eval(assertion, env): argument "json.column" is missing, with no default Created on 2020-03-07 by the reprex package (v0.3.0) |
Oops. Yeah, it looks like this error messaging could probably be cleaned up a bit. Try reading the file with library(tidyjson)
#>
#> Attaching package: 'tidyjson'
#> The following object is masked from 'package:stats':
#>
#> filter
packageVersion("tidyjson")
#> [1] '0.2.4'
json_str <- '[ { "teams": ["West Virginia Mountaineers", "Texas Longhorns"], "commenceTime": 1582588800, "homeTeam": "Texas Longhorns", "lastUpdate": 1582518362, "spread": "5.5", "kenPom": [ { "team": "West Virginia Mountaineers", "match": { "target": "West Virginia", "rating": 0.6470588235294118, "data": { "rank": "7", "team": "West Virginia", "conference": "B12", "record": "19-8", "adjustedEfficiency": "+6.14", "adjustedOffense": "107.1", "adjustedDefence": "84.4", "adjustedTempo": "69.6", "luck": "-.032", "opponentOffense": "106.5", "opponentDefense": "95.7" } } }, { "team": "Texas Longhorns", "match": { "target": "Texas", "rating": 0.47058823529411764, "data": { "rank": "68", "team": "Texas", "conference": "B12", "record": "16-11", "adjustedEfficiency": "-0.09", "adjustedOffense": "103.1", "adjustedDefence": "92.4", "adjustedTempo": "66.1", "luck": "+.066", "opponentOffense": "106.0", "opponentDefense": "97.1" } } } ], "inpredictable": [ { "team": "West Virginia Mountaineers", "match": { "target": "West Virginia", "rating": 0.6470588235294118, "data": { "rank": "9", "team": "West Virginia", "conference": "B12", "record": "18-8", "genericPointsFavored": "15.5", "adjustedOffense": "6.1", "adjustedDefence": "9.4", "projectedWins": "20.726", "pastStrengthOfSchedule": "8.16153846153846", "futureStrengthOfSchedule": "10.75" } } }, { "team": "Texas Longhorns", "match": { "target": "Texas", "rating": 0.47058823529411764, "data": { "rank": "69", "team": "Texas", "conference": "B12", "record": "16-11", "genericPointsFavored": "7.4", "adjustedOffense": "-0.7", "adjustedDefence": "8.1", "projectedWins": "17.2528", "pastStrengthOfSchedule": "5.52086122266845", "futureStrengthOfSchedule": "12.85" } } } ] } ]'
writeLines(json_str, "testdata.json")
read_from_file <- as.tbl_json("testdata.json")
read_from_file %>%
gather_array() %>%
spread_all()
#> # A tbl_json: 1 x 6 tibble with a "JSON" attribute
#> `attr(., "JSON"… document.id array.index commenceTime homeTeam lastUpdate
#> <chr> <int> <int> <dbl> <chr> <dbl>
#> 1 "{\"teams\":[\"… 1 1 1582588800 Texas L… 1582518362
#> # … with 1 more variable: spread <chr> Created on 2020-03-08 by the reprex package (v0.3.0) |
Code I have entered:
result <- jsonlite::fromJSON("testdata.json", simplifyDataFrame = TRUE) result %>% spread_all
Error I receive:
The only semi relevant issue I've found through Google is here, but is dated as of 2017. Is dplyr compatibility still an issue?
The text was updated successfully, but these errors were encountered: