.get_data_types()
泛型在內部用於為配方中使用的列提供類型。這些函數是用戶在 selections 中看到的工作的基礎。
用法
.get_data_types(x)
# S3 method for default
.get_data_types(x)
# S3 method for character
.get_data_types(x)
# S3 method for ordered
.get_data_types(x)
# S3 method for factor
.get_data_types(x)
# S3 method for integer
.get_data_types(x)
# S3 method for numeric
.get_data_types(x)
# S3 method for double
.get_data_types(x)
# S3 method for Surv
.get_data_types(x)
# S3 method for logical
.get_data_types(x)
# S3 method for Date
.get_data_types(x)
# S3 method for POSIXct
.get_data_types(x)
# S3 method for list
.get_data_types(x)
# S3 method for textrecipes_tokenlist
.get_data_types(x)
# S3 method for hardhat_case_weights
.get_data_types(x)
細節
此函數充當 class()
的擴展 recipes-specific 版本。通過忽略相似類型的差異("double"和"numeric")並允許每個元素具有多種類型("factor"返回"factor"、"unordered"和"nominal","character"返回"string", "unordered" 和 "nominal")我們能夠創建更自然的選擇器,例如 all_nominal()
、 all_string()
和 all_integer()
。
以下列表顯示了配方定義的不同類的數據類型。如果對象具有 .get_data_types()
不支持的類,它將獲得數據類型 "other"。
-
字符:字符串、無序和名義
-
ordered:有序的,名義上的
-
因子:因子、無序因子和名義因子
-
整數:整數和數字
-
數字:雙精度和數字
-
double:雙精度和數字
-
生存:生存
-
邏輯性:邏輯性
-
日期: 日期
-
POSIXct:日期時間
-
列表:列表
-
textrecipes_tokenlist:令牌列表
-
hardhat_case_weights:case_weights
例子
data(Sacramento, package = "modeldata")
lapply(Sacramento, .get_data_types)
#> $city
#> [1] "factor" "unordered" "nominal"
#>
#> $zip
#> [1] "factor" "unordered" "nominal"
#>
#> $beds
#> [1] "integer" "numeric"
#>
#> $baths
#> [1] "double" "numeric"
#>
#> $sqft
#> [1] "integer" "numeric"
#>
#> $type
#> [1] "factor" "unordered" "nominal"
#>
#> $price
#> [1] "integer" "numeric"
#>
#> $latitude
#> [1] "double" "numeric"
#>
#> $longitude
#> [1] "double" "numeric"
#>
相關用法
- R recipes step_unknown 將缺失的類別分配給“未知”
- R recipes step_relu 應用(平滑)修正線性變換
- R recipes step_poly_bernstein 廣義伯恩斯坦多項式基
- R recipes step_impute_knn 通過 k 最近鄰進行插補
- R recipes step_impute_mean 使用平均值估算數值數據
- R recipes step_inverse 逆變換
- R recipes step_pls 偏最小二乘特征提取
- R recipes update.step 更新菜譜步驟
- R recipes step_ratio 比率變量創建
- R recipes step_geodist 兩個地點之間的距離
- R recipes step_nzv 近零方差濾波器
- R recipes step_nnmf 非負矩陣分解信號提取
- R recipes step_normalize 中心和比例數值數據
- R recipes step_depth 數據深度
- R recipes step_other 折疊一些分類級別
- R recipes step_harmonic 添加正弦和餘弦項以進行諧波分析
- R recipes step_corr 高相關濾波器
- R recipes step_novel 新因子水平的簡單賦值
- R recipes step_select 使用 dplyr 選擇變量
- R recipes formula.recipe 從準備好的食譜創建配方
- R recipes step_regex 檢測正則表達式
- R recipes step_spline_b 基礎樣條
- R recipes step_window 移動窗口函數
- R recipes step_ica ICA 信號提取
- R recipes check_range 檢查範圍一致性
注:本文由純淨天空篩選整理自Max Kuhn等大神的英文原創作品 Get types for use in recipes。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。