Getting warning using setAs() to specify colClasse

2020-04-03 02:39发布

问题:

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 7 years ago.

I tried using the answer @Greg Snow provided in this question, but I keep getting a warning regardless of what I do. Can someone help with this:?

> setAs("character","myDate",function(from) as.Date(from, format="%b %d, %Y %r"))
in method for ‘coerce’ with signature ‘"character","myDate"’: no definition for class “myDate”

I wanted to make sure that the "methods" package is load (it looks like setAs depends on it) and I got this:

> getOption("defaultPackages")
[1] "datasets"  "utils"     "grDevices" "graphics"  "stats"     "methods"

TIA