unparsable argument

81 views
Skip to first unread message

Lindsie Arthur-Hulme

unread,
May 31, 2021, 3:23:35 AM5/31/21
to formr
Hello all! 

I'm having some trouble with an "unparsable argument" in some of my code. When I download the code to de-bug in R, it tells me that the little dash (see in red below) isn't meant to be there. 

But, I don't know how to fix this problem. I've included the code below but don't know if I should also provide something else. Any help would be greatly appreciated. 

Note: I did see that Ruben had some kind of issue with an unparsable argument, but the solution was a bit over my head.

Thanks, 
Linds


R Error: Unparsable argument: { 
(function() {
library(formr)
dcd_daily_international_wave4 = as.data.frame(jsonlite::fromJSON("{\"selected_health_dis_eat_item\":[null,null,null,\"2\",\"2\",\"2\"],\"last_rep_cycle\":[null,null,null,null,null,null],\"first_rep_cycle\":[null,null,null,null,null,null],\"last_rep_cycle_date_format\":[null,null,null,null,null,null],\"daily_cycle_day1\":[null,null,null,null,null,null],\"last_cycle_start\":[null,null,null,null,null,null],\"health_dis_eat_1\":[null,null,null,null,null,null],\"health_dis_eat_2\":[null,null,null,null,null,null],\"health_dis_eat_3\":[null,null,null,null,null,null],\"health_dis_eat_4\":[null,null,null,null,null,null],\"health_sleep_qual\":[null,null,null,null,null,null],\"daily_cycle_period_now\":[null,null,null,null,null,null],\"cycle_start_since_baseline\":[null,null,null,null,null,null],\"pill_day\":[null,null,null,null,null,null]}"), stringsAsFactors=F)
dcd_baseline_international_wave4 = as.data.frame(jsonlite::fromJSON("{\"cycle_day1_base\":[null,\"2021-05-20\"],\"contra_type_past\":[null,\"HBC\"]}"), stringsAsFactors=F)

(function() {with(tail(dcd_daily_international_wave4, 1), {
formr.showifs = list();
within(formr.showifs,  { 
si.health_dis_eat_1 = (function(){
selected_health_dis_eat_item == 1
})()
si.health_dis_eat_2 = (function(){
selected_health_dis_eat_item == 2
})()
si.health_dis_eat_3 = (function(){
selected_health_dis_eat_item == 3
})()
si.health_dis_eat_4 = (function(){
selected_health_dis_eat_item == 4
})()
si.health_sleep_qual = (function(){
`
})()
si.daily_cycle_day1 = (function(){
daily_cycle_period_now == 2
})()
last_rep_cycle = (function(){
format(max(na.omit(c(as.Date(dcd_baseline_international_wave4$cycle_day1_base, format="%Y-%m-%d"), as.Date(dcd_daily_international_wave4$daily_cycle_day1, format="%Y-%m-%d"), as.Date(dcd_daily_international_wave4$last_cycle_start, format="%Y-%m-%d")))), format="%a %B %d %Y")
})()
first_rep_cycle = (function(){
format(min(na.omit(c(as.Date(dcd_baseline_international_wave4$cycle_day1_base, format="%Y-%m-%d"), as.Date(dcd_daily_international_wave4$daily_cycle_day1, format="%Y-%m-%d"), as.Date(dcd_daily_international_wave4$last_cycle_start, format="%Y-%m-%d")))), format="%a %B %d %Y")
})()
last_rep_cycle_date_format = (function(){
max(na.omit(c(as.Date(dcd_baseline_international_wave4$cycle_day1_base, format="%Y-%m-%d"), as.Date(dcd_daily_international_wave4$daily_cycle_day1, format="%Y-%m-%d"), as.Date(dcd_daily_international_wave4$last_cycle_start, format="%Y-%m-%d"))))
})()
si.cycle_start_since_baseline = (function(){
daily_cycle_period_now == 1 && as.numeric(lubridate::today() - as.Date(last_rep_cycle_date_format))>21
})()
si.last_cycle_start = (function(){
cycle_start_since_baseline==2
})()
si.pill_day = (function(){
tail(na.omit(dcd_baseline_international_wave4$contra_type_past), n=1) %contains_word% "HBC" && runif(1) < 0.4
})()
})
})})()

})() }



Ruben Arslan

unread,
May 31, 2021, 3:40:33 AM5/31/21
to Lindsie Arthur-Hulme, formr
Hi Lindsie,

go to your survey sheet for the item health_sleep_qual
In the showif column, there's probably the little accent character that's giving you trouble.
Delete it, update the sheet, and you should be good.

Unparseable argument is just an all-purpose error message when you have somehow entered improper R code in some place. So, it's almost always something you can fix yourself, if you can find the source.

Best,
Ruben

--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/formr/78eb0e9c-75b4-488d-ba66-5ee686e048fan%40googlegroups.com.

Lindsie Arthur-Hulme

unread,
May 31, 2021, 3:42:42 AM5/31/21
to Ruben Arslan, formr
You're a magician! Thanks so much Ruben. 

I swear I've been staring at this thing all day and don't know how I missed it. Yesterday I was stuck because I spelt "consent" incorrectly. 

I'm clearly not practiced at noticing the tiny details. 

Thanks again!
--

Lindsie Catherine

+614 81 846 733

Ruben Arslan

unread,
May 31, 2021, 4:09:35 AM5/31/21
to Lindsie Arthur-Hulme, formr
Perhaps it would be good to collect a few of the most common problems in the FAQ. I now made a start here.

Reply all
Reply to author
Forward
0 new messages