Skip to content

Instantly share code, notes, and snippets.

@enujo
Created July 26, 2017 07:13
Show Gist options
  • Save enujo/4eed66df55b36a77c0ab8ce9f230e0c0 to your computer and use it in GitHub Desktop.
Save enujo/4eed66df55b36a77c0ab8ce9f230e0c0 to your computer and use it in GitHub Desktop.
getwd()
# read.table() : 외부파일에서 데이터 프레임으로 값을 가져온다
dfData <- read.table("./BigData/employee.txt")
dfData
# 데이터에서 열이름과 행이름이 지정된 경우에 해당하는 조건을 지정하여 생성
# read.table(파일명, row.name='행구분 열이름', header=T|F)
dfData <- read.table("./BigData/employee.txt",row.names='no',header=T)
dfData
# 데이터프레임에서 각각의 정보를 선택할 때는 리스트와 동일
dfData$name
class(dfData$name)
# 데이터프레임으로 행렬을 변환 as.data.frame()
m <- matrix(c(1:10),nrow=5)
m
class(m)
matrixDf <- as.data.frame(m)
matrixDf
class(matrixDf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment