Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-26 Thread arun
y by: dat1$t.tr<- as.character(dat1$t.tr) A.K. - Original Message - From: "Fethe, Michael" To: Dennis Murphy ; "R-help@r-project.org" Cc: Sent: Monday, August 26, 2013 8:45 AM Subject: Re: [R] If else loop problem: the condition has length > 1 and only

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-26 Thread Fethe, Michael
689 -43.47 645.53 > #4 Pto 72 624 -68.17 555.83 > #5 Pto 72 666 -68.17 597.83 > #6 Pto 24 620 -29.39 590.61 > > > #or ?merge() > > A.K. > > > > > - Original Message - > From: Bert Gunter > To: arun > Cc: &q

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-26 Thread Fethe, Michael
a-j)? This code produces : In Ops.factor(signal2, 10.465507) : - not meaningful for factors Thanks for the input. ________________ From: Dennis Murphy Sent: Monday, August 26, 2013 4:59 AM To: Fethe, Michael Subject: Re: [R] If else loop problem: the condition has length > 1 and

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-26 Thread PIKAL Petr
nces@r- > project.org] On Behalf Of arun > Sent: Monday, August 26, 2013 8:32 AM > To: Fethe, Michael > Cc: R help > Subject: Re: [R] If else loop problem: the condition has length > 1 and > only the first element will be used > > HI, > > It may be better to provide

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-26 Thread arun
Cc: "Fethe, Michael" ; R help Sent: Monday, August 26, 2013 10:09 AM Subject: Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used Suggestion: Don't do the ifelse stuff below. See ?switch  instead. -- Bert On Sun, Aug 25, 2013 at 1

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-26 Thread Bert Gunter
Suggestion: Don't do the ifelse stuff below. See ?switch instead. -- Bert On Sun, Aug 25, 2013 at 11:32 PM, arun wrote: > HI, > > It may be better to provide an example dataset using ?dput(). > dput(head(dataset),20) > > Try: > signal3<- ifelse(t.tr=="Pst 24", signal2-17.29, ifelse(t.tr=="Pst

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-25 Thread arun
HI, It may be better to provide an example dataset using ?dput(). dput(head(dataset),20) Try: signal3<- ifelse(t.tr=="Pst 24", signal2-17.29, ifelse(t.tr=="Pst 48", signal2 - 43.93256, etc.)) A.K. - Original Message - From: "Fethe, Michael" To: "r-help@r-project.org" Cc: Sent:

Re: [R] if else loop

2011-07-05 Thread Sarah Goslee
Hi Gary, A solution in two pieces. First, you need to be able to match the rows of your data frame. There might be a more elegant way to do it, but I couldn't think of one that gave the option of ordering or not, so I wrote a function: isin <- function(dd, tomatch, ordered=TRUE) { # find toma