getFreqMtx2 <- function(filename, relative = FALSE){
....
if (relative==TRUE){
freqMtx<-freqMtx[,c(1,3)]
}else{
freqMtx<-freqMtx[,1:2]
}
return(freqMtx)
}
source("getFreqMtx2.R")
freqMtx<-getFreqMtx2("osaka-u.txt")
head(freqMtx)
## term raw
## 211 the 33
## 21 and 31
## 146 of 31
## 228 university 16
## 112 in 15
## 149 osaka 15
freqMtx<-getFreqMtx2("osaka-u.txt", relative=TRUE)
head(freqMtx)
## term relative
## 211 the 0.06470588
## 21 and 0.06078431
## 146 of 0.06078431
## 228 university 0.03137255
## 112 in 0.02941176
## 149 osaka 0.02941176
source("getFreqDir.R")
getFreqDir("testData")
## test1 test2 test3
## a 3 2 2
## b 4 4 0
## c 13 2 3
## d 0 0 1
## e 7 1 1
## f 0 11 9
## g 0 7 7
## h 0 0 4
getFreqDir("testData",relative=TRUE)
## test1 test2 test3
## a 0.1111111 0.07407407 0.07407407
## b 0.1481481 0.14814815 0.00000000
## c 0.4814815 0.07407407 0.11111111
## d 0.0000000 0.00000000 0.03703704
## e 0.2592593 0.03703704 0.03703704
## f 0.0000000 0.40740741 0.33333333
## g 0.0000000 0.25925926 0.25925926
## h 0.0000000 0.00000000 0.14814815
head(tf)
## hiroshima kufs kyoto osaka1 osaka2 osaka3 tokyo waseda
## 000 0 0 0 0 0 0 0 2
## 1 0 0 0 1 0 0 0 1
## 10 0 0 1 0 0 0 0 1
## 100 0 0 0 0 1 0 0 0
## 11 2 0 0 0 0 0 0 0
## 12 1 0 0 0 0 0 0 0
library(wordcloud)
## Loading required package: RColorBrewer
wordcloud(rownames(tf),tf$hiroshima)
実行結果
wordcloud(rownames(tf),tf$osaka1,min.freq=2,colors=rainbow(10))
comparison.cloud(tf[,1:2])
comparison.cloud(tf[,4:6],max.words=60)
colnames(tf)
comparison.cloud(univ[,c(F,F,T,F,F,T,T,F)],max.words=60)
library(shiny)
shinyUI(bootstrapPage(
# Application title
headerPanel("Test Hoge"),
# Sidebar
sidebarPanel(
textInput("msg", "Please type your message:")
),
# Show a message
mainPanel(
textOutput("showMessage")
)
))
shinyServer(function(input, output) {
output$showMessage <- renderText({
input$msg
})
})
runApp("shiny_apps/app_hoge")
runApp("shiny_apps/app_freqBar")
alt text
alt text