[R] using wc-w (unix) in R on cluster

Juliet Hannah juliet.hannah at gmail.com
Sun Nov 30 18:27:34 CET 2008


This command

rows <- as.numeric(system(paste("wc -l < /path/myFile.txt",sep=""), TRUE))

works when used directly in R and when I put it inside a shell script
and submit it to the cluster.

This command

columns <- as.numeric(system(paste("head -1 < /path/myFile.txt | wc
-w",sep=""), TRUE))

works when used in R, however is not working when I submit it.

I am using these commands to count the number of rows and columns on a
large file.

Any suggestions?

Thanks,

Juliet



More information about the R-help mailing list