R语言scale与unscale函数

本文介绍了R语言中的scale函数用于数据标准化,包括z-score标准化过程,以及unscale函数用于反标准化数据。scale函数通过减去均值和除以标准差实现标准化,而unscale函数则根据scale的返回对象还原数据。文中还提供了示例代码展示如何使用这两个函数。
摘要由CSDN通过智能技术生成

一、scale函数

R语言base库中自带数据标准化接口scale函数,函数介绍如下

Usage

scale(x, center = TRUE, scale = TRUE)

 

Arguments

x: a numeric matrix(like object).

center: either a logical value or a numeric vector of length equal to the number of columns of x.

scale: either a logical value or a numeric vector of length equal to the number of columns of x.

 

Details

The value of center determines how column centering is performed. If center is a numeric vector with length equal to the number of columns of x, then each column of x has the corresponding value from center subtracted from it. If center is TRUE then centering is done by subtracting the column means (omitting NAs) of x from their corresponding columns, and if center is FALSE, no centering is done.

The value of scale determines how column scaling is performed (after centering). If

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值