當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R xyVector 構造一個 xyVector 對象

R語言 xyVector 位於 splines 包(package)。

說明

創建一個對象來表示一組 x-y 對。生成的對象可以被視為矩陣或 DataFrame 或向量。當被視為向量時,它僅簡化為 y 組件。

predict.spline 等函數的結果作為 xyVector 對象返回,因此用於生成 y-positions 的 x-values 被保留,例如用於生成繪圖。

用法

xyVector(x, y)

參數

x

數值向量

y

x 長度相同的數值向量

帶有組件的 xyVector 類的對象

x

數值向量

y

x 長度相同的數值向量

例子

require(stats); require(graphics)
ispl <- interpSpline( weight ~ height, women )
weights <- predict( ispl, seq( 55, 75, length.out = 51 ))
class( weights )
plot( weights, type = "l", xlab = "height", ylab = "weight" )
points( women$height, women$weight )
weights

作者

Douglas Bates and Bill Venables

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Construct an xyVector Object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。