help.search('bayes') only searches installed packages. To go beyond that, you might try the following:

library(RSiteSearch)

bayes <- RSiteSearch.function('bayes', 999)
summary(bayes)
# This produces a Parato analysis of packages in terms of references
# to the search term in their help pages. # In this example, it does NOT find 'e1071'.
n.b <- RSiteSearch.function('naive Bayes')
HTML(n.b)
# This displays a table in a web browser sorted by package and "Score"
# with links to the help pages via the web.

Beyond this, "www.r-project.org -> Documentation: Books" provides a list of books about various aspects of R, including several references to "Bayes".

Hope this helps. Spencer


Dylan Beaudette wrote:
On Wednesday 06 May 2009, Tim LIU wrote:
I am wondering if anybody here have a simple example in R for Naive
Bayes.

For example, I can do k-means clustering on the "iris" data -

data(iris)
cl <- kmeans(iris[,1:4], 3)
cl$cluster
cbind(1:150,iris$Species)

===========

But how to do Naive Bayes classification in the same "iris" data?

Many thanks!

# start here:
help.search('bayes')

# in which you will find:
e1071::naiveBayes

# which means:
library(e1071)
?naiveBayes

# and compared to your example:
cl <- kmeans(iris[,1:4], 3)
table(cl$cluster, iris[,5])

m <- naiveBayes(iris[,1:4], iris[,5])
table(predict(m, iris[,1:4]), iris[,5])

Dylan



______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to