[R] R wildcards, sapply and as.factor

2012-11-14 Thread Fg Nu
I want to change the type to factor of all variables in a data frame whose names match a certain pattern. So here I am trying to change the type to factor of all variables whose name begins with namestub in the dataframe df. attach(df)sapply(grep(glob2rx(namestub*),names(df)),as.factor) But this

Re: [R] R wildcards, sapply and as.factor

2012-11-14 Thread arun
# $ namestub2: Factor w/ 2 levels B1,B2: 1 2 1 2 1 2 # $ name1    : chr  A11 A11 A22 A22 ... # $ name2    : chr  B11 B22 B11 B22 ... A.K. - Original Message - From: Fg Nu fgn...@yahoo.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Wednesday, November 14, 2012 6:50 AM Subject: [R] R

Re: [R] Wildcards

2007-10-15 Thread Sundar Dorai-Raj
subura said the following on 10/15/2007 12:04 PM: Care to explain how i can use a wildcard expression to source all files ending with .R in a subdirectory ? I've tried something like this 'source(glob2rx(*.R))' without success. Thank you Try R.files - list.files(my.path, pattern =