Is it possible to store variables in R..
I have to compute 10*324 fitdist
's which each output from this function has to be stored inside a matrix with the size above? is that possible in R?
If so then how, i am completely lost?
So i tried creating a simple example
norm_dist <- as.data.frame(matrix(nrow=3,ncol=3))
data(iris)
for(i in 1:3)
{
for(j in 1:3)
{
print(i)
print(j)
if(j==1)
{
element = fitdist(data =iris$Petal.Width[1:50*i], distr = "norm")
norm_dist[i,j] = element
}
if(j==2)
{
element = fitdist(data =iris$Petal.Length[1:50*i], distr = "norm")
norm_dist[i,j] = element
}
if(j==3)
{
element = fitdist(data =iris$Sepal.Length[1:50*i], distr = "norm")
norm_dist[i,j] = element
}
}
}
But i am getting this error
Error in `[<-.data.frame`(`*tmp*`, i, j, value = list(estimate = c(0.867771222640304, :
replacement element 4 is a matrix with 2 rows, needs 1
I am not sure i understand what it means...