[R] why is generating the same graph???
S Ellison
S.Ellison at LGCGroup.com
Thu Feb 23 12:44:40 CET 2012
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Vanúcia Schumacher
> Sent: 23 February 2012 00:08
> To: r-help at r-project.org
> Subject: [R] why is generating the same graph???
>
>
> Hi,
> why my script iss always generating the same graph?when I
> change the parameters and the name of text file?
The usual - in fact probably the only - explanation for the same graph is that the same data set is plotted.
This can happen by mistake for lots of reasons, all associated with the operator. Check that:
- you have no error messages on file reading. if read.table fails, the initial data set will not be replaced, and R will plot the data set by that name.
- your script is actually plotting the data set you are reading; it is surprisingly easy to get names wrong by a character and not notice
- that you are reading the right file
- that the files you are reading contain different data
- that the differences are in column 1 of the data set and not in another column
- if you're plotting inside a function, check that the data plotted has the name of the argument and not the name of an object somewhere else in your workspace (This happens often when testing scripts; if we say f<-function(x) plot(y) and then run f using, say, f(z), the function will plot y if it exists in the parent environment for the function. It's not unusual to have created a temporary y (or whatever) to test the code...
S
> library(MASS)
> dados<-read.table("inverno.txt",header=FALSE)
> vento50<-fitdistr(dados[[1]],densfun="weibull")
> png(filename="invernoRG.png",width=800,height=600)
> hist(dados[[1]], seq(0, 18, 0.5), prob=TRUE, xlab="Velocidade
> (m/s)",ylab="Densidade", main="50 m") curve(dweibull(x,
> shape=0.614, scale=2.435), 0,18,add=T, col='red')
> dev.off()
>
> Best Regards
> *******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list