You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do like that there is a class of spatvectorcollection, however, the functionality is not exactly what I expected. I would expect it to behave as a list (and thus similar to a spatraster with multiple bands). There are two issues:
(ISSUE 1): list names are not inherited and added automatically to the collection (minor)
(ISSUE 2): spatvectorcollection cannot be filtered using the names of the datasets
I am using terra 1.7.71, the most recent version available on CRAN.
Here is an example:
library(terra)
terra 1.7.71
# sample data
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
# create two vector datasets
v <- vect(f, query="SELECT NAME_1, NAME_2, ID_2 FROM lux WHERE ID_2 < 4")
v2 <- vect(f, query="SELECT NAME_1, NAME_2, ID_2 FROM lux WHERE ID_2 > 5")
# make list of the two vector datasets
v_list <- list(v,v2)
names(v_list) <- c('A0','A1')
# make collection
collection <- svc(v_list)
# (ISSUE 1) I would have expected that the names would be inherited from the names given to each item in the list
# add names to collection
names(collection) <- names(v_list)
# (ISSUE 2) It is not possible to subset a collection by using the names of the datasets within the collection
collection$A1
Error in collection$A1 : $ operator not defined for this S4 class
names(collection)
[1] "A0" "A1"
The text was updated successfully, but these errors were encountered:
I do like that there is a class of spatvectorcollection, however, the functionality is not exactly what I expected. I would expect it to behave as a list (and thus similar to a spatraster with multiple bands). There are two issues:
(ISSUE 1): list names are not inherited and added automatically to the collection (minor)
(ISSUE 2): spatvectorcollection cannot be filtered using the names of the datasets
I am using terra 1.7.71, the most recent version available on CRAN.
Here is an example:
The text was updated successfully, but these errors were encountered: