cropdatape

Package cropdatape https://omarbenites.github.io/cropdatape/

https://github.com/omarbenites/cropdatape

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 6 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.6%) to scientific vocabulary

Keywords

agriculture agroinformatics crops database opendata peru potato quinoa rice sweet tomato unalm wheat
Last synced: 9 months ago · JSON representation

Repository

Package cropdatape https://omarbenites.github.io/cropdatape/

Basic Info
  • Host: GitHub
  • Owner: omarbenites
  • License: other
  • Language: R
  • Default Branch: master
  • Homepage:
  • Size: 1.91 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Topics
agriculture agroinformatics crops database opendata peru potato quinoa rice sweet tomato unalm wheat
Created over 9 years ago · Last pushed over 7 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# cropdatape

`cropdatape` provides peruvian agricultural production data from the Agriculture Minestry of Peru (MINAGRI). The first version includes 6 crops: rice, quinoa, potato, sweet potato, tomato and wheat; all of them across 24 departments. Initially,  in excel files which has been transformed and assembled using tidy data principles, i.e. each variable is in a column, each observation is a row and each value is in a cell. The variables variables are sowing and harvest area per crop, yield, production and price per plot, every one year, from 2004 to 2014.


## Installation

You can install `cropdatape` directly from `CRAN`:

```{r, eval=FALSE}
install.packages("cropdatape")

```

Or, you can install from `GitHub`:

```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("omarbenites/cropdatape")
```

The `cropdatape` data frame include 9 variables,

| variable    | meaning                  | units    |
|:------------|:-------------------------|----------|
| crop        | crop                     |  -       |
| department  | deparment or region      |  -       |
| year        | year                     |  -       |
| month       | month                    |  -       |
| sowa        | sowing area              |  ha      |
| harva       | harvested area           |  ha      |
| production  | production               |  t       |
| yield       | yield                    |  kg/ha   |
| pricePlot   | price per plot           |  s/kg    |

### Usage


#### Example 1: Filter, grouped and summarize cropdatape data

In this example, we will explore the cropdatape dataset, using three (dplyr) functionlities: `filter`, `group` and `summarize`. 

1. `filter` crop by `sweet potato`.
2. `group_by` department column.
3. `summarise` by mean of the sweetpotato yield. 

 `cropdatape` package:

```{r,  message = FALSE, warning = FALSE} 
#Load cropdatape package
library(cropdatape)
#Load dplyr package to filter and select information
library(dplyr)
cropdatape %>% 
      filter(crop == "sweet potato") %>% 
      group_by(department, year) %>% 
      summarise(yieldMean = mean(yield, na.rm = TRUE))
```


#### Example 2: Plot graphics with ggplot using cropdatape data

This second example we will explore the behaviour of the `yield` varible grouped by `crop`, from 2004 till 2014. The `crop` variable involves 6 crops: potato, quinoa, rice, sweet potato and wheat. 


```{r example, echo=TRUE, warning=FALSE}
library(cropdatape)
library(ggplot2)
ggplot(cropdatape, aes(x = crop, y = yield)) +
  geom_boxplot(outlier.colour = "hotpink") +
  geom_jitter(position = position_jitter(width = 0.1, height = 0), alpha = 1/4)
```

#### Example 3: Animations with gganimate

To begin with, install the following packages from Github:

```{r,eval=FALSE}
#Install first devtools package
#install.packages("devtools")
library(devtools)
install_github("thomasp85/gganimate")
install_github("thomasp85/transformr")
install_github("thomasp85/tweenr")
```

Then, we will filter all the information related to sweetpotato

```{r, message=FALSE, warning=FALSE}
library(cropdatape)
library(dplyr)

sp <- cropdatape %>% 
      filter(crop == "quinoa", department == "Puno") %>% 
      group_by(department, year) %>% 
      summarise(sowaMean = mean(sowa,na.rm = TRUE), 
                harvaMean = mean(harva, na.rm = TRUE),
                yieldMean = mean(yield, na.rm = TRUE))

```

Plotting and animating the scatter graph `years` vs `yieldMean`

```{r, cache=TRUE, warning=FALSE}
library(gganimate)
library(ggplot2)
library(transformr)
sp$year <- as.integer(sp$year)
yearlbl<- sp$year
ggplot(sp, aes(year, yieldMean)) + 
  geom_point(size= 1.5)+
  scale_x_continuous(breaks = yearlbl)+
  labs(title = 'Year: {frame_time}', x = 'Year', y = 'Yield') +
  transition_time(year) +
  ease_aes('linear')
```

Install and `emojifonts` package: 

```{r,  message=FALSE, warning=FALSE}
devtools::install_github("dill/emoGG")
library(emoGG)
```

Let the animation begins,

```{r, cache=TRUE, warning=FALSE}
library(gganimate)
library(ggplot2)
library(transformr)
sp$year <- as.integer(sp$year)
yearlbl<- sp$year
ggplot(sp, aes(year, yieldMean)) + 
  scale_x_continuous(breaks = yearlbl)+
  geom_emoji(emoji="1f360")+
  labs(title = 'Year: {frame_time}', x = 'Year', y = 'Yield') +
  transition_time(year) +
  ease_aes('linear')
```


Owner

  • Name: Omar Benites Alfaro
  • Login: omarbenites
  • Kind: user
  • Location: Lima-Peru
  • Company: METRIKA

obacc07@gmail.com

GitHub Events

Total
Last Year

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 38
  • Total Committers: 6
  • Avg Commits per committer: 6.333
  • Development Distribution Score (DDS): 0.289
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
omarbenites o****s@g****m 27
Omar Benites Alfaro o****7@h****m 4
giorgiocruz g****b@g****m 4
CHARRLIEM12 2****2@l****e 1
Jossyn Lockuan j****k@g****m 1
GraceKelly1217 2****2@l****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: almost 2 years ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: 22 days
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • omarbenites (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 595 last-month
  • Total docker downloads: 21,613
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: cropdatape

Open Data of Agricultural Production of Crops of Peru

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 595 Last month
  • Docker Downloads: 21,613
Rankings
Forks count: 17.8%
Dependent packages count: 29.8%
Average: 30.8%
Stargazers count: 31.7%
Dependent repos count: 35.5%
Downloads: 39.4%
Maintainers (1)
Last synced: 9 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.3.1 depends
  • knitr * suggests
  • rmarkdown * suggests