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. Than

[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 https://stat.ethz.ch/mailman/listinfo/

[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 https://stat.ethz.ch/mailman/listinfo/

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 ran

[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] Indexes on dataframe columns?

2007-10-25 Thread Ranjan Bagchi
Hi -- I'm working with some data frames with fairly high nrows (call it 8 columns, by 20,000 rows). Are there any indexes on these columns? When I do a df[df$foo == 42,] [which I think is idiomatic], am I doing a linear search or something better? If the column contents is ordered, I'd like

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 pr

[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