1 / 27

R Data type

R Data type. 권정혁. Index. 행렬 (Matrix) 배열 (array) 데이터 프레임 (data Frame) 타입 판별 타입 변환. 행렬 (Matrix). 행렬은 matrix() 사용 nrow - 행의수 지정 ncol - 열의수 지정 byrow – 행렬값을 위쪽부터 행렬 , 열에 별칭 dimnames () 행렬내 데이터 접근 행렬의 연산. nrow - 행의수 지정. ncol - 열의수 지정. byrow – 행렬값을 위쪽부터.

trory
Télécharger la présentation

R Data type

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. R Data type 권정혁

  2. Index • 행렬(Matrix) • 배열(array) • 데이터 프레임(dataFrame) • 타입 판별 • 타입 변환

  3. 행렬(Matrix) • 행렬은 matrix() 사용 nrow - 행의수 지정 ncol - 열의수 지정 byrow – 행렬값을 위쪽부터 행렬,열에 별칭 dimnames() 행렬내 데이터 접근 행렬의 연산

  4. nrow - 행의수지정

  5. ncol - 열의수지정

  6. byrow – 행렬값을 위쪽부터

  7. 행렬,열에 별칭 dimnames()

  8. 행렬내 데이터 접근

  9. 행렬내 데이터 접근 • 행렬 생성시에 행 이름과 열 이름 지정 가능함

  10. 행렬의 연산

  11. 전치 행렬 • byrow 기능과 흡사함

  12. 배열(array)

  13. 데이터 프레임(dataFrame) • 데이터 프레임은 행렬과 마찬가지의 모습을 하고 있지만 행렬과 달리 다양한 변수, 관측지, 범주 등을 표현하기 위해 특화됨 • 데이터 프레임은 data.frame() 사용 • Table과 흡사함

  14. 데이터 추가 가능함

  15. 데이터 추가 가능함 • $열이름<- data values  열을 추가 및 data 추가함 • $열이름 해당열data 행으로 나열함

  16. str() 함수 • Str()함수 R 객체의 내부 구조를 보는데 사용되는 함수

  17. head() 함수 • 데이터가 많다면 데이터 앞부분만 살펴보는데 head()사용

  18. head() 함수 ~~~~~~~~~~~~~~~~~~~~~~~~~~

  19. 행,열 이름 각각 함수로 지정

  20. 행,열 이름 각각 함수로 지정 • Colnames()  열 이름을변경 할수 있음 • Rownames()  행 이름을 변경 할수 있음

  21. 타입 판별 • 데이터를 처리하기 위해 여러 함수를 호출하다보면 반환된 결과의 타입이 무엇인지 분명하지 않을때class() 사용

  22. 타입 판별 class()

  23. 타입 변환 colnames(),data.frame

  24. 타입 변환 colnames(),data.frame • Colnames() 출력시 열 이름을 변경할수 있음 • Data.frame(list… 출력시데이터를 변경할수 있음 num,char(varchar2) 형식으로 변경 가능

  25. as.factor()

  26. as.factor() • x <- c(‘m’,’f’) • as.factor(x)  알파펫 순서로 F,M 출력 • as.numeric(as.factor(x))  levels 순서에 따라 2,1 출력 • Factor(c(‘m’,’f’), levels=c(‘m’,’f’))  출력시 순서를 변경 가능 M,F 출력함

  27. Thank you

More Related