Probably a very simple question, but I would like to be able to set the variables a and b in order to be able to create data.frame or data.table from expand.grid in R.
eg. if a=5 , b=3
what I want so that I can get the same result as
expand.grid(seq(0,1,by=1/5),seq(0,1,by=1/5), seq(0,1,by=1/5))
and if a=3 and b=4 I get
expand.grid(seq(0,1,by=1/3), seq(0,1,by=1/3), seq(0,1,by=1/3), seq(0,1,by=1/3))
i.e. b is the number of columns .... and a is the size of the interval.
thanks
EDIT
Ideally, I would put numbers for a about 100 and b about 30, is there something that is fast and efficient with memory when creating this ... maybe something like data.table ?
source share