Re: [R] Create Strings of Column Id's

2007-07-30 Thread Tom.O

Great, That did the trick,thanks.

regards Tom


jholtman wrote:
 
 Is this what you want:
 
 paste(-, paste(colnames(MyMatrix)[COL], collapse='-'), sep='')
 [1] -E-T
 
 
 On 7/26/07, Tom.O [EMAIL PROTECTED] wrote:

 Does anyone know how this is don?

 I have a large matrix where I extract specific columns into txt files for
 further use. To be able to keep track of which txt files contain which
 columns I want to name the filenames with the column Id's.

 The most basic example would be to use an for() loop together with
 paste(),
 but the result is blank. Not even NULL.

 this is the concept of thecode i use:

 for example

 MyMatrix -
 matrix(NA,ncol=4,nrow=1,dimnames=list(NULL,c(E,R,T,Y)))
 COL - c(1,3) # a vector of columns I want to extract,

 Filename - NULL # the starting variable, so I can use paste
 Filename - for(i in colnames(MyMatrix)[COL])
 {paste(Filename,-,i,sep=)}

 The result is -T, but I want it to be -E-T

 Anyone have a clue?

 Thanks Tom


 --
 View this message in context:
 http://www.nabble.com/Create-Strings-of-Column-Id%27s-tf4153354.html#a11816439
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 
 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390
 
 What is the problem you are trying to solve?
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Create-Strings-of-Column-Id%27s-tf4153354.html#a11859539
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Create Strings of Column Id's

2007-07-26 Thread jim holtman
Is this what you want:

 paste(-, paste(colnames(MyMatrix)[COL], collapse='-'), sep='')
[1] -E-T


On 7/26/07, Tom.O [EMAIL PROTECTED] wrote:

 Does anyone know how this is don?

 I have a large matrix where I extract specific columns into txt files for
 further use. To be able to keep track of which txt files contain which
 columns I want to name the filenames with the column Id's.

 The most basic example would be to use an for() loop together with paste(),
 but the result is blank. Not even NULL.

 this is the concept of thecode i use:

 for example

 MyMatrix - matrix(NA,ncol=4,nrow=1,dimnames=list(NULL,c(E,R,T,Y)))
 COL - c(1,3) # a vector of columns I want to extract,

 Filename - NULL # the starting variable, so I can use paste
 Filename - for(i in colnames(MyMatrix)[COL]) {paste(Filename,-,i,sep=)}

 The result is -T, but I want it to be -E-T

 Anyone have a clue?

 Thanks Tom


 --
 View this message in context: 
 http://www.nabble.com/Create-Strings-of-Column-Id%27s-tf4153354.html#a11816439
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Create Strings of Column Id's

2007-07-26 Thread Tom.O

Does anyone know how this is don?

I have a large matrix where I extract specific columns into txt files for
further use. To be able to keep track of which txt files contain which
columns I want to name the filenames with the column Id's.

The most basic example would be to use an for() loop together with paste(),
but the result is blank. Not even NULL.

this is the concept of thecode i use:

for example

MyMatrix - matrix(NA,ncol=4,nrow=1,dimnames=list(NULL,c(E,R,T,Y)))
COL - c(1,3) # a vector of columns I want to extract,

Filename - NULL # the starting variable, so I can use paste
Filename - for(i in colnames(MyMatrix)[COL]) {paste(Filename,-,i,sep=)}

The result is -T, but I want it to be -E-T

Anyone have a clue?

Thanks Tom


-- 
View this message in context: 
http://www.nabble.com/Create-Strings-of-Column-Id%27s-tf4153354.html#a11816439
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.