{"id":32206132,"url":"https://github.com/omarbenites/cropdatape","last_synced_at":"2026-02-22T10:41:20.426Z","repository":{"id":56937529,"uuid":"78045450","full_name":"omarbenites/cropdatape","owner":"omarbenites","description":"Package cropdatape https://omarbenites.github.io/cropdatape/","archived":false,"fork":false,"pushed_at":"2018-12-04T04:13:57.000Z","size":2004,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T05:16:05.100Z","etag":null,"topics":["agriculture","agroinformatics","crops","database","opendata","peru","potato","quinoa","rice","sweet","tomato","unalm","wheat"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omarbenites.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-04T19:18:59.000Z","updated_at":"2025-03-22T08:13:53.000Z","dependencies_parsed_at":"2022-08-21T07:20:45.800Z","dependency_job_id":null,"html_url":"https://github.com/omarbenites/cropdatape","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/omarbenites/cropdatape","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omarbenites%2Fcropdatape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omarbenites%2Fcropdatape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omarbenites%2Fcropdatape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omarbenites%2Fcropdatape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omarbenites","download_url":"https://codeload.github.com/omarbenites/cropdatape/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omarbenites%2Fcropdatape/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29709836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T10:34:24.778Z","status":"ssl_error","status_checked_at":"2026-02-22T10:32:23.200Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agriculture","agroinformatics","crops","database","opendata","peru","potato","quinoa","rice","sweet","tomato","unalm","wheat"],"created_at":"2025-10-22T05:04:38.114Z","updated_at":"2026-02-22T10:41:20.418Z","avatar_url":"https://github.com/omarbenites.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\n```\n\n# cropdatape\n\n`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.\n\n\n## Installation\n\nYou can install `cropdatape` directly from `CRAN`:\n\n```{r, eval=FALSE}\ninstall.packages(\"cropdatape\")\n\n```\n\nOr, you can install from `GitHub`:\n\n```{r gh-installation, eval = FALSE}\n# install.packages(\"devtools\")\ndevtools::install_github(\"omarbenites/cropdatape\")\n```\n\nThe `cropdatape` data frame include 9 variables,\n\n| variable    | meaning                  | units    |\n|:------------|:-------------------------|----------|\n| crop        | crop                     |  -       |\n| department  | deparment or region      |  -       |\n| year        | year                     |  -       |\n| month       | month                    |  -       |\n| sowa        | sowing area              |  ha      |\n| harva       | harvested area           |  ha      |\n| production  | production               |  t       |\n| yield       | yield                    |  kg/ha   |\n| pricePlot   | price per plot           |  s/kg    |\n\n### Usage\n\n\n#### Example 1: Filter, grouped and summarize cropdatape data\n\nIn this example, we will explore the cropdatape dataset, using three (dplyr) functionlities: `filter`, `group` and `summarize`. \n\n1. `filter` crop by `sweet potato`.\n2. `group_by` department column.\n3. `summarise` by mean of the sweetpotato yield. \n\n `cropdatape` package:\n\n```{r,  message = FALSE, warning = FALSE} \n#Load cropdatape package\nlibrary(cropdatape)\n#Load dplyr package to filter and select information\nlibrary(dplyr)\ncropdatape %\u003e% \n      filter(crop == \"sweet potato\") %\u003e% \n      group_by(department, year) %\u003e% \n      summarise(yieldMean = mean(yield, na.rm = TRUE))\n```\n\n\n#### Example 2: Plot graphics with ggplot using cropdatape data\n\nThis 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. \n\n\n```{r example, echo=TRUE, warning=FALSE}\nlibrary(cropdatape)\nlibrary(ggplot2)\nggplot(cropdatape, aes(x = crop, y = yield)) +\n  geom_boxplot(outlier.colour = \"hotpink\") +\n  geom_jitter(position = position_jitter(width = 0.1, height = 0), alpha = 1/4)\n```\n\n#### Example 3: Animations with gganimate\n\nTo begin with, install the following packages from Github:\n\n```{r,eval=FALSE}\n#Install first devtools package\n#install.packages(\"devtools\")\nlibrary(devtools)\ninstall_github(\"thomasp85/gganimate\")\ninstall_github(\"thomasp85/transformr\")\ninstall_github(\"thomasp85/tweenr\")\n```\n\nThen, we will filter all the information related to sweetpotato\n\n```{r, message=FALSE, warning=FALSE}\nlibrary(cropdatape)\nlibrary(dplyr)\n\nsp \u003c- cropdatape %\u003e% \n      filter(crop == \"quinoa\", department == \"Puno\") %\u003e% \n      group_by(department, year) %\u003e% \n      summarise(sowaMean = mean(sowa,na.rm = TRUE), \n                harvaMean = mean(harva, na.rm = TRUE),\n                yieldMean = mean(yield, na.rm = TRUE))\n\n```\n\nPlotting and animating the scatter graph `years` vs `yieldMean`\n\n```{r, cache=TRUE, warning=FALSE}\nlibrary(gganimate)\nlibrary(ggplot2)\nlibrary(transformr)\nsp$year \u003c- as.integer(sp$year)\nyearlbl\u003c- sp$year\nggplot(sp, aes(year, yieldMean)) + \n  geom_point(size= 1.5)+\n  scale_x_continuous(breaks = yearlbl)+\n  labs(title = 'Year: {frame_time}', x = 'Year', y = 'Yield') +\n  transition_time(year) +\n  ease_aes('linear')\n```\n\nInstall and `emojifonts` package: \n\n```{r,  message=FALSE, warning=FALSE}\ndevtools::install_github(\"dill/emoGG\")\nlibrary(emoGG)\n```\n\nLet the animation begins,\n\n```{r, cache=TRUE, warning=FALSE}\nlibrary(gganimate)\nlibrary(ggplot2)\nlibrary(transformr)\nsp$year \u003c- as.integer(sp$year)\nyearlbl\u003c- sp$year\nggplot(sp, aes(year, yieldMean)) + \n  scale_x_continuous(breaks = yearlbl)+\n  geom_emoji(emoji=\"1f360\")+\n  labs(title = 'Year: {frame_time}', x = 'Year', y = 'Yield') +\n  transition_time(year) +\n  ease_aes('linear')\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomarbenites%2Fcropdatape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomarbenites%2Fcropdatape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomarbenites%2Fcropdatape/lists"}