[R] RES: Error while plotting matrix
Leandro Marino
leandro at cesgranrio.org.br
Fri Jul 4 20:45:31 CEST 2008
You aren't using a matrix.
This is a vector so you can only use:
tvar <- rep(0,(length-tml0))
pmean <- rep(0,(length-tml0))
pmin <- rep(0,(length-tml0))
pmax <- rep(0,(length-tml0))
varmax <- rep(0,(length-tml0))
varmin <- rep(0,(length-tml0))
Why are you not using an data frame? Do you have to output this in a list()?
Leandro Marino
-----Mensagem original-----
De: r-help-bounces em r-project.org [mailto:r-help-bounces em r-project.org]Em
nome de mysimbaa
Enviada em: sexta-feira, 4 de julho de 2008 12:51
Para: r-help em r-project.org
Assunto: [R] Error while plotting matrix
Dear R user,
I have written a function which returns max,min and variation of a power
(see below)
Power is a given matrix(1,n)
I call the function
>Variation<-VAR(p,(n-deltat))
Now the problem is when I want plot(Results[1],Results[2]). Not possible!
I become the following error (in english it means: Error in
as.double.default(x) :Object cannot be transformed in double)
> plot(Variation[1],Variation[2])
Fehler in as.double.default(x) : (list) Objekt kann nicht nach 'double'
umgewandelt werden
Any suggestion?
Hier is the function:
#Computing variation of the power
VAR<-function(power,length){
tvar=pmean=pmin=pmax=varmax=varmin<-matrix(data=0,ncol=(length-tml0))
for(i in tml0:length){
tvar[i]=i
pmean[i]=mean(power[i:(i+deltat)])
pmin[i]=min(power[i:(i+deltat)])
pmax[i]=max(power[i:(i+deltat)])
varmax[i]=100*(pmax[i]-pmean[i])/pmean[i]
varmin[i]=100*(pmean[i]-pmin[i])/pmean[i]
Results=list(tvar,pmean,pmin,pmax,varmax,varmin)
}}
Thanks,
Adel
--
View this message in context:
http://www.nabble.com/Error-while-plotting-matrix-tp18281974p18281974.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help em r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list