Code Monkey home page Code Monkey logo

afrilearnr's Introduction

afrilearnr

A growing collection of interactive learnr tutorials for making African maps.

Online tutorials :

tutorial name outline recommended order
intro-to-spatial-r an introduction to spatial data in R 1
get-my-data-in getting your own spatial data into R 2
join-admin dealing with data referenced by names rather than coordinates 3
afrilearnr-crash-course gallery of plots & code with minimal explanation 4
proposed :
colour-my-map changing map colours in different map packages
data-manipulation manipulating your data to allow making different maps
map-my-study-area making a simple map to show where a study area is

If you would like to suggest a tutorial for this collection, or contribute one, please get in touch.

The tutorials are saved as a package that can also be installed and run locally in RStudio.

Getting started

  1. Install the package from GitHub from the R console.
# install.packages("remotes") # if not already installed
remotes::install_github("afrimapr/afrilearnr")
  1. Load the package
library(afrilearnr)
  1. In RStudio Click on the Tutorial tab at the top right, choose an afrilearnr tutorial, and click Start Tutorial ?

Alternatively you can start a tutorial by name from the R console :

learnr::run_tutorial("join-admin", "afrilearnr")

afrilearnr's People

Contributors

andysouth avatar annemtreasure avatar laurielbaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

afrilearnr's Issues

test deployment to shinyapps.io results in gdal error

processing file: intro-to-spatial-r.Rmd
Quitting from lines 48-62 (intro-to-spatial-r.Rmd)
Error in value[3L] :
OGRCreateCoordinateTransformation() returned NULL: PROJ available?
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
In addition: Warning message:
In CPL_transform(x, crs, aoi, pipeline, reverse) :
GDAL Error 1: No PROJ.4 translation for source SRS, coordinate transformation initialization has failed.
Execution halted

make whole tutorials printable to pdf

To provide a backup option for learners with a poor internet connection we'd like to be able to email them a pdf of the tutorial.

We'd like a solution where we can easily generate a pdf so that we can redo it whenever the tutorial changes (which is frequently in initial development).

Adding print.css from rstudio/learnr#465 to https://github.com/afrimapr/afrilearnr/tree/main/inst/tutorials/intro-to-spatial-r doesn't seem to work.

From Chrome printing the hosted tutorial https://andysouth.shinyapps.io/intro-to-spatial-r to pdf just prints the first topic.

Error in intro-to-spatial-r tutorial

Hi @andysouth ,

When running the code for the intro-to-spatial-r tutorial (on a mac):

learnr::run_tutorial("intro-to-spatial-r", "afrilearnr")

I get the following message:

Listening on http://127.0.0.1:4651
Warning: Error in if: argument is of length zero
  72: ui

and this opens in a browser window:

error

OGRCreateCoordinateTransformation() returned NULL: PROJ available? from shinyapps when user runs code in intro-to-spatial-r

Recurrence of problem in #2

Occurs because of older versions of spatial packages on shinyapps.io

Resetting the crs of objects is solution. But seemingly doing that earlier in the tutorial doesn't persist ???

sf::st_crs(africapitals) <- 4326

#https://stackoverflow.com/questions/61286108/error-in-cpl-transformx-crs-aoi-pipeline-reverse-ogrcreatecoordinatetrans
#If you save an sf-dataframe with a newer version of GDAL, and then try on a system with an older version of GDAL, the projection info cannot be read properly.
#The solution is to re-set the projection:
#st_crs(data) <- 4326

see r-spatial/sf#1419 (comment)

Get-my-data-in execution halted

When running the following code and also when following instructions in the afrilearnr README file I get the error below:

learnr::run_tutorial("get-my-data-in", "afrilearnr")

processing file: get-my-data-in.Rmd
  |.....                                                                                                          |   5%
  ordinary text without R code

  |..........                                                                                                     |   9%
label: setup (with options) 
List of 1
 $ include: logi FALSE

  |...............                                                                                                |  14%
  ordinary text without R code

  |....................                                                                                           |  18%
label: packages (with options) 
List of 1
 $ echo: logi TRUE

  |.........................                                                                                      |  23%
  ordinary text without R code

  |..............................                                                                                 |  27%
label: csv-airports (with options) 
List of 2
 $ exercise     : logi TRUE
 $ exercise.eval: logi TRUE

Quitting from lines 88-104 (get-my-data-in.Rmd) 
Error: '' does not exist in current working directory ('/home/talarify/R/x86_64-pc-linux-gnu-library/4.0/afrilearnr/tutorials/get-my-data-in').

There is no way to recover and try an alternative tutorial if I click on Tutorial -> run tutorial in the tutorial tab. A "Loading tutorial" message appears with a circle that turns continuously and no back/stop button.
image

I restarted my R session, but the Loading tutorial message stays and wheel keeps on turning.

It works if I right click on the Tutorial tab and click on Reload

Error in if for join-admin tutorial

Hi,

I just installed afrilearnr and get the following error message when I run:
learnr::run_tutorial("join-admin", "afrilearnr")

Listening on http://127.0.0.1:6081
Warning: Error in if: argument is of length zero
  72: ui

The app opens in the browser - see screenshot

image

Thanks,

Anelda

Installation of afrilearnr - no package called learnr

I installed afrilearnr successfully and loaded the library, but when I run

learnr::run_tutorial("join-admin", "afrilearnr")
I get the following:

Error in loadNamespace(name) : there is no package called ‘learnr’

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.