您的位置:首页 > 产品设计 > UI/UE

Quick list of useful R packages

2015-02-04 12:59 926 查看


Recommended Packages

Many useful R function come in packages, free libraries of code written by R's active user community. To install an R package, open an R session and type at the command line
install.packages("<the package's name>")


R will download the package from CRAN, so you'll need to be connected to the internet. Once you have a package installed, you can make its contents available to use in your current R session by running
library("<the package's name>")


There are thousands of helpful R packages for you to use, but navigating them all can be a challenge. To help you out, we've compiled this guide to some of the best. We've used each of these, and found them to be outstanding – we've even written some of them.
But you don't have to take our word for it, these packages are also some of the top most downloaded R packages.


To load data

RODBC, RMySQL, RPostgresSQL, RSQLite -
If you'd like to read in data from a database, these packages are a good place to start. Choose the package that fits your type of database.

XLConnect, xlsx -
These packages help you read and write Micorsoft Excel files from R. You can also just export your spreadsheets from Excel as .csv's.

foreign - Want to read a SAS data set into R? Or an SPSS data set? Foreign provides functions
that help you load data files from other programs into R.

R can handle plain text files – no package required. Just use the functions read.csv, read.table, and read.fwf. If you have even more exotic data, consult the CRAN guide to
data import and export.


To manipulate data

plyr - Essential shortcuts for subsetting, summarizing, rearranging, and joining together data sets. plyr is the
go to package for doing “groupwise” operations with your data.

reshape2 - Tools for changing the layout of your data sets. Use the melt function
to convert your data to long format, the layout R likes best.

stringr - Easy to learn tools for regular expressions and character
strings.

lubridate - Tools that make working with dates
and times easier.


To visualize data

ggplot2 - R's famous package for making beautiful graphics. ggplot2 lets you use thegrammar
of graphics to build layered, customizable plots.

rgl - Interactive 3D visualizations with R

googleVis - Let's you use Google Chart tools to visualize data
in R. Google Chart tools used to be called Gapminder, the graphing software Hans Rosling made famous in hie TED talk.


To model data

car - car's Anova function
is popular for making type II and type III Anova tables.

mgcv - Generalized Additive Models

lme4/nlme -
Linear and Non-linear mixed effects models

randomForest - Random forest methods from machine learning

multcomp - Tools for multiple comparison testing

vcd - Visualization tools and tests for categorical data

glmnet - Lasso and elastic-net regression methods with cross validation

survival - Tools for survival analysis

caret - Tools for training regression and classification models


To report results

shiny - Easily make interactive, web apps with R. A perfect way to explore data and share findings with non-programmers.

knitr - Write R code in your Latex markdown (e.g.
HTML) documents. When you run knit, knitr will replace the code with its results and
then build your document. The result? Automated reporting. Knitr is integrated straight into RStudio.

xtable - The xtable function
takes an R object (like a data frame) and returns the latex or HTML code you need to paste a pretty version of the object into your documents. Copy and paste, or pair up with knitr.

slidify - Slidify lets you build HTML 5 slide shows straight from R. You write your slides in a combination
of R and markdown.


For Spatial data

sp, maptools -
Tools for loading and using spatial data including shapefiles.

maps - Easy to use map polygons for plots.

ggmap - Download street maps straight from Google maps and use them as a
background in your ggplots.


For Time Series and Financial data

zoo - Provides the most popular format for saving time series objects in R.

xts - Very flexible tools for manipulating time series data sets.

quantmod - Tools for downloading financial data, plotting common charts, and doing technical analysis.


To write high performance R code

Rcpp - Write R functions that call C++ code for lightning fast speed.

data.table - An alternative way to organize data sets for very, very fast operations.
Useful for big data.

parallel - Use parallel processing in R to speed up your code
or to crunch large data sets.


To work with the web

XML - Read and create XML documents with R

jsonlite - Read and create JSON data tables with R

httr - A set of useful tools for working with http connections


To write your own R packages

devtools - An essential suite of tools for turning your code into an R package.

testthat - testthat provides an easy way to write unit tests for
your code projects.

roxygen2 - A quick way to document your R packages. roxygen2 turns inline code comments
into documentation pages and builds a package namespace.

You can also read about the entire package development process online in Hadley Wickham's Advanced R Programming Book
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: