You never said how you wanted to save the data, so I will choose to use
'saveRDS' which should handle most anything.

for (i in name_file$names){
    saveRDS(prep(z, i),  file = paste0(i, '.RDS'))
}



Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Wed, Jul 1, 2015 at 2:07 PM, Lida Zeighami <lid.z...@gmail.com> wrote:

> I have 682 variables in a data frame , and a function that  I should feed
> 682 variables in this function one by one and each time save the file as a
> special name!
> for emaple:
> my data frame file includes 682 names :
> 1  aaa
> 2  bbb
> 3  dfdsfg
> 4 fghh
> .
>
> 682 fgfhg
> and a function like prep(Z, aaa, .....) and each time I should change the
> variable name in this function and read the variable from the data frame
> and each time I should save the file as a special name such as:
>
> prep1<- prep(z, aaa,...)
> prep2<- prep(z, bbb,...)
> prep3<- prep(z, dfdsfg,..)
> Prep4<- prep(z, fghh,...)
>
> How can I use loop function in R to that?
>
> Thanks
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to