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

2012-11-14 Thread arun
2: 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 To: "r

[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 thi

Re: [R] Wildcards

2007-10-15 Thread Prof Brian Ripley
On Mon, 15 Oct 2007, jim holtman wrote: > for (i in list.files(pattern=".*\\.R$")) source(i) Using Sys.glob() is perhaps more natural for most users: for(file in Sys.glob("*.R")) source(file) It is referenced from ?list.files these days. > On 10/15/07, subura <[EMAIL PROTECTED]> wrote: >> >>

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

Re: [R] Wildcards

2007-10-15 Thread jim holtman
for (i in list.files(pattern=".*\\.R$")) source(i) On 10/15/07, subura <[EMAIL PROTECTED]> wrote: > > 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

[R] Wildcards

2007-10-15 Thread subura
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 -- View this message in context: http://www.nabble.com/Wildcards-tf4627981.html#a13214214 Sent from the