[R] Simple Question

Berend Hasselman bhh at xs4all.nl
Fri Sep 28 19:00:24 CEST 2012


On 28-09-2012, at 18:40, Bhupendrasinh Thakre <vickythakre at gmail.com> wrote:

> Hi Everyone,
> 
> Sorry for coming back again with a new problem.
> Editing question, session info and data so you don't have to scroll till
> the end of page.
> 
> *Situation :*
> 
> I have a data frame and it's name is df. Now I want to add Time Stamp to
> the end of *"name" of "data Frame" i.e. "df_system_time"*. Previously it
> was running great and thanks to Dr. Winsemius , Kimmo and Pascal and I
> believe as the function which i used was scalar.
> 
> *Data :*
> 
> dput(df)structure(list(x = 1:10, y = 1:10), .Names = c("x", "y"),
> row.names = c(NA,
> -10L), class = "data.frame")
> 

You have been given the answer.
It only needs a minor variation:

newname.df <- paste0("df_", format(Sys.time(), "%Y_%m_%d_%H_%M_%S") )
assign(newname.df,df)

and if you wish

rm(list=c('df','newname.df'))

Or install package memisc (found by doing findFn("rename") from package sos) and use function rename(0; I have not tried this.

Berend



More information about the R-help mailing list