Hi,
I am trying plot a grafic but generates an error:
Erro em plot.default(xlim, ylim, type = "n", ann = FALSE, axes =
FALSE, : argumento formal "type" corresponde a mĂșltiplos argumentos
especificados
DATA:
44 40 39 38 0 7 7 1030 57 37 5146 40 41 4737 34 36 2636 28 33 3738 26 28
2742 38 36 3636 27 22 2853 43 33 40
plot(dados[1],type="o",pch=21,
axes=FALSE,xlab="year",ylab="cases")lines(dados[2],
type="o", pch=22)lines(dados[3],
type="o",pch=23)lines(dados[4],
type="o",pch=24)legend(1,8.5,
legend=c("Pel","RG","SM","SV"),pch=21:24)axis(1,at=1:10,
lab=c("2000","2001","2002","2003","2004","2005","2006","2007","2008","2009"))axis(2,0:60)
[[alternative HTML version deleted]]
Look at your plot command. You included type="o" twice. ---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of aprendiz programa > Sent: Sunday, August 26, 2012 4:02 PM > To: r-help at r-project.org > Subject: [R] error type > > > Hi, > I am trying plot a grafic but generates an error: > Erro em plot.default(xlim, ylim, type = "n", ann = FALSE, axes = FALSE, > : argumento formal "type" corresponde a mzltiplos argumentos > especificados > DATA: > 44 40 39 38 0 7 7 1030 57 37 5146 40 41 4737 34 36 2636 28 33 3738 > 26 28 2742 38 36 3636 27 22 2853 43 33 40 > plot(dados[1],type="o",pch=21, > axes=FALSE,xlab="year",ylab="cases")lines(dados[2], type="o", > pch=22)lines(dados[3], type="o",pch=23)lines(dados[4], > type="o",pch=24)legend(1,8.5, > legend=c("Pel","RG","SM","SV"),pch=21:24)axis(1,at=1:10, > lab=c("2000","2001","2002","2003","2004","2005","2006","2007","2008","2 > 009"))axis(2,0:60) > [[alternative HTML version deleted]]
From: aprendizprogram@hotmail.com To: r-help@r-project.org Date: Mon, 27 Aug 2012 00:01:52 +0300 Subject: [R] error type Hi, I am trying plot a grafic but generates an error: Erro em plot.default(xlim, ylim, type = "n", ann = FALSE, axes = FALSE, : argumento formal "type" corresponde a mĂșltiplos argumentos especificado>>plot(dados[1],type="o",pch=21, axes=FALSE,xlab="year",ylab="cases")>>lines(dados[2], type="o", pch=22)>>lines(dados[3], type="o",pch=23)>>lines(dados[4], type="o",pch=24)>>legend(1,8.5, legend=c("Pel","RG","SM","SV"),pch=21:24)axis(1,at=1:10, lab=c("2000","2001","2002","2003","2004","2005","2006","2007","2008","2009"))>>axis(2,0:60)[[alternative HTML version deleted]] ______________________________________________ R-help@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. [[alternative HTML version deleted]]
As the footer says...
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html and provide commented, minimal,
self-contained, reproducible code.
Some issues with your email are:
a) You posted in HTML, which in spite of appearances does NOT appear on our
screens the same as on your screen. Configure your mail to be sent in plain
text.
b) "Reproducible code" means we can paste it into our R interpreter
and get the same result you did. You did not give us the code that read your
data into the "dados" object, or data in an R-understandable way. Read
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
I doubt you should be referring to "dados[1]", "dados[2]"
and similar... plot and lines functions accept a whole vector of data at once.
Also, the ">>" bits sprinkled in don't look like valid
syntax, but I can't tell if that is due to HTML corruption or whether you
actually typed that in.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
aprendiz programa <aprendizprogram at hotmail.com> wrote:
>
>
>
>From: aprendizprogram at hotmail.com
>To: r-help at r-project.org
>Date: Mon, 27 Aug 2012 00:01:52 +0300
>Subject: [R] error type
>
>
>Hi,
>I am trying plot a grafic but generates an error:
>Erro em plot.default(xlim, ylim, type = "n", ann = FALSE, axes =
FALSE,
>: argumento formal "type" corresponde a m?ltiplos argumentos
>especificado
>>>plot(dados[1],type="o",pch=21,
>axes=FALSE,xlab="year",ylab="cases")>>lines(dados[2],
type="o",
>pch=22)>>lines(dados[3],
type="o",pch=23)>>lines(dados[4],
>type="o",pch=24)>>legend(1,8.5,
>legend=c("Pel","RG","SM","SV"),pch=21:24)axis(1,at=1:10,
>lab=c("2000","2001","2002","2003","2004","2005","2006","2007","2008","2009"))>>axis(2,0:60)
>
> [[alternative HTML version deleted]]
>
>
>______________________________________________
>R-help at 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.
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.
You are still using html - you need to tell hotmail to use plain text only.
I can't replicate your error with the following:
dados <- c(44, 40, 39, 38, 0, 7, 7, 1030, 57, 37, 5146, 40, 41, 4737, 34,
36,
2636, 28, 33, 3738, 26, 28, 2742, 38, 36, 3636, 27, 22, 2853, 43, 33, 40)
plot(dados[1],type="o",pch=21,axes=FALSE,xlab="year",ylab="cases")
lines(dados[2], type="o", pch=22)
lines(dados[3], type="o",pch=23)
lines(dados[4], type="o",pch=24)
legend(1,8.5,
legend=c("Pel","RG","SM","SV"),pch=21:24)
axis(1,at=1:10,lab=c("2000","2001","2002","2003","2004","2005","2006",
"2007","2008","2009"))
axis(2,0:60)
But I'm sure the result is not what you are looking for since you are using
lines() to plot a single symbol (points() is normally used for this). You
have 32 values in dados (or 40 if the 4-digit values should really be two
2-digit values). You are trying to plot 10 years on the x axis and you
specify a range for the y-axis of 0 to 60, but the range in values is much
greater. Use dput(dados) and paste that into your email and tell us what the
plot should look like.
As a wild guess let's say you really want
dados <- matrix(c(44, 40, 39, 38, 0, 7, 7, 10, 30, 57, 37, 51, 46, 40, 41,
47,
37, 34, 36, 26, 36, 28, 33, 37, 38, 26, 28, 27, 42, 38, 36, 36, 36, 27,
22, 28, 53, 43, 33, 40), ncol=4)
group <- c(rep("Pel", 10), rep("RG", 10),
rep("SM", 10), rep("SV", 10))
year <- 2000:2009
matplot(year, dados, col=1, pch=21:24)
legend("bottomleft",
legend=c("Pel","RG","SM","SV"),
pch=21:24)
Is this closer to what you are looking for?
-------
David
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of aprendiz programa
> Sent: Sunday, August 26, 2012 4:42 PM
> To: r-help at r-project.org
> Subject: Re: [R] error type
>
>
>
>
> From: aprendizprogram at hotmail.com
> To: r-help at r-project.org
> Date: Mon, 27 Aug 2012 00:01:52 +0300
> Subject: [R] error type
>
>
> Hi,
> I am trying plot a grafic but generates an error:
> Erro em plot.default(xlim, ylim, type = "n", ann = FALSE, axes =
FALSE,
> : argumento formal "type" corresponde a mzltiplos argumentos
> especificado
> >>plot(dados[1],type="o",pch=21,
>
axes=FALSE,xlab="year",ylab="cases")>>lines(dados[2],
type="o",
> pch=22)>>lines(dados[3],
type="o",pch=23)>>lines(dados[4],
> type="o",pch=24)>>legend(1,8.5,
>
legend=c("Pel","RG","SM","SV"),pch=21:24)axis(1,at=1:10,
>
lab=c("2000","2001","2002","2003","2004","2005","2006","2007","2008","2
> 009"))>>axis(2,0:60)
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>
> [[alternative HTML version deleted]]