31
Getting Involved in the R Community
Sometimes, no matter how hard you search for help in the mailing list
archives, blogs, or other relevant material, you’re still stuck. If this ever happens to
you, you may want to tap into the R community. R has a very active community
made up of people who not only write and share code, but also are very willing to
help other R users with their problems.
Using the R mailing lists
The R Development Core Team actively supports four different mailing lists. At
www.r-project.org/mail.html
, you can find up-to-date information about these
lists, as well as find links to subscribe or unsubscribe from the lists. When you
subscribe to a mailing list, you can choose to receive either individual e-mail
messages or a daily digest.
The four important mailing lists are
R-help: This is the main R Help mailing list. Anyone can register and post
messages on this list, and people discuss a wide variety of topics (for example,
how to install packages, how to interpret R’s output of statistical results, or what
to do in response to warnings and error messages).
R-announce: This list is for announcements about significant developments in
the R code base.
R-packages: This list is where package authors can announce news about their
packages.
R-devel: This is a specialist mailing list aimed at developers of functions or new
R packages — in other words, serious R developers! It’s more about
programming than about general topics.
Before posting a message to any of the R mailing lists, make sure that you
read the posting guidelines, available at
www.r-project.org/posting-
guide.html
. In particular, make sure you include a good, small, reproducible
example (see “Making a Minimal Reproducible Example,” later in this chapter).
VB.NET PDF - Convert CSV to PDF C#.NET rotate PDF pages, C#.NET search text in PDF to batch convert multiple RTF files to adobe PDF files. are able to convert RTF to PDF programmatically with VB
convert pdf to word searchable text; select text in pdf
41
In addition to these general mailing lists, you also can participate in about 20
special interest group mailing lists. See the sidebar “Special interest group mailing
lists” for more information.
Special interest group mailing lists
The R mailing list website
www.r-project.org/mail.html
also contains links
to more than 20 mailing lists for special interest groups. We list them here by
topic:
Operating systems:
R-SIG-Mac: Mac ports of R
R-SIG-Debian: Debian ports of R
R-SIG-Fedora: Fedora and Redhat ports of R
Advanced modeling:
R-sig-dynamic-models: Dynamic simulation models in R
R-sig-Epi: Epidemiological data analysis
R-sig-ecology: Ecological data analysis
R-sig-gR: Graphical models
R-sig-networks: Network- or graph-related software within R
R-sig-phylo: Phylogenetic and comparative methods and analyses
R-sig-Robust: Robust statistics
R-sig-mixed-models: Mixed effect models, notably
lmer()
-related
Fields of application for R:
R-SIG-Finance: Finance
R-sig-Geo: Geographical data and mapping
Specialist development:
R-sig-DB: Database Interfaces
R-SIG-GUI: GUI development
R-SIG-HPC: High-performance computing
Other:
R-sig-Jobs: Announcements of jobs where R is used
R-sig-mediawiki: The R extension for MediaWiki
R-sig-QA: Quality assurance and validation
R-sig-teaching: Teaching statistics (and more) using R
R-sig-Wiki: The development of an “R wiki”
Discussing R on Stack Overflow and Stack Exchange
Stack Exchange (
www.stackexchange.com
) is a popular website where people
C# PowerPoint - PowerPoint Creating in C#.NET to Create New PowerPoint File and Load PowerPoint from Other Files. searchable and can be fully populated with editable text and graphics programmatically.
select text in pdf reader; text searchable pdf C# Word - Word Creating in C#.NET Users How to Create New Word File and Load Word from Other Files. is searchable and can be fully populated with editable text and graphics programmatically.
find text in pdf image; can't select text in pdf file
34
can ask and answer questions on a variety of topics. It’s really a network of sites.
Two of the Stack Exchange sites have substantial communities of people asking
and answering questions about R:
Stack Overflow (
www.stackoverflow.com
): Here, people discuss programming
questions in a variety of programming languages, such as C++, Java, and R.
CrossValidated (
http://stats.stackexchange.com
): Here, people discuss
topics related to statistics and data visualization. Because R really excels at
these tasks, there is a growing community of R coders on CrossValidated.
Both of these sites use tags to identify topics that are discussed. Both sites
use the
[r]
tag to identify questions about R. To find these questions,
navigate to the Tags section on the page and type r in the search box.
Tweeting about R
If you want to join the discussion about R on Twitter (
www.twitter.com
), follow
and use the hashtag #rstats. This hashtag attracts discussion from a wide variety
of people, including bloggers, package authors, professional R developers, and
other interested parties.
Making a Minimal Reproducible Example
When you ask the R community for help, you’ll get the most useful advice if
you know how to make a minimal reproducible example. A reproducible example is
a sample of code and data that any other user can run and get the same results as
you do. A minimal reproducible example is the smallest possible example that
illustrates the problem; it consists of the following:
A small set of sample data
A short snippet of code that reproduces the error
The necessary information on your R version, the system it’s being run on, and
the packages you’re using
C# Word - Word Create or Build in C#.NET C#.NET using this Word document creating toolkit, if you need to add some text and draw Create Word Document from Existing Files Using C#. Create Word From PDF.
find and replace text in pdf file; cannot select text in pdf file
36
If you want to know what a minimal reproducible example looks like, take a
look at the examples in the R Help files. In general, all the code given in the R
Help files fulfills the requirements of a minimal reproducible example.
Creating sample data with random values
In most cases, you can use random data to illustrate a problem. R has some
useful built-in functions to generate random numbers and other random data.
For example, to make a vector of random numbers, use
rnorm()
for the normal
distribution or
runif()
for a uniform distribution. To make a random vector
with five elements, try the following:
> set.seed(1)
> x <- rnorm(5)
> x
[1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078
You can use the
set.seed()
function to specify a starting seed value for
generating random numbers. By setting a seed value, you guarantee that the
random numbers are the same each time you run the code. This sounds a bit
pointless, doesn’t it? It may be pointless in production code, but it’s essential
for a reproducible example. By setting a seed, you guarantee that your code
will produce the same results as another person running your code.
If you want to generate random values of a predetermined set, use the
sample()
function. This function is a bit like dealing from a deck of playing
cards. In a card game, you have 52 cards and you know exactly which cards
are in the deck. But each deal will be different. You can simulate dealing a
hand of seven cards using the following code:
> cards <- c(1:9, “J”, “Q”, “K”, “A”)
> suits <- c(“Spades”, “Diamonds”, “Hearts”, “Clubs”)
> deck <- paste(rep(suits, each=13), cards)
> set.seed(123)
> sample(deck, 7)
43
[1] “Diamonds 2” “Clubs 2” “Diamonds 8” “Clubs 5”
[5] “Clubs 7” “Spades 3” “Diamonds K”
By default,
sample()
uses each value only once. But sometimes you want
elements of this section to appear multiple times. In this case, you can use the
argument
replace=TRUE
. If you want to create a sample of size 12 consisting of the
first three letters of the alphabet, you use the following:
> set.seed(5)
> sample(LETTERS[1:3], 12, replace=TRUE)
[1] “A” “C” “C” “A” “A” “C” “B” “C” “C” “A” “A” “B”
Creating a
data.frame
with sample data is straightforward:
> set.seed(42)
> dat <- data.frame(
+ x = sample(1:5),
+ y = sample(c(“yes”, “no”), 5, replace = TRUE)
+ )
> dat
x y
1 5 no
2 4 no
3 1 yes
4 2 no
5 3 no
How to use a copy of your own data
Sometimes you have to use a small set of your real-world data in an
example. On these occasions, you can first create a subset of your data and
then use the function
dput
to get an ASCII representation of your data. Then
you can paste this representation in your question to the community. As an
example, take the built in dataset
cars
and create an ASCII representation of
the first four rows:
> dput(cars[1:4, ]) > structure(list(speed = c(4, 4,
7, 7), + dist = c(2, 10, 4, 22)), + .Names = c(“speed”,
“dist”), + row.names = c(NA, 4L), + class = “data.frame”)
Producing minimal code
38
The hardest part of producing a minimal reproducible example is to keep it
minimal. The challenge is to identify the smallest example (the fewest lines of
code) that reproduces the problem or error.
Before you submit your code, make sure to describe clearly which packages
you use. In other words, remember to include the
library()
statements. Also,
test your code in a new, empty R session to make sure it runs without error.
People should be able to just copy and paste your data and your code in the
console and get exactly the same results as you get.
Providing the necessary information
Including a little bit of information about your R environment helps people
answer your questions. You should consider supplying the following:
Your R version (for example, R 2.13-1)
Your operating system (for example, Windows 7 64-bit)
The function
sessionInfo()
prints information about your version of R and
some locale information, as well as attached or loaded packages. Sometimes
the output of this function can help you determine whether there are conflicts
between your loaded packages. Here’s an example of the results of
sessionInfo()
:
> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] rj_1.0.2-5 devtools_0.5.1
loaded via a namespace (and not attached):
13
[1] RCurl_1.6-10.1 tools_2.14.1
The results tell you that this session is running R version 2.14 on 64-bit
Windows, with a United Kingdom locale. You also can see that R has loaded two
packages: package
rj
(version 1.0.2-5) and package
devtools
(version 0.5.1).
Sometimes it’s helpful to include the results of
sessionInfo()
in your question,
because other R users can then tell whether there could be an issue with your R
installation.
15
Part IV
Making the Data Talk
In this part . . .
R has earned its status as one of the leading statistical packages for a reason.
Statisticians use it to extract meaningful relationships from sometimes gigabytes of
available data in a variety of ways. For them, R is often the right tool to convert a
bunch of numbers into an interesting story.
In this part, you meet a small selection of tools that allow you to tell the story
of your data. You get to subset, combine, and restructure your data; summarize it
in meaningful ways; and use the power of statistics to test your hypotheses on the
data at hand.
Because thousands of people continue to develop new statistical techniques
and write new R packages, this section covers only a tiny spectrum of possible
analyses. But you do get insight into how you formulate tests and what you can do
with the resulting objects.
Documents you may be interested
Documents you may be interested