[R] print dataframe names in loop
David Winsemius
dwinsemius at comcast.net
Fri May 15 19:02:43 CEST 2015
On May 15, 2015, at 5:05 AM, Kai Mx wrote:
> Hi everybody,
>
> I just can't figure this out:
>
> I have a loop trough several dataframes such as
>
> for (df in list(df1, df2, df3, ...)) {
> ..some functions with df..
> }
>
> now I want to print out the current dataframes name (ie the list items
> name) with the cat command before the actual functions to have better
> orientation in the output.
> However, I haven't been successful with different variations of deparse(),
> substitute(), (cat(substitute(df)) gives me 'df' for the whole loop).
You were close. Try:
deparse(substitute(df))
>
> Could somebody please enlighten me?
>
> Thanks so much!
>
> Best,
>
> Kai
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list