# 中心化済み変数の形式をチェック
is.numeric(mydf$Petal.Width_centered) # TRUE
is.vector(mydf$Petal.Width_centered) # FALSE
is.matrix(mydf$Petal.Width_centered) # TRUE
# データフレームに投入する直前にベクター形式に変換
mydf$Petal.Width_centered <- as.vector(scale(mydf$Petal.Width, center = T, scale = F))
is.numeric(mydf$Petal.Width_centered) # TRUE
is.vector(mydf$Petal.Width_centered) # TRUE
is.matrix(mydf$Petal.Width_centered) # FALSE