"R 데이터프레임 인덱스로 컬럼 제거"의 두 판 사이의 차이

3번째 줄: 3번째 줄:
;R 데이터프레임 인덱스로 컬럼 제거
;R 데이터프레임 인덱스로 컬럼 제거
;R 데이터프레임에서 n번째 컬럼 제거
;R 데이터프레임에서 n번째 컬럼 제거
<syntaxhighlight lang='r' run>
<syntaxhighlight lang='r' run>
students <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
df = iris
Class Name  English Math
head(df)
A    Alice 90      60
</syntaxhighlight>
A      Bob 80      NA
<syntaxhighlight lang='r' run>
B    Carol NA      80
df = iris
B      Dave 60      90
df2 = df[-c(3,4)]
")
head(df2)
options(echo=T)
students[-c(1,3)]
students[,-c(1,3)]
</syntaxhighlight>
</syntaxhighlight>



2021년 3월 14일 (일) 14:19 판

1 개요

R 데이터프레임에서 n번째 열 제거
R 데이터프레임 인덱스로 컬럼 제거
R 데이터프레임에서 n번째 컬럼 제거
df = iris
head(df)
df = iris
df2 = df[-c(3,4)]
head(df2)

2 같이 보기

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