Part of the reason R has become so popular is the vast array of packages that are available to extend its functionality. In the last few years, the number of packages has grown exponentially!
Let's suppose you are wandering about the web and come across the name of a nifty little package like "
plotrix" that promises it can -- with one command -- construct side by side plots of confidence intervals. You say to yourself, "Hey, that could be seriously useful!", and want to be able to use this package on your machine. What do you do? It's easier than you might think...
Step 1: Install the package. You only need to do this once, and then it is available to your R application forever. The cleverly-named command you want to execute is:
(Of course, you should substitute the package name for "
plotrix" above, if installing a differently named package.)
Step 2: In any R session where you want to use the functions built into that package, type:
library(plotrix)This only needs to be done once per session (or script, as appropriate), and again -- if dealing with a package that has a different name, swap out "
That's it! Now you are ready to use your new package. Want to see what the "
plotrix" package can do? Try typing the following:
highs = c(10,12,8,14) lows = c(5,9,4,7) mids = c(8,10,6,12) plotCI(mids,y=NULL,uiw=highs-mids,liw=mids-lows,err="y")You should see something like the following: