[datatable-help] Avoiding print when using := ?
Allan Engelhardt
allane at cybaea.com
Thu Sep 13 23:48:46 CEST 2012
Ooops, I guess this is FAQ 2.22. But what is the preferred idiom for
those of us who want to avoid the print?
Allan
On 13/09/12 22:16, Allan Engelhardt wrote:
> Is there any way of tuning off the printing when using the :=
> assignment? I have taken to writing code like
>
> library("data.table")
> DT <- data.table(idx = 1:10, key = "idx")
> for (i in 1) { # Avoid default print
> DT[, v := runif(idx)]
> }
>
> just to avoid cluttering my screen. I could of course wrap it in
> invisible() instead, though I am not sure that makes for much cleaner
> code, or use
>
> DT$v <- with(DT, runif(idx))
>
> when adding new columns. But I thought := was clever and used an
> overallocation trick, and I of course wanted to benefit from this.
>
> Allan
>
>
> _______________________________________________
> 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
>
More information about the datatable-help
mailing list