You could use transform() instead of [[<- to add columns to your data.frame
so the new columns get transformed they way they do when given to the
data.frame function itself. E.g.,
> dd <- data.frame(X=1:5, Y=11:15)
> str(transform(dd, Z=matrix(X+Y,ncol=1,dimnames=list(NULL, "NewZ"
'data.frame
> On Apr 23, 2016, at 8:59 AM, thomas mann wrote:
>
> I am attempting to add a calculated column to a data frame. Basically,
> adding a column called "newcol2" which are the stock closing prices from 1
> day to the next.
>
> The one little hang up is the name of the column. There seems to be
I am attempting to add a calculated column to a data frame. Basically,
adding a column called "newcol2" which are the stock closing prices from 1
day to the next.
The one little hang up is the name of the column. There seems to be an
additional data column name included in the attributes (dimnam
3 matches
Mail list logo