我有一个理论,即函数RPostgreSQL::dbWritetable
在写入之前将POSIXct
个日期转换为字符。我正在尝试查看源代码以确认这一点,尽管查看以下链接我无法找到它。事实上,我甚至不知道我所看到的是S3还是S4方法:
show source code for function in R
How can I view the source code for a function?
How do I show the source code of an S4 function in a package?
首先,我得到了RPostgreSQL::dbWriteTable
:
nonstandardGenericFunction for "dbWriteTable" defined from package "DBI"
defined with value class: "logical"
function (conn, name, value, ...)
{
ans <- {
standardGeneric("dbWriteTable")
}
.valueClassTest(ans, "logical", "dbWriteTable")
}
<environment: 0x00000000122305e8>
Methods may be defined for arguments: conn, name, value
Use showMethods("dbWriteTable") for currently available ones.
下一步似乎是直截了当的:
> showMethods("dbWriteTable")
Function: dbWriteTable (package DBI)
conn="PostgreSQLConnection", name="character", value="character"
conn="PostgreSQLConnection", name="character", value="data.frame"
这并没有给我任何关于如何做进一步的线索。正在运行getAnwhere
:
> getAnywhere("dbWriteTable")
A single object matching ‘dbWriteTable’ was found
It was found in the following places
package:RPostgreSQL
package:DBI
namespace:DBI
with value
function (conn, name, value, ...)
{
ans <- {
standardGeneric("dbWriteTable")
}
.valueClassTest(ans, "logical", "dbWriteTable")
}
<environment: 0x00000000122305e8>
attr(,"generic")
[1] "dbWriteTable"
attr(,"generic")attr(,"package")
[1] "DBI"
attr(,"package")
[1] "DBI"
attr(,"group")
list()
attr(,"valueClass")
[1] "logical"
attr(,"signature")
[1] "conn" "name" "value"
attr(,"default")
`\001NULL\001`
attr(,"skeleton")
(function (conn, name, value, ...)
stop("invalid call in method dispatch to 'dbWriteTable' (no default method)",
domain = NA))(conn, name, value, ...)
attr(,"class")
[1] "nonstandardGenericFunction"
attr(,"class")attr(,"package")
[1] "methods"
但由于没有object = ...
输出,我不知道如何使用getMethod。