In RStudio, list and data.frame objects have code completion, when you do:
you get a nice popup showing the list element names.
However, when you select a name from the menu, the following happens:
so we get brackets around the column name, as you would expect for a list or data.frame.
If we want to get auto-completion on a fsttable object the data.table-way, that object should have a data.table class and a fsttable class name:
# create a print generic
print.myclass <- function(dt){
print("This is an override")
}
# define a data.table object
dt <- data.table::data.table(ColA = 1:100, ColBB = LETTERS)
# add a myclass class to the list of class names (at position 1)
class(dt) <- c("myclass", class(dt))
# check that custom print method is called
print(dt)
#> [1] "This is an override"
the auto-completion will now work as intended.
It would be nice to use the data.table class name in the fsttable object. That would require that overrides exist in the fsttable package for every possible generic that is defined in the data.table package. Otherwise, the data.table generic would be called for that particular method...
In RStudio,
list
anddata.frame
objects have code completion, when you do:you get a nice popup showing the list element names. However, when you select a name from the menu, the following happens:
so we get brackets around the column name, as you would expect for a
list
ordata.frame
.If we want to get auto-completion on a
fsttable
object thedata.table
-way, that object should have adata.table
class and afsttable
class name:the auto-completion will now work as intended.
It would be nice to use the
data.table
class name in thefsttable
object. That would require that overrides exist in thefsttable
package for every possible generic that is defined in thedata.table
package. Otherwise, thedata.table
generic would be called for that particular method...