[R] Create a data.table by looping over variable names

Matteo Richiardi matteo.richiardi at gmail.com
Wed Dec 16 15:03:38 CET 2015


Hi,
thanks a lot to everybody for your help. Very nice suggestions!
Matteo

On 16 December 2015 at 12:53, Matteo Richiardi <matteo.richiardi at gmail.com>
wrote:

> I apologise for this very basic question, but I found no answers on the
> web.
> I want to create a data.table with n columns, named i1 ... i'n', with only
> one row with value = 100 for every variable.
>
> I can do it "by hand":
>
> M.dt <- data.table(i1=100,i2=100,i3=100)
>
> but I would like to make it in a loop, as 'n' is large in my case.
>
>
> Thanks.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list