Much thanks, Hadley!
Cheers,
Alan
On Jan 29, 2015, at 12:36 PM, Hadley Wickham wrote:
> On Thu, Jan 29, 2015 at 11:43 AM, Alan Yong wrote:
>> Much thanks to everyone for their recommendations! I agree that fishing in
>> the global environment isn't ideal & only shows my budding understanding
On Thu, Jan 29, 2015 at 11:43 AM, Alan Yong wrote:
> Much thanks to everyone for their recommendations! I agree that fishing in
> the global environment isn't ideal & only shows my budding understanding of R.
>
> For now, I will adapt Chel Hee's "length(eval(parse(text=DFName))[,1])"
> solution
Much thanks to everyone for their recommendations! I agree that fishing in the
global environment isn't ideal & only shows my budding understanding of R.
For now, I will adapt Chel Hee's "length(eval(parse(text=DFName))[,1])"
solution then fully explore Jeff's suggestion to put the data frames
ubject: Re: [R] Passing a Data Frame Name as a Variable in a Function
I like Jeff's comments on the previous post.
Regarding Alan's question, please see the following example.
> df.1 <- data.frame(v1=1:5, v2=letters[1:5])
> df.2 <- data.frame(v1=LETTERS[1:3], v2=11:13)
>
I like Jeff's comments on the previous post.
Regarding Alan's question, please see the following example.
> df.1 <- data.frame(v1=1:5, v2=letters[1:5])
> df.2 <- data.frame(v1=LETTERS[1:3], v2=11:13)
> DFName <- ls(pattern = glob2rx("df.*"))[1]
> DFName
[1] "df.1"
> length(DFName[,1])
Error in D
On 29 Jan 2015, at 07:34 , Jeff Newmiller wrote:
> This approach is fraught with dangers.
>
> I recommend that you put all of those data frames into a list and have your
> function accept the list and the name and use the list indexing operator
> mylist[[DFName]] to refer to it. Having functi
This approach is fraught with dangers.
I recommend that you put all of those data frames into a list and have your
function accept the list and the name and use the list indexing operator
mylist[[DFName]] to refer to it. Having functions that go fishing around in the
global environment will be
7 matches
Mail list logo