Clever solution. I use paste alot and didn't think to use it for this
problem. Thanks!
--
View this message in context:
http://r.789695.n4.nabble.com/Linux-System-Function-tp2063058p2063113.html
Sent from the R help mailing list archive at Nabble.com.
___
On Apr 23, 2010, at 6:07 PM, Ryan Garner wrote:
>
> How do I pass a filename as an argument to the system command to count the
> number of records in that file? I only know how to do it by hardcoding it.
>
> HARDCODING EXAMPLE
>> test <- matrix(1:20,ncol=5)
>> write(x = test,file = "test.txt")
>
How do I pass a filename as an argument to the system command to count the
number of records in that file? I only know how to do it by hardcoding it.
HARDCODING EXAMPLE
> test <- matrix(1:20,ncol=5)
> write(x = test,file = "test.txt")
> records <- as.numeric(system("cat test.txt | wc -l",intern =
3 matches
Mail list logo