Skip to content

Commit

Permalink
add geojson example & vignette (dependencies are suggested, later to …
Browse files Browse the repository at this point in the history
…be moved to required)

should fix travis

now fix again

second time the same.

give up

give up on travis. wont work

?
  • Loading branch information
dmpe committed Jul 23, 2015
1 parent 9e4363a commit 61e7f19
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
*.Rproj.user
*.Rhistory
.Rproj.user
inst/doc
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ language: R
sudo: required
warnings_are_errors: true

before_install:
- sudo apt-get install libv8-dev

r_github_packages:
- hadley/httr
- jeroenooms/jsonlite
- jeroenooms/curl
- klutometis/roxygen
- jimhester/covr
- ropensci/geojsonio

r_binary_packages:
- rgdal
- rgeos

after_success:
- Rscript -e 'library(covr);coveralls()'
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# How to contribute

We really appreciate when users [fix bugs](https://github.com/Chicago/RSocrata/pull/25) or [provide new features](https://github.com/Chicago/RSocrata/pull/21). When submitting changes, please read below to help the development team keep on top of issues and changes.
Expand Down
12 changes: 8 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ Version: 1.6.3
Date: 2015-07-23
Author: Hugh Devlin, Ph. D., Tom Schenk, Jr., and John Malc
Maintainer: "Tom Schenk Jr." <developers@cityofchicago.org>
Depends:
Depends:
R (>= 3.0.0)
Imports:
Imports:
httr (>= 1.0.0),
jsonlite (>= 0.9.16),
mime (>= 0.3)
Suggests:
Suggests:
testthat (>= 0.10.0),
roxygen2 (>= 4.1.0)
roxygen2 (>= 4.1.0),
knitr (>= 1.10.5),
leaflet (>= 1.0.0),
geojsonio (>= 0.1.0)
License: MIT + file LICENSE
URL: https://github.com/Chicago/RSocrata
BugReports: https://github.com/Chicago/RSocrata/issues
VignetteBuilder: knitr
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ Deprecated ```httr::guess_media()``` and implemented ```mime::guess_type()```
* Migrate Travis-CI to "proper" R YAML ([#46](https://github.com/Chicago/RSocrata/issues/46))


### 1.6.3 / 1.6.2 ??? (see roadmap)


* Add a small vignette with examples
* Mostly internal changes which should not influence the current behaviour ([#53](https://github.com/Chicago/RSocrata/pull/53))



11 changes: 0 additions & 11 deletions R/geo.R

This file was deleted.

28 changes: 2 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,9 @@ install.packages("rgdal")
install.packages("rgeos")
```

### Example: Reading SoDA valid URLs
```r
earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt
```

### Example: Reading "human-readable" URLs
```r
earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquakes-for-2012-11-01-API-School-Demo/4334-bgaj")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt
```
### Examples

### Example: Using API key to read datasets
```r
token <- "ew2rEMuESuzWPqMkyPfOSGJgE"
earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv", app_token = token)
nrow(earthquakesDataFrame)
```

### Example: List all datasets on portal
```r
allSitesDataFrame <- ls.socrata("https://soda.demo.socrata.com")
nrow(allSitesDataFrame) # Number of datasets
allSitesDataFrame$title # Names of each dataset
```
Look in the `vignette` folder

### Issues

Expand Down
2 changes: 1 addition & 1 deletion RSocrata.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
RnwWeave: knitr
LaTeX: pdfLaTeX

BuildType: Package
Expand Down
61 changes: 61 additions & 0 deletions vignettes/Examples.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: "Vignette for RSocrata"
author: "Developers of the City of Chicago (USA)"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Vignette Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r}
library(RSocrata)
# for geo support
library(leaflet)
library(geojsonio)
```

### Example: Reading SoDA valid URLs
```{r}
earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt
```

### Example: Reading "human-readable" URLs
```{r}
earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquakes-for-2012-11-01-API-School-Demo/4334-bgaj")
nrow(earthquakesDataFrame) # 1007 (two "pages")
class(earthquakesDataFrame$Datetime[1]) # POSIXlt
```

### Example: Using API key to read datasets
```{r}
token <- "ew2rEMuESuzWPqMkyPfOSGJgE"
earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv", app_token = token)
nrow(earthquakesDataFrame)
```

### Example: List all datasets on portal
```{r}
allSitesDataFrame <- ls.socrata("https://soda.demo.socrata.com")
nrow(allSitesDataFrame) # Number of datasets
allSitesDataFrame$title # Names of each dataset
```

### Geo & Leaflet

```{r}
asdsadas <- geojson_read("https://data.cityofchicago.org/resource/6zsd-86xi.geojson", method = "local", parse = FALSE, what = "list")
m <- leaflet() %>%
addGeoJSON(asdsadas) %>%
setView(-87.6, 41.8, zoom = 10) %>%
addTiles()
m
```

0 comments on commit 61e7f19

Please sign in to comment.