Re: [R] else problem

2011-06-24 Thread Petr PIKAL
Gunter [gunter.ber...@gene.com] Sent: June 23, 2011 8:27 AM To: David Winsemius Cc: Kara Przeczek; r-help@r-project.org Subject: Re: [R] else problem Perhaps some additional clarification... (???) if (length(dat2f$year)%%2==0) { md -dat2f[, list(med_year = max(year[which(abs(tot_km3y

Re: [R] else problem

2011-06-24 Thread David Winsemius
: June 23, 2011 8:27 AM To: David Winsemius Cc: Kara Przeczek; r-help@r-project.org Subject: Re: [R] else problem Perhaps some additional clarification... (???) if (length(dat2f$year)%%2==0) { md -dat2f[, list(med_year = max(year[which(abs(tot_km3y - median(tot_km3y)) == min(abs(tot_km3y - median

[R] else problem

2011-06-23 Thread Kara Przeczek
Dear R users, I have run into a problem using if...else and I hope you can shed some light on it. I am using R version 2.2.0.1. I have the following data frame: head(dat2f) year tot_km3y [1,] 1964 0.1876854 [2,] 1965 0.1835116 [3,] 1966 0.1915012 [4,] 1967 0.1869758 [5,] 1968 0.2249865

Re: [R] else problem

2011-06-23 Thread David Winsemius
On Jun 23, 2011, at 10:59 AM, Kara Przeczek wrote: Dear R users, I have run into a problem using if...else and I hope you can shed some light on it. I am using R version 2.2.0.1. I have the following data frame: head(dat2f) year tot_km3y [1,] 1964 0.1876854 [2,] 1965 0.1835116 [3,]

Re: [R] else problem

2011-06-23 Thread Bert Gunter
Perhaps some additional clarification... (???) if (length(dat2f$year)%%2==0) {  md -dat2f[, list(med_year = max(year[which(abs(tot_km3y - median(tot_km3y)) == min(abs(tot_km3y - median(tot_km3y ]), med_TotQ = median(tot_km3y))]  } else { If this line is executed at a console session

Re: [R] else problem

2011-06-23 Thread Kara Przeczek
it was part of a function and thus would have been executed completely within the function? Cheers, Kara From: Bert Gunter [gunter.ber...@gene.com] Sent: June 23, 2011 8:27 AM To: David Winsemius Cc: Kara Przeczek; r-help@r-project.org Subject: Re: [R] else

Re: [R] else problem

2011-06-23 Thread David Winsemius
Cheers, Kara From: Bert Gunter [gunter.ber...@gene.com] Sent: June 23, 2011 8:27 AM To: David Winsemius Cc: Kara Przeczek; r-help@r-project.org Subject: Re: [R] else problem Perhaps some additional clarification... (???) if (length(dat2f$year)%%2==0) { md