UCLA has a really amazing resource for learning longitudinal data analysis in R using examples and data from Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence by Judith D. Singer and John B. Willett.
We had a nice chat about the uses of regular expressions in R, and determined we use them mainly for dealing with messy data files, or mutating the file names of data files, and for doing some linguistics data analysis tasks. That doesn’t sound like much, but they’re really amazing, and once you’ve started to use them, you’ll wonder how you ever went without.
Check out some of the useful base R functions that make use of them with ?grep:
‘grep’, ‘grepl’, ‘regexpr’ and ‘gregexpr’ search for matches to
argument ‘pattern’ within each element of a character vector: they
differ in the format of and amount of detail in the results.
‘sub’ and ‘gsub’ perform replacement of the first and all matches
And if you use tidyr, you’ll love to use them with extract.
How do you get started? Check out RegexOne. Once you complete all the lessons you’ll be set for a good long while. There are many other resources on the Internet.
Note well for regular expression usage in R: You’ll learn that backslash (\) gets used a lot in regular expressions. Well, it’s also a special character in R (for example, newline is '\n'). For that reason, when you write regular expressions in R, you need to use 2 slashes – so '\w' should actually be '\\w'.
When plot.ly first hit the scene, I was like, woah, this is awesome, knitrsupport and everything!
I recently asked them about building better dashboards, and they sent me this info — apparently there is some support for integrating plot.ly graphs into shiny apps, if you’re already comfortable building shiny apps.
I’m hoping they start building in functionality that will make it even easier to integrate custom sliders and drop-downs for messing with graphs on the fly. For now, though, it’s still a really nice way to make your R output more interactive.
install.packages("devtools") # so we can install from GitHub
devtools::install_github("ropensci/plotly") # plotly is part of rOpenSci
py <- plotly(username="jflournoy", key="mg34ox914h") # open plotly connection
# I'll change my key after this, but you can still use: plotly(username="r_user_guide", key="mw5isa4yqp")
# Or just sign up for your own account!
gg <- ggplot(iris) +
#This looks a little object-oriented like python
You can embed code like this (which you get from the plotly ‘share’ dialogue):
This is Shahar’s distance contribution to R Club. (Thanks, Shahar!)
This catalog allows you to choose which graph you like best and gives you the code for that graph. You can also filter by things like Good vs. Bad graphs, type of graph, and different features that you might like to include (like subscripts and multiple plots).