[R] multiple variables pointing to single dataframe?
Alex Bryant
abryant at i-review.com
Mon Apr 19 16:15:57 CEST 2010
Hi, for example:
> x <- Orange
> x2 <- x
> x[1,]$age <- 50
> x2[1,]
Tree age circumference
1 1 118 30
I would like a way for x2 to also reference the modified x data frame without having to reassign x2<x each time x is modified.
Thanks,
Alex
-----Original Message-----
From: Petr PIKAL [mailto:petr.pikal at precheza.cz]
Sent: Monday, April 19, 2010 3:18 AM
To: Alex Bryant
Cc: r-help at r-project.org
Subject: Odp: [R] multiple variables pointing to single dataframe?
Hi
r-help-bounces at r-project.org napsal dne 16.04.2010 16:15:40:
> Hi, I have a need to have 2 variables point to the same dataframe (d1),
I
What does it mean to point to data frame? Seems to me that it is something
from C+.
You can reference data frame by $ or by square brackets with as many
variables as you want.
see
?"["
regards
Petr
> don't want to simply copy the dataframe ( d2<-d1 ) as my understanding
is that
> this will create a second dataframe. Any suggestions on best practice
here?
>
> Thank You,
>
> //************************
> // Alex Bryant
> // Software Developer
> // Integrated Clinical Systems, Inc.
> // 908-996-7208
>
>
> ________________________________
> Confidentiality Note: This e-mail, and any attachment
to...{{dropped:13}}
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list