Closed bochocki closed 7 years ago
I'm currently working on a general version of call_update()
that uses string manipulations. I have a working draft of the code that seems to work in most cases; I just need to clean it up and run some tests before integrating it into the browse()
function.
revised the draft code and implemented it in the browse()
function.
Here are details on the update:
call_update
, as we discussed.browse.R
structure
and treatment
, so that:
call_update(substitute(structure == "age" | structure == "size"))
returns
(structured_type_1 == "age" | structured_type_2 == "age" | structured_type_3 == "age" | structured_type_4 == "age") | (structured_type_1 == "size" | structured_type_2 == "size" | structured_type_3 == "size" | structured_type_4 == "size")
&, &&, |, ||, !
==, !=, <=, >=, >, <, %in%
update_call()
function:
identical(call_update(expression(structure == "size" & treatment == "control")),
update_call(substitute(structure == "size" & treatment == "control")))
[1] TRUE
! A == B
syntax> query <- substitute(
treatment == "control"
& !treatment == "burn"
& structure != "size"
| structure =="age"
&!lter_id %in% c(2,3)
&& !lter_id >= 5
| lter_id > 4
& lter_id <=200
& lter_id < 42)
> call_update(query)
[1] (treatment_type_1 == "control" | treatment_type_2 == "control" | treatment_type_3 == "control")
& !(treatment_type_1 == "burn" | treatment_type_2 == "burn" | treatment_type_3 == "burn")
& (structured_type_1 != "size" & structured_type_2 != "size" & structured_type_3 != "size" & structured_type_4 != "size")
| (structured_type_1 == "age" | structured_type_2 == "age" | structured_type_3 == "age" | structured_type_4 == "age")
& !lter_id %in% c(2, 3)
&& !lter_id >= 5
| lter_id > 4
& lter_id <= 200
& lter_id < 42
structure != "size"
gives the output (structured_type_1 != "size" & structured_type_2 != "size" & structured_type_3 != "size" & structured_type_4 != "size")
, which strings structure types together with &
instead of |
. This ensures that no structure types match size.old_browse <- browse(treatment == "fire" & structure == "size")
new_browse <- browse(treatment == "fire" & structure == "size")
identical(new_browse,old_browse)
[1] TRUE
I suggest we delete update_call.R
and close this issue.
also, for call_update()
to work, stringr
needs to be in the list of packages that load with popler.
deleted update_call.R
... I suggest closing this issue once stringr
is in the "Depends" section, since that gets into another issue (this one: https://github.com/AldoCompagnoni/popler/issues/23)
stringr is in DESCRIPTION, so I will close this issue!
Change the name of this function (potentially to
call_update()
). This function currently needs to be improved forstructure
andtreatment
search criteria.Currently, calls such as:
browse(structure == "age" | structure == "size")
fail. This needs to be improved, and tests need to be designed for this function.