"R 컬럼명 변경"의 두 판 사이의 차이

 
(사용자 2명의 중간 판 8개는 보이지 않습니다)
3번째 줄: 3번째 줄:
;R 데이터프레임 컬럼명 변경
;R 데이터프레임 컬럼명 변경


<source lang='r' notebook>
==컬럼명 지정==
<syntaxhighlight lang='r' notebook>
df <- iris
df <- iris
df
head(df, 2)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
names(df)[1] <- "day"
names(df)[names(df)=="Sepal.Length"] <- "aaa"
names(df)[2] <- "fruit"
names(df)[names(df)=="Petal.Length"] <- "bbb"
names(df)[3] <- "ea"
head(df, 2)
df
</syntaxhighlight>
</source>
 
==컬럼위치 지정==
<syntaxhighlight lang='r' notebook=2>
df <- iris
head(df, 2)
</syntaxhighlight>
<syntaxhighlight lang='r' notebook=2>
names(df)[1] <- "aaa"
names(df)[3] <- "bbb"
head(df, 2)
</syntaxhighlight>


==같이 보기==
==같이 보기==

2021년 9월 24일 (금) 01:21 기준 최신판

1 개요[ | ]

R 컬럼명 변경
R 데이터프레임 컬럼명 변경

2 컬럼명 지정[ | ]

df <- iris
head(df, 2)
names(df)[names(df)=="Sepal.Length"] <- "aaa"
names(df)[names(df)=="Petal.Length"] <- "bbb"
head(df, 2)

3 컬럼위치 지정[ | ]

df <- iris
head(df, 2)
names(df)[1] <- "aaa"
names(df)[3] <- "bbb"
head(df, 2)

4 같이 보기[ | ]

5 참고[ | ]

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