Re: [R] automatically generate the output name of my "for" loops

2011-06-19 Thread jiliguala
true, it did work using unlist() funciton, it can be found the minimum value. and for further step, if i want identify the minimum value with the list, which means the minimum value i have found is belonged to which list[[j]][[i]]. i used the codes like this ##which(list1==min(list1))## but

Re: [R] automatically generate the output name of my "for" loops

2011-06-14 Thread Greg Snow
in Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of jiliguala > Sent: Tuesday, June 14, 2011 4:24 PM > To: r-help@r-project.org > Subject: Re: [R] automatically genera

Re: [R] automatically generate the output name of my "for" loops

2011-06-14 Thread jiliguala
thanks, Greg Snow-2. here i hav a question, how can i save the value of a list to a vector or a matrix? say, i have a list (data1) and a vector or a matrix (data2). if i made like this, data2 <- as.vector(data1) it does not change anything, the data2 is still a list. what i want to do is to c

Re: [R] automatically generate the output name of my "for" loops

2011-06-14 Thread Greg Snow
uala > Sent: Tuesday, June 14, 2011 4:14 PM > To: r-help@r-project.org > Subject: Re: [R] automatically generate the output name of my "for" > loops > > > hi, im a new in R and this forum, so if there is something disturbing > u, im > gonna do it better. >

Re: [R] automatically generate the output name of my "for" loops

2011-06-14 Thread jiliguala
hi, im a new in R and this forum, so if there is something disturbing u, im gonna do it better. by the way, where can i see the FAQ 7.21?? thanks.. -- View this message in context: http://r.789695.n4.nabble.com/automatically-generate-the-output-name-of-my-for-loops-tp3592160p3597987.html Sent

Re: [R] automatically generate the output name of my "for" loops

2011-06-14 Thread Greg Snow
t; To: r-help@r-project.org > Subject: [R] automatically generate the output name of my "for" loops > > > Hello R users, > > I am new to R and am having difficulty with the output name of my "for" > loops. > > here is the problem: > > >

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread jiliguala
hi, jholtman its true, the problem was to iniciate the list at the second level. thx a lot -- View this message in context: http://r.789695.n4.nabble.com/automatically-generate-the-output-name-of-my-for-loops-tp3592160p3594397.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread jim holtman
If you want to have multidimensioned list, here is one way of doing it by making sure you initialize the second level before using it: data2 <- matrix(1:30, nrow = 10) data3 <- matrix(1:300, nrow = 100) data1 <- list() # init to a list for (j in 1:10){ data1[[j]] <- list() #create second

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread jiliguala
hi, really thank u, Petr Pikal problem solved already. but here is another question: for(i in 1:100) data1[[i]] <- rbind(data2[1,], data3[i,]) the codes above are no problem, but now i wnna do two loops like the codes below which have problem(the bold letters): i dont know what should be put

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 17:35:29: > jiliguala > > really thanks for helping. > > i just did just like what Petr Pikal said, > but it appeared some error like this: > > There were 50 or more warnings (use warnings() to see the first 50): > > Warning messages: >

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread Vijayanpadmanabhan
Hi Daniel Try using this approach ##Drawing analogy from your example.. I am storing the values generated in a loop in the following code for (i in c(1:100)) { nam <- paste("r",i, sep=".") assign(nam, i+1) } ##Having stored the values generated in the above loop in as many R objects..

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread jim holtman
I think you need '[[' group[[i]] <- which(k1$cluster == i) On Mon, Jun 13, 2011 at 11:35 AM, jiliguala wrote: > really thanks for helping. > > i just did just like what Petr Pikal said, > but it appeared some error like this: > > There were 50 or more warnings (use warnings() to see the first 50

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread jiliguala
really thanks for helping. i just did just like what Petr Pikal said, but it appeared some error like this: There were 50 or more warnings (use warnings() to see the first 50): Warning messages: 1: In group[i] <- which(k1$cluster == i) : number of items to replace is not a multiple of replacem

Re: [R] automatically generate the output name of my "for" loops

2011-06-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.06.2011 05:21:23: > Re: [R] automatically generate the output name of my "for" loops > > ?paste > something like... > paste (group, i, sep="_") > I believe that better idea is to use list, with which you c

Re: [R] automatically generate the output name of my "for" loops

2011-06-12 Thread B77S
?paste something like... paste (group, i, sep="_") jiliguala wrote: > > Hello R users, > > I am new to R and am having difficulty with the output name of my "for" > loops. > > here is the problem: > > > for (i in c(1:100)) > { > the name of the groups <- which(k1$cluster==i) > } > > how

Re: [R] automatically generate the output name of my "for" loops

2011-06-12 Thread B77S
?paste something like... paste ("group", i, sep="_") jiliguala wrote: > > Hello R users, > > I am new to R and am having difficulty with the output name of my "for" > loops. > > here is the problem: > > > for (i in c(1:100)) > { > the name of the groups <- which(k1$cluster==i) > } > > ho

[R] automatically generate the output name of my "for" loops

2011-06-12 Thread jiliguala
Hello R users, I am new to R and am having difficulty with the output name of my "for" loops. here is the problem: for (i in c(1:100)) { the name of the groups <- which(k1$cluster==i) } how can it automatically generate the name for 100 cluster? what should i put in the bold letter place.