napis <- paste0("Ala","Ma","Kota","Tomek","ma","psa")
a6=length((table(strsplit(napis, ""))))
print(a6)#A
#b
c=max(table(unlist(strsplit(napis, ""))))
print(c)
print((which.max(c)))
上次打印展示价值= 5
我想要显示哪些字母出现5次(它&#39; s&#34; a&#34;)我希望将其显示为&#34; a&#34;
答案 0 :(得分:1)
试试这个,
names(which.max(table(unlist(strsplit(napis, "")))))
#[1] "a"