[R] Re: A Problem I'm having with R

Peter Malewski malewski.peter at mh-hannover.de
Mon Jul 5 14:21:53 CEST 1999


a hint:

xx <- data.frame(matrix (rnorm(10000),,10))
temp <- attach(xx)
temp<-paste(ls("xx"),".rda",sep="")
for(i in ls("xx"))save(i,file=temp[i])

g.l.
Peter

Martin Maechler wrote:

> Dear Stuart Washington,
>
>   please ask these kind of questions on the mailing list "R-help"
>   to which I am now forwarding.
>   [Read any "CRAN" mirror, e.g. http://lib.stat.cmu.edu/R/CRAN/,
>    to find out on subscribing to R-help
>    or how to access the mailing list archives.]
>
> Regards : Martin Maechler
>
>     StuW> Dear Sir, I'm having a problem getting R to do a particular
>     StuW> action which I know it's likely to be able to perform.  I'm new
>     StuW> to programming so I know the answer to this question could range
>     StuW> from the very simple to the very complex, but here goes:
>
>     StuW>       I have a while loop which, in each of its iterations, is
>     StuW> supposed to reassign a filename with a number at the end.  I'll
>     StuW> illustrate below:
>
>     StuW> M<-function(n,...)
>     StuW> {
>     StuW>  while(n > 0)
>     StuW>  {
>     StuW>     fn.[n]<-sample(...)
>     StuW>     ###Here, a number n is supposed to be appended to the end of
>     StuW>     ###a filename fn
>     StuW>     n <- n-1
>     StuW>     ###Here, the value of n is decremented by one
>     StuW>  }
>     StuW>  c(fn.[1:n])
>     StuW>  ###Here, all filenames created from the loop which have a number
>     StuW>  at the end ranging from 1 through whatever number n is assigned
>     StuW>  to (obviously n MUST be an interger) are concatenated into one
>     StuW>  matrix.
>     StuW> }
>
>     StuW>     I am fully aware that what I've written above has no
>     StuW> chance in hell of working in R.  Somehow, there must be a command
>     StuW> which will allow me to assign numbers to the end of a file name
>     StuW> for each loop iteration. And then a command which will allow me
>     StuW> to concatenate them all together.  If you don't have the time to
>     StuW> answer this directly, just point me in the direction of a command
>     StuW> that will do so.
>
>     StuW> Thank you for your time,
>     StuW> Stuart z Washington
> ------- End of forwarded message -------
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

--



---------------------------------------------------
* P. Malewski
* Hannover Medical School
* Department of Psychosomatics and Psychotherapy
* Carl-Neuberg-Str. 1
* Tel.:+49 511 532 3194
* Fax.:+49 511 532 3190
---------------------------------------------------


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list