Re: [R] help with function "system" and MS-DOS command TYPE

From: Vladimir Eremeev <wl2776_at_gmail.com>
Date: Wed 31 Jan 2007 - 11:36:23 GMT

Chen, Xiao wrote:
>
> Greetings -
>
> I have a quick question that I hope someone will have a quick answer. I
> have tried to use the R function "system" with the MS-DOS command "type"
> to display the full content of a text file. But it always returns with a
> message saying the text file is not found. I could accomplish the same
> task with the "cat" command which is one of the unix-like commands that
> I have installed on my windows machine. But I would like to know how it
> would work with the "type" command.
>
> Here is what I have tried:
>

>> zz<-file("d:/work/test/test.txt", "w")
>> cat("this is a test\n", file=zz)
>> close(zz)
>> system("cat test.txt", show.output.on.console=T)

> this is a test
>> system("type test.txt", show.output.on.console=T)

> test.txt not found
>

type is an internal command, rather than an executable file

use
system("cmd /c type test.txt", show.output.on.console=T) or
system("command /c type test.txt", show.output.on.console=T)

-- 
View this message in context: http://www.nabble.com/-R--help-with-function-%22system%22-and-MS-DOS-command-TYPE-tf3146629.html#a8727428
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed Jan 31 22:40:51 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 31 Jan 2007 - 14:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.