[R] Adding a column to an **empty** data.frame

S Ellison S.Ellison at LGCGroup.com
Wed Nov 2 15:07:49 CET 2016


> Now, how can I add a third column name to that empty df?
You could use functions that generate zero-length objects. Examples:


df$newv <- vector(mode="numeric") #logical by default, so <-vector() would give you a zero-length logical

df$newi <- integer()

df$newf <- factor()


S Ellison



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



More information about the R-help mailing list