I am following a protocol for running DESeq2 and get an error message in collapsing the initial table (sri) to one row per sample. The command is the following:
> for(i in seq_len(nrow(samples))) {rw = (sri$LibraryName == samples$LibraryName[i]) if (samples$LibraryLayout[i] == "PAIRED") { samples$fastq1[i] = paste0(sri$Run[rw],"_1.fastq",collapse=",") samples$fastq2[i] = paste0(sri$Run[rw],"_2.fastq",collapse=",") } else { samples$fastq1[i] = paste0(sri$Run[rw],".fastq",collapse=",") samples$fastq2[i] = "" }
The error message is in the 'if' argument:
Error: unexpected 'if' in "for(i in seq_len(nrow(samples))) {rw = (sri$LibraryName == samples$LibraryName[i]) if"
I don't know much about R language so any help would be wellcome.
Fernando
hi,
This code isn't from DESeq2 materials, so I'm taking off the DESeq2 tag, and renaming to "R script problem"