Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setClass("MyDb", representation(data = "data.frame", version = "character"))
- setMethod("$", signature = "MyDb",
- function(x, name) { return(x@data[[name]]) }
- )
- db <- new("MyDb", data = mtcars, version = "2.3.1")
- library(sp)
- data("meuse")
- coordinates(meuse) <- ~ x + y
- meuse$ # brings up autocomplete options for meuse@data slot
- # in MyDb.R
- names.MyDb <- function(x) names(x@data)
- # in NAMESPACE
- S3method(names,MyDb)
Add Comment
Please, Sign In to add comment