[R] multiple variables pointing to single dataframe?
abryant at i-review.com
Mon Apr 19 16:15:57 CEST 2010
Hi, for example:
> x <- Orange
> x2 <- x
> x[1,]$age <- 50
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.
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?
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),
What does it mean to point to data frame? Seems to me that it is something
You can reference data frame by $ or by square brackets with as many
variables as you want.
> don't want to simply copy the dataframe ( d2<-d1 ) as my understanding
> this will create a second dataframe. Any suggestions on best practice
> Thank You,
> // Alex Bryant
> // Software Developer
> // Integrated Clinical Systems, Inc.
> // 908-996-7208
> Confidentiality Note: This e-mail, and any attachment
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help