Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 실습
- 파이썬
- 코딩테스트
- 머신러닝
- 튜닝
- R
- sklearn
- 데이터 분석
- 실기
- 프로그래머스
- Oracel
- 빅분기
- python3
- seaborn
- level 1
- 카카오
- Kaggle
- Numpy
- level 2
- 오라클
- 알고리즘
- 빅데이터 분석 기사
- oracle
- SQL
- Python
- pandas
- matplotlib
Archives
- Today
- Total
라일락 꽃이 피는 날
[R] 데이터 프레임 (Data Frame) 본문
728x90
데이터 프레임 (Data Frame)
가장 일반적인 데이터 형태로, 행(Row)과 열(Column)의 조합이다.
행이 많을수록 고사양 장비가 필요하고, 열이 많을수록 고급 분석방법을 사용해야 한다.
1. 데이터 프레임 만들기
데이터 프레임명 <- data.frame(변수1, 변수2, ···)
history <- c(90, 80, 60, 70)
math <- c(50, 60, 100, 20)
df_midterm <- data.frame(history, math)
df_midterm
'''
history math
1 90 50
2 80 60
3 60 100
4 70 20
'''
2. 열(Column) 추가하기
class_ <- c(1, 1, 2, 2)
df_midterm <- data.frame(history, math, class_)
df_midterm
'''
history math class_
1 90 50 1
2 80 60 1
3 60 100 2
4 70 20 2
'''
3. 데이터 프레임 형태로 불러오기
as.data.frame(패키지명::데이터명)
mpg <- as.data.frame(ggplot2::mpg)
head(mpg)
728x90
'데이터 분석 > R' 카테고리의 다른 글
[R] 데이터 수정하기 (0) | 2021.06.19 |
---|---|
[R] 데이터 파악하기 (0) | 2021.06.19 |
[R] 외부 데이터 불러오기 (0) | 2021.06.19 |
[R] 함수 (function), 패키지 (packages) (0) | 2021.06.19 |
[R] 변수 (Variable) (0) | 2021.06.19 |