Skip to content

Construct a data.frame in a FOR-loop

1 message · Ido M. Tamir

#
Serguei Kaniovski wrote:

            
If thats all you really need:
data<- t(sapply(1:5, function(i){ return(c(i,i^2,i^3))}))
scatterplot3d(data)

In general you don't plot something in R for each iteration.
You rather pass the whole result to the plot function.
But there are plotting function which accept formulas.

Regards,
Ido Tamir