[R] About "SpatioTemporal" Package

Jim Lemon drjimlemon at gmail.com
Thu Jul 14 06:01:47 CEST 2016


Hi Elham,
The data might have been read in as a factor, which is neither
character nor numeric. In any case, it seems more likely to be a
problem with the "createSTdata" function, which I don't have.

Jim


On Thu, Jul 14, 2016 at 1:01 PM, Elham Daadmehr <e.daadmehr at yahoo.com> wrote:
> Thank you for the reply, Jim.
>
> It gave me the same error.
> I checked the example data "mesa.data.raw" in this package, I found that the
> "ID" has
> the same type as the one in this data but I don't know why the function
> "createSTdata(y1, datst1)" give me
> the error.
>
> Regards,
>
>
>
> On Thursday, July 14, 2016 3:10 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
>
>
> Hi Elham,
> It looks to me as though you have created the numeric variable "ID"
> and then passed it to a function that expects it to be a character
> variable. Try changing the line:
>
> ID<-60101:60128
>
> to:
>
> ID<-paste("ID",60101:60128,sep="")
>
> and see what happens.
>
> Jim
>
>
> On Wed, Jul 13, 2016 at 8:29 PM, Elham Daadmehr via R-help
> <r-help at r-project.org> wrote:
>>  Dear all,
>>
>>  I want to build the data with the structure of STdata (using the
>>  function "createSTdata()"), I did as the following:
>>
>>  ####
>>  datst=cbind(xy)
>>  yy=cbind(y,xx)
>>  ID=60101:60128
>>  date=as.numeric(1:13)
>>  y1=as.data.frame(t(cbind(yy)))
>>  datst1=as.data.frame(cbind(ID,datst))
>>  aa=as.Date(date,format = "%Y-%m-%d",origin = "2016-01-31")
>>  rownames(y1)<- aa
>>  colnames(y1)<- ID
>>  colnames(datst1)<-c("ID","x","y")
>>  ####
>>
>>  But I don't know why the function "createSTdata(y1, datst1)" give me
>>  the following error:
>>
>>  ####
>>  Error in stCheckClass(obs$ID, "character", name = "obs$ID") :
>>    obs$ID  must belong to one of class(es)  character
>>  In addition: Warning messages:
>>  1: In createSTdata(y1, datst1) :
>>    Unable to find column 'obs$obs', using 'obs[,1]
>>  2: In createSTdata(y1, datst1) :
>>    Unable to find column 'obs$date', using 'obs[,2]
>>  3: In createSTdata(y1, datst1) :
>>    Unable to find column 'obs$ID', using 'obs[,3]
>>  ####
>>  I checked the example data "mesa.data.raw", I found that my "ID" has
>>  the same type (integer) as the one in this data.
>>
>>
>>  Kindly thanks, in advanceElham
>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org 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.
>
>
>



More information about the R-help mailing list