- Home
- Interview Questions
- R Programming
Read in the text as a character vector wih readLines, call str_count to count the number of instances in each line, and sum the total.
with, within, transform, and mutate all allow manipulating columns and adding columns to data frames, as well as standard assignment.
Casting. Not freezing!
Use order or arrange.
Define a function that reads TRUE when you have a positive number—for example, is.positive <- function(x) x > 0—and call Find(is.positive, x).
min returns the single smallest value of all its inputs. pmin accepts several vectors that are the same length, and returns the smallest at each point along them.
Pass the pch (“plot character”) argument.
Use a formula of the form y ~ x.
An aesthetic specifies a variable that you will look at a variation in. Most plots take an x and a y aesthetic for x and y coordinates, respectively. You can also specify color aesthetics or shape aesthetics (where more than two variables are to be looked at at once, for example).
Histograms, box plots, and kernel density plots were all mentioned in the chapter. There are some other weirdly esoteric plots, like violin plots, rug plots, bean plots, and stem-and-leaf plots, that weren’t mentioned. Have 100 geek points for each of these that you guessed.