[R] saving a character vector

Dominik Heier dominik.heier at uni-bielefeld.de
Sun Feb 5 01:10:09 CET 2006


Sorry. Forget my last post. I seem to be brain dead. Going to bed now
(its late in Germany). Sorry again.. 



Am Sonntag, den 05.02.2006, 00:56 +0100 schrieb Dominik Heier:
> Am Samstag, den 04.02.2006, 17:46 -0600 schrieb Taka Matzmoto:
> > Hi R users
> > 
> > I wrote a function that generates some character strings.
> > 
> > generate.index<-function(n.item){
> > for (i in 1:n.item)
> >     {
> >         for (j in ((i+1):n.item))
> >             {
> >                 
> > cat("i",formatC(i,digits=2,flag="0"),".",formatC(j,digits=2,flag="0"),"\n",sep="")
>    ^
> replace "cat" with "return"
    ^
WRONG!! Append it to an array or list and return it at the end of the
function (wich R does by its self)


> >             }
> > 
> >     }
> >                                 }
> > 
> > I like to save what appears on the screen when I run using 
> > generate.index(10) as a character vector
> > 
> > I used
> > temp <- generate.index(10)
> > 
> > but it didn't work.
> > 
> > Could you provide some advice on this issue?
> > 
> > Thanks in advance
> > 
> > TM
> > 
> > ______________________________________________
> > R-help at 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
> 
> ______________________________________________
> R-help at 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




More information about the R-help mailing list