Toggle navigation
Home
▼ Details
Products and pricing
Chart gallery
User stories
Text analytics
CDC NAMCS Library
Blog
Tutorials
Contact
Sign in
Post Editor
← All blog posts
View post
Save
<p>Protobi is not just a pretty face for the data, it also provides a full-featured language for data cleaning and reshaping prior to analysis.</p> <p>No matter how carefully you design a survey there are almost always changes you need to make to the data once it comes back:</p> <ul> <li>combine multiple waves of an ATU</li> <li>merge in translations for text open-ends in other languages</li> <li>stack patient cases</li> <li>calculate time intervals</li> <li>define segmentations</li> <li>remove outliers</li> <li>zero-fill skipped values</li> <li>...</li> </ul> <p>You can now do all of the above (and more) within Protobi. </p> <p>Previously you might have used SPSS, R, or external vendors to do this externally. You can still do that, and upload the results to Protobi as you wish. </p> <p>But now you can also keep all your processing code in one place, integrated with your analysis, and documented.</p> <p>Strapped for time? We're happy to set up your data cleaning and reshaping for you, and show your analysts how to edit or author it. <!--more--></p> <h1 id="a-simple-example">A simple example</h1> <p>Let's say our survey asked respondents two questions:</p> <ul> <li>Q1: Do you have any pets? <strong>[Yes/No]</strong></li> <li>Q2: How many pets do you have? <strong>[1-999] [Ask only if Q1=Yes]</strong></li> </ul> <p>At analysis time we'd like to report the average number of pets in Q2. But the challenge is Q2 has blank values for people who don't have pets, throwing off the average. So we'd like to recode those missing values to zero.</p> <p>Under the Admin pages for the study, there's a tab "Pre-calculate". In the code area, enter the following:</p> <pre><code class="lang-js"> rows.forEach(function(row) { if (row.Q1==2) row.Q2 = 0; // set pet count to zero if no pets }) return rows; </code></pre> <p>Protobi loads your data into an variable <code class=js>rows</code>. This is an array of objects, where each object represents a row of your data.</p> <p>The code above iterates over each row of your data. Within the function, you can access columns by name. So <code>row.Q1</code> is the response to Question 1 for that row.</p> <h1 id="a-more-advanced-example">A more advanced example</h1> <p>Let's say you surveyed boat owners and asked:</p> <ul> <li>Q1: On what date did you purchase your most recent boat?</li> <li>Q2: On what date did you sell your boat? [leave blank if not sold]</li> </ul> <p>But for analysis, maybe you don't want the dates but the duration in months that they owned the boat. And if the boat isn't sold, use the survey field date from the dataset.</p> <pre><code class="lang-js"> rows.forEach(function(row) { row.Q2_dur = moment(row.Q2 || row.field_date ).diff(row.Q1, 'months') }) return rows; </code></pre> <p>Voila, your dataset now has a new column <code>Q2_dur</code> with the months of ownership.</p> <h1 id="javascript-syntax">Javascript syntax</h1> <p>Protobi runs in your browser, which gives you access to a full programming language called Javascript that gives you tremendous capability. For instance, above we used the library <a href="https://momentjs.com/">moment.js</a> which can do advanced date calculations. But there are many other web libraries you can use too.</p> <h1 id="spss-syntax">SPSS syntax</h1> <p>Are you already proficient in SPSS? Protobi can execute SPSS core syntax! Here's the same example in SPSS...</p> <pre><code class="lang-spss"> if (Q1 = 2) Q2 = 3. </code></pre> <h1 id="r-integration">R integration</h1> <p>Are you proficient in R? You can keep running R as you always have. Your R code can get data from Protobi and post the processed data back.</p> <pre><code class="lang-R">data <- protobi.download(projectId=<ID>, apiKey=<KEY>) # ...your code here... protobi.upload(data, key="main", projectId=<ID>, apiKey=<KEY>) </code></pre> <p>Here <code><ID></code> is an identifier you can get from the project URL, and <code><KEY></code> is a secret key that you can generate on your <a href="https://app.protobi.com/account">account page</a>.</p> <h1 id="advanced-recoding">Advanced recoding</h1> <p>There's a lot more that's possible. We have great docs and examples. But for your project, let us show you what's possible for your data.</p> <style> code, code.lang-js { font-family: courier, monospace; color: #444 !important; font-weight; bold; background-color: #f5f5f5; font-size:12px; } </style>
Date
Status
Published
Draft
Slug
edit
Thumbnail
Categories
Manage
Release
Features
Datasets
Surveys
Tips
NAMCS
Applications
Crosstab
Tutorial
Design
Concepts
Segmentation
Examples
Blog Test Category
Delete
Convert to MD