My guess is (since no data was supplied) is that the data is not
sorted into date order. Can you provide a subset of the data that
exhibits the problem? It may just be a matter of sorting your
dataframe into date order before doing the plots.
On Mon, Oct 26, 2009 at 9:14 AM, marcos carvajalino
<maancafe240 at gmail.com> wrote:> Hi,
>
> This is my first post in this page althougt i've been using R for
several
> months (by the way english is not my native language so sorry about the
> grammar).
>
> I have a problem with a xyplot on lattice, it's supossed to print
different
> lines for each river (Rio) conditioned by a chemical parameter (Var) and
the
> state at which it's located (Dpto) against the year the sample were
taken
> (A?o)...actually it's doing quite right but the thing is that certarin
lines
> tendo to go first to a distant value and back to the supossed next value in
> the series, e.g. the line goes from the value of 2002 to the value of 2004
> and then back to the value of 2003 when it's supossed to go 2002 then
2003
> then 2004!!
>
> here is the code and the structure of the DB i'm using..
>
>>car<-read.csv2("Historicos.csv")
>>str(car)
> 'data.frame': ? 1818 obs. of ?6 variables:
> ?$ Dpto ?: Factor w/ 11 levels
"ANTIOQUIA","ATL?NTICO",..: 1 1 1 1 1 1 1 1 1
> 2 ...
> ?$ Rio ? : Factor w/ 43 levels "Acand?","Anchicay?",..:
30 31 8 43 20 24 25
> 13 4 26 ...
> ?$ Var ? : Factor w/ 13 levels "CAUDAL","CD",..: 1 1 1
1 1 1 1 1 1 1 ...
> ?$ Valor : num ?13.1 3 3 2.9 2.8 ...
> ?$ A?o ? : int ?2002 2002 2002 2002 2002 2002 2002 2002 2002 2002 ...
> ?$ Regi?n: Factor w/ 2 levels "CARIBE","PACIFICO": 1 1
1 1 1 1 1 1 1 1 ...
>
> #And the code for the plot
>
> xyplot(Valor~A?o|Dpto+Var,groups=Rio,data=car,
>
layout=c(4,3),scale=list(y=list(relation="free")),type="b",
> skip=c(rep(F,11),T))
>
> 2- Actually i've another question concerning the same code, i also have
to
> plot the sum of each of the values for a given year (cause they're mass
> loadings of pollutants), e.g. for each year with variable "DBO"
and state
> "MAGDALENA" i've to sum the values and show them as a single
point in a
> plot, i tried this but it's not working
>
> xyplot(sum(Valor,na.rm=T)~A?o|Dpto+Var,groups=Rio,data=na.omit(car),
>
layout=c(3,3),scale=list(y=list(relation="free")),type="p")
>
> Could someone please tell me what i'm doing wrong and how to correct
this,
> please it's for a report i've to submit on Friday so please help
me!!!
> --
> Marcos Antonio Carvajalino Fern?ndez
> Estudiante de Ingenier?a Ambiental y Sanitaria
> Universidad del Magdalena, Colombia
>
> ? ? ? ?[[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.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?