On 15/09/16 14:04, S Ellison wrote:
If you want
to add variable to data.frame you have to use attach, detach. Right?
I'd have said "not at all", not "not quite". attach and detach have
almost exactly nothing to do with adding to a data frame. You can add
to a data frame using dfrm$newvar <-
>If you want
> to add variable to data.frame you have to use attach, detach. Right?
I'd have said "not at all", not "not quite". attach and detach have almost
exactly nothing to do with adding to a data frame.
You can add to a data frame using
dfrm$newvar <-
dfrm['newvar'] <-
cbind(dfrm,
On 14/09/2016 2:40 PM, jeremiah rounds wrote:
"If you want to add variable to data.frame you have to use attach, detach.
Right?"
Not quite. Use it like a list to add a variable to a data.frame
e.g.
df = list()
df$var1 = 1:10
df = as.data.frame(df)
df$var2 = 1:10
df[["var3"]] = 1:10
df
df = as.
There is also this syntax for adding variables
df[, "var5"] = 1:10
and the syntax sugar for row-oriented storage:
df[1:5,]
On Wed, Sep 14, 2016 at 11:40 AM, jeremiah rounds
wrote:
> "If you want to add variable to data.frame you have to use attach, detach.
> Right?"
>
> Not quite. Use it like
"If you want to add variable to data.frame you have to use attach, detach.
Right?"
Not quite. Use it like a list to add a variable to a data.frame
e.g.
df = list()
df$var1 = 1:10
df = as.data.frame(df)
df$var2 = 1:10
df[["var3"]] = 1:10
df
df = as.list(df)
df$var4 = 1:10
as.data.frame(df)
Ironi
thanks for all the answers. I think also ggplot2 requires data.frames.If you
want to add variable to data.frame you have to use attach, detach. Right?Any
more links that discuss thoe two different approaches?Alex
On Wednesday, September 14, 2016 5:34 PM, Bert Gunter
wrote:
This is par
This is partially a matter of subjectve opinion, and so pointless; but
I would point out that data frames are the canonical structure for a
great many of R's modeling and graphics functions, e.g. lm, xyplot,
etc.
As for mutate() etc., that's about UI's and user friendliness, and
imho my ho is mean
> On Sep 14, 2016, at 8:01 AM, Alaios via R-help wrote:
>
> Hi all,I have seen data.frames and operations from the mutate package getting
> really popular. In the last years I have been using extensively lists, is
> there any reason to not use lists and use other data types for data
> manipul
Hi all,I have seen data.frames and operations from the mutate package getting
really popular. In the last years I have been using extensively lists, is there
any reason to not use lists and use other data types for data manipulation and
storage?
Any article that describe their differences? I wou
9 matches
Mail list logo