What does “Error: object ” not found” mean?

The error means that R could not find the variable mentioned in the error message. The easiest way to reproduce the error is to type the name of a variable that doesn’t exist. (If you’ve defined x already, use a different variable name.) x ## Error: object ‘x’ not found The more complex version of … Read more

Read SAS sas7bdat data into R

sas7bdat worked fine for all but one of the files I was looking at (specifically, this one); in reporting the error to the sas7bdat developer, Matthew Shotwell, he also pointed me in the direction of Hadley’s haven package in R which also has a read_sas method. This method is superior for two reasons: 1) It … Read more

Set default CRAN mirror permanent in R

You can set repos in your .Rprofile to restore your choice every time you start R Edit: to be more precise: Add options(repos=structure(c(CRAN=”YOUR FAVORITE MIRROR”))) to your .Rprofile Alternatively, you can set the mirror site-wide in your Rprofile.site. The location of the file is given by ?Startup: The path of this file is taken from … Read more

How to get help in R?

Getting help on a function that you know the name of Use ? or, equivalently, help. ?mean help(mean) # same For non-standard names use quotes or backquotes; see An Introduction to R: Getting help with functions and features: For a feature specified by special characters, the argument must be enclosed in double or single quotes, … Read more

What does “S3 methods” mean in R?

Most of the relevant information can be found by looking at ?S3 or ?UseMethod, but in a nutshell: S3 refers to a scheme of method dispatching. If you’ve used R for a while, you’ll notice that there are print, predict and summary methods for a lot of different kinds of objects. In S3, this works … Read more