.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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。