Re: [R] Applying a user-defined function

2013-01-09 Thread arun
     #   TRUE   TRUE   TRUE Hope it helps. A.K. - Original Message - From: "Muhuri, Pradip (SAMHSA/CBHSQ)" To: R help Cc: Sent: Tuesday, January 8, 2013 10:06 PM Subject: Re: [R] Applying a user-defined function Hello List, Last ti

Re: [R] Applying a user-defined function

2013-01-09 Thread arun
1:5? levels(test2[,8]) #[1] "[76.2,79.2]" "(79.2,80.5]" "(80.5,81.9]" "(81.9,83.5]" "(83.5,85]"   as.numeric(test2[,7])  #[1] 2 5 3 2 3 5 5 4 4 3 3 2 1 3 2 1 1 4 2 5 4 5 3 3 1 1 5 1 4 5 4 5 4 3 1 2 1 4 #[39] 4 5 2 1 2 1 1 5 3 4 3 2 2 A.K. -

Re: [R] Applying a user-defined function

2013-01-08 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello List, Last time, Arun's following solution worked to create 3 new columns (1,3,5). Now how would I tweak this function to create corresponding (additional) columns (7,8,9) of mode factor (levels = 1,2,3,4,5)? Thanks for your continued support. Pradip ### cut and paste from the rep

Re: [R] Applying a user-defined function

2013-01-08 Thread David Winsemius
On Jan 8, 2013, at 9:11 AM, Muhuri, Pradip (SAMHSA/CBHSQ) wrote: Hello List, My goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message. #now Write a new function using the above