Skip to content

Commit 8eb236e

Browse files
committed
Merge pull request #7 from onaio/review_changes
JM: Made changes after reviewing the merged package
2 parents 80c80f0 + 916ac06 commit 8eb236e

File tree

10 files changed

+457
-827
lines changed

10 files changed

+457
-827
lines changed

demo/Basics_of_ona.R.Rmd

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
output:
3+
html_document:
4+
keep_md: yes
5+
---
16
<link href="http://kevinburke.bitbucket.org/markdowncss/markdown.css" rel="stylesheet"></link>
27
An introduction to Ona.R
38
========================================================
@@ -34,7 +39,7 @@ Question: what kind of beast did we just download?
3439
str(good_eats)
3540
```
3641

37-
R tells us something like `'data.frame': 78 obs. of 19 variables:` as well as `Formal class 'onaData' [package ".GlobalEnv"] with 5 slots`. What this means is that onaData objects can be dealt with data.frames (which makes them very convenient!) and well as "objects" with more properties (such as `form`, which is derived from your XLSform). The `form` gives ona.R information about the exact question that was asked, and the type of the question asked (was it `text` or `select one`? or was it a `date`?), which lets the library change the types of the values to make them right, which is basically the power of this package.
42+
R tells us something like `'data.frame': 1103 obs. of 24 variables:` as well as `Formal class 'onaData' [package "ona"] with 5 slots`. What this means is that onaData objects can be dealt with data.frames (which makes them very convenient!) and well as "objects" with more properties (such as `form`, which is derived from your XLSform). The `form` gives ona.R information about the exact question that was asked, and the type of the question asked (was it `text` or `select one`? or was it a `date`?), which lets the library change the types of the values to make them right, which is basically the power of this package.
3843

3944
For simplicity, if you want just a data frame and not this complicated onaData object, you can always use the `data.frame` method.
4045

demo/Basics_of_ona.R.html

Lines changed: 149 additions & 277 deletions
Large diffs are not rendered by default.
14.8 KB
Loading
4.81 KB
Loading

demo/Good_Eats_Example.html

Lines changed: 68 additions & 181 deletions
Large diffs are not rendered by default.

demo/Good_Eats_Example.rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ How about riskiness of the food he is trying and reporting about... has that cha
2424
```{r plot2, warning=FALSE, message=FALSE, fig.height=5, fig.width=7}
2525
qplot(data=good_eats_data, x=submit_date, fill=risk_factor)
2626
```
27-
Looks like it has! mberg's getting riskier as time goes on.
27+
Looks like it has mberg's getting riskier as time goes on.

demo/ReadableData.html

Lines changed: 98 additions & 231 deletions
Large diffs are not rendered by default.

demo/ReadableData.rmd

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ qplot(data=good_eats_readable, x=submit_date, fill=`Risk Factor`)
4242

4343
For multi-lingual forms, the `replaceAllNamesWithLabels` function takes a language argument:
4444
```{r RD.6, warning=FALSE, message=FALSE}
45-
pde <- onaDownload("points_d_eau", "Roxance")
46-
pde_fr <- replaceAllNamesWithLabels(pde, language="French")
47-
qplot(data=pde_fr, x=`A-6.6 Qui gère cette source/ ce point d’eau ?`) +
48-
coord_flip()
45+
waterpoint <- onaDownload("waterpoint", "mberg","mberg")
46+
waterpoint_swa <- replaceAllNamesWithLabels(waterpoint, language="Swahili")
47+
qplot(data=waterpoint_swa,x=`Siku ya kukaguliwa`,y=`Hali ya kisima`)
4948
```

tests/testthat/fixtures/good_eats.csv

Lines changed: 129 additions & 129 deletions
Large diffs are not rendered by default.

tests/testthat/test_ona_funcs.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ test_that("adding photo urls works", {
109109
which(good_eats_with_photo_urls$food_photo_URL_medium == ""))))
110110
# check one of the URLs
111111
expect_equal(subset(good_eats_with_photo_urls, description == "Fistikli")$location_photo_URL_original,
112-
"https://api.ona.io/attachment/?media_file=mberg/attachments/1460139580042.jpg")
112+
"https://api.ona.io/attachment/?media_file=mberg/attachments/1460708481327.jpg")
113113
expect_equal(subset(good_eats_with_photo_urls, description == "Fistikli")$location_photo_URL_medium,
114-
"https://api.ona.io/attachment/medium?media_file=mberg/attachments/1460139580042.jpg")
114+
"https://api.ona.io/attachment/medium?media_file=mberg/attachments/1460708481327.jpg")
115115
expect_equal(subset(good_eats_with_photo_urls, description == "Fistikli")$location_photo_URL_small,
116-
"https://api.ona.io/attachment/small?media_file=mberg/attachments/1460139580042.jpg")
116+
"https://api.ona.io/attachment/small?media_file=mberg/attachments/1460708481327.jpg")
117117
})
118118

0 commit comments

Comments
 (0)