'Can't combine <integer> and <list>
I seem to have a simple piece of code that takes a JSON file and converts it into a nice dataframe. This JSON file is participants' data from my online study. For other datasets, this exact code works perfectly well, but on this particular dataset it gives me the following error.
Error: Can't combine `..1$env` <integer> and `..2$env` <list>.
The code itself is as follows:
lines <- readLines(file) %>% map_dfr(fromJSON, flatten=F) -> data
I understand that one of my variables, env is coming across as both an integer and a list. But why would that be. In the task, env is simply 1,2,3 and it represents different environments that the participant plays my task in.
Any leads on how to fix it? I am happy to share more details about the JSON file if needed, but put simply, it is simply a masterfile with a JSON entry for every participant on a new line.
Let me know what you all think!
Best
PS: Here is the JSON file for more info. I have deleted one line at the top because it contained some identifiable information.
</h4>","response":null,"test_part":"fixation_warning","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":13,"time_elapsed":482809,"internal_node_id":"0.0-6.0-1.0-1.1"},{"rt":3604.9000000003725,"stimulus":"stimuli/cfd/CFD-WM-018-002-N.jpg","response":"k","faceNo":15,"test_part":"stimulus","block_no":0,"env":1,"trial_type":"image-keyboard-response","trial_index":14,"time_elapsed":486416,"internal_node_id":"0.0-6.0-1.0-2.1","ft":0.06699166666666667},{"rt":null,"stimulus":"<h2>+</h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"skip_fixation","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":15,"time_elapsed":487418,"internal_node_id":"0.0-6.0-1.0-4.1-0.1"},{"trial_type":"call-function","trial_index":16,"time_elapsed":487418,"internal_node_id":"0.0-6.0-1.0-6.1"},{"rt":null,"stimulus":"<h2>+</h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"fixation","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":17,"time_elapsed":488420,"internal_node_id":"0.0-6.0-1.0-0.2"},{"rt":null,"stimulus":"<h2><mark>+</mark></h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"fixation_warning","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":18,"time_elapsed":488922,"internal_node_id":"0.0-6.0-1.0-1.2"},{"rt":1772.2999999998137,"stimulus":"stimuli/cfd/CFD-WM-025-002-N.jpg","response":"k","faceNo":50,"test_part":"stimulus","block_no":0,"env":1,"trial_type":"image-keyboard-response","trial_index":19,"time_elapsed":490696,"internal_node_id":"0.0-6.0-1.0-2.2","ft":0.11793333333333333},{"rt":null,"stimulus":"<h2>+</h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"skip_fixation","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":20,"time_elapsed":491697,"internal_node_id":"0.0-6.0-1.0-4.2-0.2"},{"trial_type":"call-function","trial_index":21,"time_elapsed":491698,"internal_node_id":"0.0-6.0-1.0-6.2"},{"rt":null,"stimulus":"<h2>+</h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"fixation","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":22,"time_elapsed":492699,"internal_node_id":"0.0-6.0-1.0-0.3"},{"rt":null,"stimulus":"<h2><mark>+</mark></h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"fixation_warning","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":23,"time_elapsed":493400,"internal_node_id":"0.0-6.0-1.0-1.3"},{"rt":1173.300000000745,"stimulus":"stimuli/cfd/CFD-WF-015-006-N.jpg","response":"j","faceNo":29,"test_part":"stimulus","block_no":0,"env":1,"trial_type":"image-keyboard-response","trial_index":24,"time_elapsed":494575,"internal_node_id":"0.0-6.0-1.0-2.3","ft":0.15525833333333333},{"rt":null,"stimulus":"stimuli/cfd/CFD-WF-015-006-N.jpg","response":null,"feedback_given":0,"test_part":"feedback","block_no":0,"trial_type":"image-keyboard-response","trial_index":25,"time_elapsed":495578,"internal_node_id":"0.0-6.0-1.0-3.3-0.3"},{"trial_type":"call-function","trial_index":26,"time_elapsed":495578,"internal_node_id":"0.0-6.0-1.0-6.3"},{"rt":null,"stimulus":"<h2>+</h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next
> person</mark></h4>","response":null,"test_part":"fixation","env":1,"block_no":0,"trial_type":"html-keyboard-response","trial_index":27,"time_elapsed":496580,"internal_node_id":"0.0-6.0-1.0-0.4"},{"rt":null,"stimulus":"<h2><mark>+</mark></h2><div
> id=\"container\"></div><h4 id = \"keys\"><mark>Press \"J\" to send
> friend request, or \"K\" to move to the next person</mark>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
