[R] System exit codes

2008-07-30 Thread Ranjan Bagchi
Hi -- Is there a way of detecting the exit code while calling system or pipe? eg (on Unix) system(perl -e 'print \foo\\\n\;exit(-1);') foo Any help appreciated, Ranjan __ R-help@r-project.org mailing list

[R] System exit codes

2008-07-30 Thread Ranjan Bagchi
Hi -- Is there a way of detecting the exit code while calling system or pipe? eg (on Unix) system(perl -e 'print \foo\\\n\;exit(-1);') foo Any help appreciated, Ranjan __ R-help@r-project.org mailing list

Re: [R] System exit codes

2008-07-30 Thread Ranjan Bagchi
Thank you -- I missed the bit about the invisible attribute. Can this happen with pipe, as well? x = readLines(pipe(perl -e 'print \foo\\\n\;exit(-1);')) x [1] foo I'd want to know that the command failed so I can process x differently. Thanks again, Ranjan Bagchi On Wed, 30 Jul 2008, Prof

Re: [R] newbie lapply question

2007-12-05 Thread Ranjan Bagchi
On Wed, 5 Dec 2007, Prof Brian Ripley wrote: [...] Thanks I'll read it more carefully. Perhaps if you told us what you are trying to achieve we might be able to help you achieve it. I have a function which takes a date as an argument. I've tested it, and I'd like to run it over a range

[R] newbie lapply question

2007-12-05 Thread Ranjan Bagchi
Hi -- I just noticed the following (R 2.6.1 on OSX) lapply(c(as.Date('2007-01-01')), I) [[1]] [1] 13514 This is a bit surprising.. Why does lapply unclass the object? Sorry for such a basic question, I don't seem able to produce the right google keywords. Ranjan

[R] Idioms for empty dataframes

2007-10-01 Thread Ranjan Bagchi
I'm fairly new to R, coming from a programming background -- it's quite nice to work with dataframes, though, as opposed to explicit iteration. One thing I've found, which is surprising is that zero-length dataframes seem to cause errors: t - data.frame(bob=c(100)) order(t$bob) [1] 1 t1 -

Re: [R] Odp: Idioms for empty dataframes

2007-10-01 Thread Ranjan Bagchi
Thanks... that's very helpful. Sorry about the typo too t1 - t[t$bob 50, ,drop=F] t1 [1] bob 0 rows (or 0-length row.names) order(t$bob) [1] 1 On Mon, 1 Oct 2007, Petr PIKAL wrote: Hi [EMAIL PROTECTED] napsal dne 01.10.2007 18:01:13: I'm fairly new to R, coming from a programming