260220 study
This commit is contained in:
+48
-1
@@ -149,6 +149,53 @@ View(DF4)
|
||||
str(DF4)
|
||||
|
||||
## 기술통계량 ##
|
||||
library('psych')
|
||||
library(psych) # describe()명령어 호출 라이브러리
|
||||
|
||||
describe(DF4)
|
||||
|
||||
rownames(DF1) = paste('Edge',1:5,sep='_')
|
||||
rownames(DF1)
|
||||
|
||||
colnames(DF1) = paste(c('아이디','나이','성별','키'))
|
||||
colnames(DF1)
|
||||
|
||||
dim(DF1)
|
||||
|
||||
searchpaths()
|
||||
|
||||
## read text data ##
|
||||
k200 = read.csv(file = './data/k100.csv',header = TRUE)
|
||||
k300 = read.csv(file = './data/ebook.csv',header = TRUE)
|
||||
tsv100 = read.table(file = './data/survey_tab.txt', header = TRUE, fileEncoding = 'CP949')
|
||||
|
||||
## data handling ##
|
||||
library(ggplot2)
|
||||
|
||||
head(diamonds)
|
||||
View(diamonds)
|
||||
head(Titanic)
|
||||
View(Titanic)
|
||||
|
||||
## data structure ##
|
||||
str(diamonds)
|
||||
str(Titanic)
|
||||
|
||||
## indexing ##
|
||||
diamonds[ , 2]
|
||||
diamonds[ , 2, drop=FALSE]
|
||||
xx = diamonds[ , c(2, 3, 7)] # 2,3,7번째 값 추출
|
||||
ss = diamonds[,7] # 7번째 값 추출
|
||||
describe(diamonds) # 기술통계량
|
||||
diamonds[ , 7:10]
|
||||
diamonds[ , seq(from=2, to=10, by=2)]
|
||||
|
||||
diamonds[ , 'cut']
|
||||
diamonds[ , c('cut', 'price')]
|
||||
|
||||
## 행추출하기 ##
|
||||
a = diamonds[diamonds$cut == 'Fair', ]
|
||||
a
|
||||
b = diamonds[diamonds$price >= 18000, ] # 다이아몬드의 가격을 기준으로 추출
|
||||
b
|
||||
c = diamonds[(diamonds$cut == 'Fair') & (diamonds$price >= 18000), ]
|
||||
d = diamonds[(diamonds$cut == 'Fair') | (diamonds$price >= 18000), ]
|
||||
|
||||
Reference in New Issue
Block a user