I have a data called "NYdata"
from the R package “spTimer"
. The structure of the data is s follows:
<code>> str(NYdata)
'data.frame': 1736 obs. of 10 variables:
$ s.index : int 1 1 1 1 1 1 1 1 1 1 ...
$ Longitude: num -73.8 -73.8 -73.8 -73.8 -73.8 ...
$ Latitude : num 42.7 42.7 42.7 42.7 42.7 ...
$ Year : int 2006 2006 2006 2006 2006 2006 2006 2006 2006 2006 ...
$ Month : int 7 7 7 7 7 7 7 7 7 7 ...
$ Day : int 1 2 3 4 5 6 7 8 9 10 ...
$ o8hrmax : num 53.9 57.1 72 36.6 42.6 ...
$ cMAXTMP : num 27.9 30.1 30 27.9 25.7 ...
$ WDSP : num 5.46 8.21 4.46 3.69 4.37 ...
$ RH : num 2.77 3.2 3.23 4.36 3.95 ...
</code>
<code>> str(NYdata)
'data.frame': 1736 obs. of 10 variables:
$ s.index : int 1 1 1 1 1 1 1 1 1 1 ...
$ Longitude: num -73.8 -73.8 -73.8 -73.8 -73.8 ...
$ Latitude : num 42.7 42.7 42.7 42.7 42.7 ...
$ Year : int 2006 2006 2006 2006 2006 2006 2006 2006 2006 2006 ...
$ Month : int 7 7 7 7 7 7 7 7 7 7 ...
$ Day : int 1 2 3 4 5 6 7 8 9 10 ...
$ o8hrmax : num 53.9 57.1 72 36.6 42.6 ...
$ cMAXTMP : num 27.9 30.1 30 27.9 25.7 ...
$ WDSP : num 5.46 8.21 4.46 3.69 4.37 ...
$ RH : num 2.77 3.2 3.23 4.36 3.95 ...
</code>
> str(NYdata)
'data.frame': 1736 obs. of 10 variables:
$ s.index : int 1 1 1 1 1 1 1 1 1 1 ...
$ Longitude: num -73.8 -73.8 -73.8 -73.8 -73.8 ...
$ Latitude : num 42.7 42.7 42.7 42.7 42.7 ...
$ Year : int 2006 2006 2006 2006 2006 2006 2006 2006 2006 2006 ...
$ Month : int 7 7 7 7 7 7 7 7 7 7 ...
$ Day : int 1 2 3 4 5 6 7 8 9 10 ...
$ o8hrmax : num 53.9 57.1 72 36.6 42.6 ...
$ cMAXTMP : num 27.9 30.1 30 27.9 25.7 ...
$ WDSP : num 5.46 8.21 4.46 3.69 4.37 ...
$ RH : num 2.77 3.2 3.23 4.36 3.95 ...
I want to change the structure to follow the: Formal class
‘STFDF’ [package "spacetime"]
. I need something similar to this data “EU_RB” from “spcopula” package in R :
<code>> str(EU_RB)
Formal class 'STFDF' [package "spacetime"] with 4 slots
..@ data :'data.frame': 11834 obs. of 2 variables:
.. ..$ PM10: num [1:11834] 14 9.7 7.8 21.9 11.2 9 11 6.1 7.4 7.4 ...
.. ..$ EMEP: num [1:11834] 11.62 5.02 3.94 3.82 7.01 ...
..@ sp :Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
.. .. ..@ data :'data.frame': 194 obs. of 1 variable:
.. .. .. ..$ station_altitude: int [1:194] 525 581 918 560 172 117 665 1137 330 330 ...
.. .. ..@ coords.nrs : num(0)
.. .. ..@ coords : num [1:194, 1:2] 4592866 4761515 4658756 4690954 4799839 ...
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. ..@ bbox : num [1:2, 1:2] 2749697 1647732 6412269 4604814
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. .. .. ..$ : chr [1:2] "min" "max"
.. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
.. .. .. .. ..@ projargs: chr " +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"
..@ time :An xts object on 2005-06-01 / 2005-07-31 containing:
Data: integer [61, 1]
Columns: ..1
Index: POSIXct,POSIXt [61] (TZ: "GMT")
..@ endTime: POSIXct[1:61], format: "2005-06-02 03:00:00" "2005-06-03 03:00:00" "2005-06-04 03:00:00" ...
</code>
<code>> str(EU_RB)
Formal class 'STFDF' [package "spacetime"] with 4 slots
..@ data :'data.frame': 11834 obs. of 2 variables:
.. ..$ PM10: num [1:11834] 14 9.7 7.8 21.9 11.2 9 11 6.1 7.4 7.4 ...
.. ..$ EMEP: num [1:11834] 11.62 5.02 3.94 3.82 7.01 ...
..@ sp :Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
.. .. ..@ data :'data.frame': 194 obs. of 1 variable:
.. .. .. ..$ station_altitude: int [1:194] 525 581 918 560 172 117 665 1137 330 330 ...
.. .. ..@ coords.nrs : num(0)
.. .. ..@ coords : num [1:194, 1:2] 4592866 4761515 4658756 4690954 4799839 ...
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. ..@ bbox : num [1:2, 1:2] 2749697 1647732 6412269 4604814
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. .. .. ..$ : chr [1:2] "min" "max"
.. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
.. .. .. .. ..@ projargs: chr " +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"
..@ time :An xts object on 2005-06-01 / 2005-07-31 containing:
Data: integer [61, 1]
Columns: ..1
Index: POSIXct,POSIXt [61] (TZ: "GMT")
..@ endTime: POSIXct[1:61], format: "2005-06-02 03:00:00" "2005-06-03 03:00:00" "2005-06-04 03:00:00" ...
</code>
> str(EU_RB)
Formal class 'STFDF' [package "spacetime"] with 4 slots
..@ data :'data.frame': 11834 obs. of 2 variables:
.. ..$ PM10: num [1:11834] 14 9.7 7.8 21.9 11.2 9 11 6.1 7.4 7.4 ...
.. ..$ EMEP: num [1:11834] 11.62 5.02 3.94 3.82 7.01 ...
..@ sp :Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
.. .. ..@ data :'data.frame': 194 obs. of 1 variable:
.. .. .. ..$ station_altitude: int [1:194] 525 581 918 560 172 117 665 1137 330 330 ...
.. .. ..@ coords.nrs : num(0)
.. .. ..@ coords : num [1:194, 1:2] 4592866 4761515 4658756 4690954 4799839 ...
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. ..@ bbox : num [1:2, 1:2] 2749697 1647732 6412269 4604814
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. .. .. ..$ : chr [1:2] "min" "max"
.. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
.. .. .. .. ..@ projargs: chr " +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"
..@ time :An xts object on 2005-06-01 / 2005-07-31 containing:
Data: integer [61, 1]
Columns: ..1
Index: POSIXct,POSIXt [61] (TZ: "GMT")
..@ endTime: POSIXct[1:61], format: "2005-06-02 03:00:00" "2005-06-03 03:00:00" "2005-06-04 03:00:00" ...