漢字を読みでソートする.ちと,大仰だったか.
kanji <- c("黄","紫","青","赤","緑") x <- paste(kanji, collapse = " ") write(as.character(x), file = "hoge.txt" ) library(RMeCab) y <- RMeCabText("hoge.txt") yomi <- character(length(y)) for(i in 1:length(y)){ yomi[i] <- y[[i]][9] } kanji[order(yomi)] [1] "青" "赤" "黄" "緑" "紫" file.remove("hoge.txt") [1] TRUE
textConnection()関数を使う方法があるはずだが.