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
The section mentions, that the helper to construct a Person object converts the age to a double so that it also works with integers, however the following is fine for me
setClass("Person",
slots= c(
name="character",
age="numeric"
)
)
Person<-function(name, age=NA) {
new("Person", name=name, age=age)
}
Person("John Smith")
#> Error in validObject(.Object): invalid class "Person" object: invalid object for slot "age" in class "Person": got class "logical", should be or extend class "numeric"
The section mentions, that the helper to construct a
Person
object converts the age to a double so that it also works with integers, however the following is fine for meCreated on 2021-12-13 by the reprex package (v2.0.1)
What exactly is meant here?
The text was updated successfully, but these errors were encountered: