On Tue, Aug 28, 2012 at 8:19 AM, Rantony <antony.akk...@ge.com> wrote:
> Here i have a variable
>
> MyVar <- data.frame(read.csv("D:\\Doc.csv"))

read.csv() returns a data.frame so the outer call to data.frame() is
superfluous.

>
> And now i am storing this variable name into  a list.
>
> MyList <- list()
> MyList [length(MyList )+1]<- "MyVar"
>
> Now what is the requirement is,
>  i need to call the variable name "MyVar" from the list "MyList " and get
> the data.
> ------------------------------------------------------------------------------------------------------------------------
> i tried with get(MyList [1]). - it not work-out.

Close:

You want

get(MyList)[1]

which gets the variable "MyList" -- else you are telling R to look for
something called "MyList[1]" which is a rare, but not actually
impossible object name.

As before, you really don't want to be using get() and assign() for
this sort of stuff though.

Please do try to do things the idiomatic way: it'll be easier in the
long run : I promise.

Cheers,
Michael
>
> Can you please help me ?
>
> - Thanks in advance
> Antony.
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Get-variable-data-Reading-from-the-list-tp4641559.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> 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.

______________________________________________
R-help@r-project.org mailing list
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