2

有没有办法将单元格的编辑限制为仅DT在 R 中的因子级别?

以下是一些示例数据:

structure(list(boatName = c("Sunny Bay", "STI Solidarity", "STI Rambla", 
"STI La Boca", "STI San Telmo", "STI Esles II", "STI Jardins", 
"SKY", "Steel", "Bahra"), VesselType = structure(c(5L, 1L, 1L, 
5L, 5L, 5L, 5L, 2L, 2L, 1L), .Label = c("AFRAMAX LR2 POOL", "HANDYMAX POOL", 
"LR1 POOL", "MID RANGE", "MID RANGE POOL"), class = "factor"), 
    IceClass = c("NO", "N/A", "No", "NO", "YES", "YES", "YES", 
    "Yes", "Yes", "-")), row.names = c(NA, 10L), class = "data.frame")

如果我运行datatable(df, editable=TRUE),我可以编辑单个单元格。但我希望说的值VesselType仅限于变量的因子水平。

我知道rhandsontable通过指定type = "dropdown"in具有此选项hot_col(),但这可以在DT. 编辑可以仅限于几列吗?

4

0 回答 0