I'm trying to learn Nextflow, and struggling to get this simple script to work in R:
echo true
col=Channel.from(2,4)
process getCols {
input:
val WD from "data/"
val col
script:
"""
#!/usr/bin/env Rscript
dat=read.csv(list.files(as.character($WD))
dat[,$col]
"""
}
This returns the following error:
Error executing process > 'getCols (1)'
Caused by:
Process `getCols (1)` terminated with an error exit status (1)
Command executed:
#!/usr/bin/env Rscript
dat=read.csv(list.files(as.character(data/))
dat[,2]
Command exit status:
1
Command output:
(empty)
Command error:
Error: unexpected ')' in "dat=read.csv(list.files(as.character(data/)"
Execution halted
I think the issue is that $WD is not being interpreted as a string. How can I get around this?