You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
<
8000
link rel="modulepreload" href="https://github.githubassets.com/assets/tz7-c03b4585a4da8ff7.js" crossorigin="anonymous" />
For keeping track, I spend a few hours trying to identify the error "invalid 'subset' argument!". The error occurs when rendering a R MarkDown file. It does raise when running the RMD chunk by chunk, nor when extracting and excuting the script from the RMD.
Finally, adding an output file for the try() function (options(try.outFile = "totototot")), reveals that
Error in filter(keys, !!enquo(subset)) :
ℹ In argument: `list(`$FIL` = fcs_file)`.
Caused by error:
! `..1` must be a logical vector, not a list.
Before using a list, I passed the fcs_file directly, but it also failed.
In the future, it would be great that the error catching returns the original message.
It works in interactive mode (script or RMD) when fcs_file is a string and contains a valid FCS file name. It fails when knitting.
What subset should look like when it is supposed to be a argument for the filter() function?
The problem occurs because knitting creates its own environment and is not using the .GlobalEnv that is used when executing the code chunk by chunk.
To solve the invalid subset error, I have the option to use more rlang, which I am not familiar with. inject() encompass the execution in a new environment where variables are evaluated first, as far as I understand.
# ii is the subset of indices targetting the FCS files of interest
inject(gs1 <- CytoML::flowjo_to_gatingset(
ws, subset = !!ii, path = dirname(wsp_path), name = fj_group, execute = TRUE))
I feel the current way to code leads to ugly solution and not easy ot read code. And I dislike the fact that my code should be adapted although it is perfectly correct. It seems that rlang introduced !! and inject() specifically to fix the problems that rlang itself created. Sorry, but this wastes my time and I don't adhere to this stuff.
Activity
SamGG commentedon Mar 17, 2026
my command is
It works in interactive mode (script or RMD) when fcs_file is a string and contains a valid FCS file name. It fails when knitting.
What subset should look like when it is supposed to be a argument for the filter() function?
SamGG commentedon Mar 18, 2026
The problem occurs because knitting creates its own environment and is not using the .GlobalEnv that is used when executing the code chunk by chunk.
To solve the invalid subset error, I have the option to use more rlang, which I am not familiar with. inject() encompass the execution in a new environment where variables are evaluated first, as far as I understand.
I feel the current way to code leads to ugly solution and not easy ot read code. And I dislike the fact that my code should be adapted although it is perfectly correct. It seems that rlang introduced !! and inject() specifically to fix the problems that rlang itself created. Sorry, but this wastes my time and I don't adhere to this stuff.
In the end, I force knitting in the .GlobalEnv environment. Not perfect, but acceptable to me. Rmarkdown is more important to me than a so-called "better coding".
https://stackoverflow.com/questions/49755766/r-studio-how-to-load-a-variable-into-the-global-environment-by-running-a-knitr