Toggle navigation
Home
▼ Details
Products and pricing
Chart gallery
User stories
Text analytics
CDC NAMCS Library
Blog
Tutorials
Contact
Sign in
Post Editor
← All help posts
View post
Save
<img src="/uploads/upload/image/5200/direct/1571156395047-R%20library.png" alt="R programming language logo featuring large blue letter 'R' with gray oval background, representing the R statistical computing environment used with Protobi library for data import/export." style="width: 120px;" class="fr-fic fr-dib"> [Protobi R library](https://github.com/protobi/protobi-r "Go to Protobi R library") Use Protobi R library to import/export data between R and Protobi. Survey datasets are never final, there's always some cleaning, reshaping, additional variables, to create, etc. While much, or even all, of this can be done in the Protobi app itself, if R is your preferred language you may prefer to work in R. This utility makes it easy to download data from Protobi as a dataframe, attach variable labels and value formats as titles and factors, and upload the revised dataframe back to Protobi. ## [](https://github.com/protobi/protobi-r#install-the-package)Install the Protobi R library You can install the protobi library directly from GitHub using `devtools`. At the R command prompt issue the following command: ``` # Install packages install.packages("devtools") # Install devtools (once) devtools::install_github("protobi/protobi-r") # Install Protobi R Library (once) ``` ## Download data from Protobi The library will download data from your project into an R data frame. Options allow you to attach variable labels as titles and value formats as factors: ``` PROJECTID <- '5db09d115b989e00035ab0c7' ## Unique identifier for project from URL TABLEKEY <- 'processed' ## Identifier for data table from Data tab APIKEY <- 'xxxxxxxx-xxxx-xxxx-xxxxxxxx' ## See your Protobi account page for API key data <- protobi_get_data(PROJECTID, TABLEKEY, APIKEY, formats=TRUE, titles=TRUE) ``` ## [](https://github.com/protobi/protobi-r#parameters) The PROJECTID identifies your project and can be found in the project URL. The TABLEKEY is the unique identifier for the data table and can be found in the Data tab under Project Settings. The APIKEY uniquely identifies you and authenticates you to the server. **Keep this secret!** You can get an API key under "My Account" within Protobi. ## [](https://github.com/protobi/protobi-r#use) ## Upload data to Protobi To upload a dataframe to a Protobi project. If a data table corresponding to TABLEKEY does not exist, it will be created. If not it will be updated in place. ``` protobi.put_data(data, PROJECTID, TABLEKEY, APIKEY) ``` ## [](https://github.com/protobi/protobi-r#contribute)
Publishing
Date
Status
Published
Draft
Slug
edit
Content
Thumbnail
Categories
Manage
New to Protobi?
Charts
Making Changes
Intermediate topics for editors
Frequently Asked Questions
SERMO Topics
Tutorial Pages
Internal Docs
Data Processing
Videos
Obsolete
GSG Admin
SERMO Admin
GSG Topics
How to...
Basics for viewers
Basics for editors
For project admins
Advanced topics
Assessments
Articles (in-progress)
New and updated articles
Process data in Protobi
superseded
Text open-end questions
Troubleshooting
Tracking studies
Organizing the view
API References
Tools
AI Database
Checking AI...
Convert to MD
Danger zone
Delete