How to resolve this error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to resolve this error

Joshua Bedana
> library(SpatioTemporal)
> library(plotrix)
> library(maps)
> palay.cov<-read.csv("C:/Users/BEDANA-PC/Desktop/STThesisWD/Thesis
Data/palay.covar.csv")
> palay.o<-read.table("C:/Users/BEDANA-PC/Desktop/STThesisWD/Thesis
Data/palay.obs.txt")
> palay.obs<-as.matrix(palay.o)
> palay.stc<-read.table("C:/Users/BEDANA-PC/Desktop/STThesisWD/Thesis
Data/palay.stcovars.txt")

> palay.stcov<-as.matrix(palay.stc)
> palay.data.raw<-list(X=palay.cov,obs=palay.obs,Y=palay.stcov)
> ##matrix of observations
> obs<-palay.data.raw$obs
> ##data.frame of geographical covariates
> geocov<-palay.data.raw$X
> ##matrix of spatio-temporal covariate
> stcov<-list(Y=palay.data.raw$Y)
> ##creating ST Data
> palay.data<-createSTdata(obs,geocov,SpatioTemporal=stcov)
Error in stCheckObs(obs) :
  Duplicated observations, i.e. multiple elements with same obs$date and
obs$ID.
>

please help me.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: How to resolve this error

Bert Gunter-2
?duplicated  to find the duplicated elements.

e.g.

duplicated(obs[,c("date","ID")]) ## data frame of relevant columns

Note that a web search on "Find duplicates in R" would have brought this up
immediately. ** Do** avail yourself of standard search capabilities before
posting.

Cheers,
Bert




Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Fri, Oct 6, 2017 at 6:05 AM, Joshua Bedana <[hidden email]>
wrote:

> > library(SpatioTemporal)
> > library(plotrix)
> > library(maps)
> > palay.cov<-read.csv("C:/Users/BEDANA-PC/Desktop/STThesisWD/Thesis
> Data/palay.covar.csv")
> > palay.o<-read.table("C:/Users/BEDANA-PC/Desktop/STThesisWD/Thesis
> Data/palay.obs.txt")
> > palay.obs<-as.matrix(palay.o)
> > palay.stc<-read.table("C:/Users/BEDANA-PC/Desktop/STThesisWD/Thesis
> Data/palay.stcovars.txt")
> > palay.stcov<-as.matrix(palay.stc)
> > palay.data.raw<-list(X=palay.cov,obs=palay.obs,Y=palay.stcov)
> > ##matrix of observations
> > obs<-palay.data.raw$obs
> > ##data.frame of geographical covariates
> > geocov<-palay.data.raw$X
> > ##matrix of spatio-temporal covariate
> > stcov<-list(Y=palay.data.raw$Y)
> > ##creating ST Data
> > palay.data<-createSTdata(obs,geocov,SpatioTemporal=stcov)
> Error in stCheckObs(obs) :
>   Duplicated observations, i.e. multiple elements with same obs$date and
> obs$ID.
> >
>
> please help me.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.