[R] Fill down a new column in data frame with a number

S Ellison S@E|||@on @end|ng |rom LGCGroup@com
Thu May 10 15:52:37 CEST 2018

> I am traying to create a a column in my data frame  filled down with a
> number.
> > df$newcolumn <-  number
> How can I do it? I am considering use rep() but in this case it is
> necessary know the number of rows in each data base that I have and I would
> like to do it in a faster ( and more  elegant) way.

dframe$newcol <- rep(n, nrow(dframe))

- 'df' is the density for the F distribution; safer to avoid giving data names of functions;
- 'nrow' returns the number of rows in an existing data frame or other object with dimensions.

This email and any attachments are confidential. Any use...{{dropped:8}}

More information about the R-help mailing list