[datatable-help] create empty data.table

Frank Erickson fperickson at wisc.edu
Thu Jul 23 20:37:58 CEST 2015


I think you know how to make a wrapper. Consider something like

setDT(setnames(lapply(coltypes,function(x){ if (x=="char")
return(character(0)); if (x=="numeric") return(numeric(0))}),colnames))

On Thu, Jul 23, 2015 at 2:34 PM, statquant3 <statquant at outlook.com> wrote:

> Doing DT <- data.table(date=Sys.Date()[0],id=character(0),value=numeric(0))
> is exactly what I want to do... programatically.
> I just want to provide column names and type of columns...
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/create-empty-data-table-tp4710237p4710261.html
> Sent from the datatable-help mailing list archive at Nabble.com.
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20150723/2397b48b/attachment.html>


More information about the datatable-help mailing list