what is it?

Factual.com hosts interesting datasets. The factualR package makes it easy for R developers and researchers to work with datasets from Factual.com.

how do I install it?

factualR is available via CRAN, so you can install it directly from an R prompt:

install.packages( "factualR" )

is there a manual?

Yes! The R documentation is available as a PDF on the factualR CRAN page.

You can also see the package’s help pages from an R prompt:


give me the quick rundown: how do I use it?

First, you’ll need to sign up for a Factual developer key.

Next, open R. Load the library and create a connection:

library(factualR) myAPIKey <- "... YOUR Factual.com API KEY ..." factual <- createFactualConnection( myAPIKey )

Browse the Factual data sets and pick one that interests you. Click the “develop” tab and note the “Table Reference.” That will be the tableID. For this example, we’ll use the “Nationwide Restaurants” table, which has table reference 1wStL8.

tableID <- "1wStL8"

now, let’s get an idea of the table’s schema and metadata:

table.meta <- factualGetSchema( factual , tableID ) str(table.meta)

with that in mind, get the table’s data

table.data <- factualRead( factual , tableID )

get an idea of the result object:


that’s great, but we really want to play with the table data. (It’s a data.frame.)


hm, let’s get just 60 rows so we can explore

table.data.small <- factualRead( factual , tableID , limit=60 ) str(table.data.small@results)

let’s use some filters to limit the data we pull. (Notice, the filters are in JSON format. Please see the Factual filter docs for details.)

filters <- '{"city":"New York","state":"NY"}' table.data.filtered <- factualRead( factual , tableID , filters = filters ) str(table.data.small@filtered)