R package install good practice

I came across this page when trying to find ways to do text mining and word cloud in R.

I like the best practice to check if packages have been installed and loaded using the following piece of codes, which I advise to add at the beginning of any codes:

Needed <- c(“tm”, “SnowballCC”, “RColorBrewer”, “ggplot2”, “wordcloud”, “biclust”, “cluster”, “igraph”, “fpc”)

Needed install.packages(Needed, dependencies=TRUE)

install.packages(“Rcampdf”, repos = “http://datacube.wu.ac.at/”, type = “source”)

This may not be new to any programmers, but I think it is still very useful to note.