PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
R_Language
[問題] 對一個dataframe裡的column做替換
作者:
alasa15
(alasa)
2015-04-02 19:10:13
我現在造一個data frame z
x <- c(3,2,3,2,3,1,1,2)
y <- 1:8
z <- as.data.frame(cbind(x,y))
對這個data frame z
請問有沒有不用loop的方法把column x裡面的 1 2 3 替換成 'a' 'b' 'c' 呢?
謝謝
作者:
ntme
(one shot one kill)
2015-04-02 19:27:00
z$x[z$x == 1] = "a"
作者: ty854697
2015-04-02 22:27:00
try mapvalues() or revalue()
http://ppt.cc/ZNeJ
繼續閱讀
[問題] shinyapp 顯示問題
psinqoo
[問題] 定時工作
koai
[問題] 需要學R的command line嗎
fortooth
[問題] 爬批踢踢文章內容
miao2361
Re: [問題]坐標軸變更
celestialgod
Re: [問題]坐標軸變更
andrew43
[問題]坐標軸變更
coke228
Re: [問題] as.factor()和factor()
JX660
Re: [問題] 矩陣中的屬性不同
ntme
Re: [問題] 矩陣中的屬性不同
andrew43
Links
booklink
Contact Us: admin [ a t ] ucptt.com