# 특정 열만 선택
data1 <- data[,2:5]
input_idx <- c(1,2,3)
target_idx <- 4
# select 1st and 5th thru 10th variables
newdata <- mydata[c(1,5:10)]
# exclude 3rd and 5th variable
newdata <- mydata[c(-3,-5)]
# delete variables v3 and v5
mydata$v3 <- mydata$v5 <- NULL
# 변수명 수정
colnames(data1) <- c("recog", "expense", "prefer", "sales")
colnames(data2) <- c("X1", "X2", "X3", "Y")
# rename the variable names
library(reshape)
test <- rename(test, c(target="newname"))
# 변수 특성 변경
expense <- as.numeric(data1$expense)
sales <- as.numeric(data1$sales)
# 변수 합성으로 새로운 데이터 프레임 생성
data2 <- data.frame(expense, data1$recog, data1$prefer, sales)
# 표준화 후 데이터 프레임 생성
data3 <- data.frame(scale(data2, center = TRUE, scale = TRUE))
# 행열 추가
rbind(data, list("A", 13))
cbind(data, states = c("NA", 23))
# 데이터 프레임 병합
merge(data1, data2)
merge(data1, data2, by.x="sex", by.z="gender"
# 데이터 정렬
order(data) # by asc
order(-data) # by desc
# 중복값 제거 (iduser 중복된 값 제외됨)
newdata <- data[!duplicated(active$iduser), ]
댓글 없음:
댓글 쓰기