[R] please help

Arnab Chowdhuri arnab.chowdhuri at yahoo.in
Thu Apr 14 07:47:01 CEST 2011


van=function(a,x,n){
A<<-matrix(c(x[1]^2,x[1],1,x[2]^2,x[2],1,x[3]^2,x[3],1),byrow=T,nrow=3)

for(i in 1:3){
o<<-x[i]
for(j in sort(1:n+1,decreasing=T)){
B[i][j]<<-(o)^(n+1-j)
}
}

y=vector(length=3)
y<<-B%*%a
p=vector(length=3)

p<<-solve(A,y)
return(p)
}


this is my function and I am getting an error mssg   "number of items to
replace is not a multiple of replacement length" for each assignment of
B[i][j].I am new in R. So please help.....this is a part of my entire
program..a is an n+1 length vector and x is a 3 length vector.

--
View this message in context: http://r.789695.n4.nabble.com/please-help-tp3448788p3448788.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list