R melt()

1 개요[ | ]

R melt()
students = read.table( header=TRUE, stringsAsFactors=FALSE, text="
Class Name  English Math
A     Alice 90      60
A       Bob 80      NA
B     Carol NA      80
B      Dave 60      90
")
options(echo=T)
students
library(reshape2)
melt(students, id=c("Class","Name"))
melt(students, id=c("Class","Name") ,na.rm=TRUE)
library(reshape2)
df = read.table( header=TRUE, stringsAsFactors=FALSE, text="
age gender income region
20  F      1000   S
30  M      2000   S
40  M      3000   G
50  F      4000   G
")
options(echo=T)
df
melt(df, id.vars=c("gender","region"))

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}