G4D PROJECT 
             CHARAF EDDINE BEN AMAR
             
             
          EDUCATION IN MOROCCO 

as everybody knows the united nation is such an organization that aims to evolve the sustainablr developpement of the poor nation in the different continants in several domain because of that the UN has set up 17 sustainable goals to confront poverty,hunger ,illness,gender descrimination,poor sanitation of water ,pollute energy,economic problems,climate change and education in this wok we will focus on education in morocco

library(rgdal)
## Loading required package: sp
## rgdal: version: 1.3-6, (SVN revision 773)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
##  Path to GDAL shared files: /usr/share/gdal/2.1
##  GDAL binary built with GEOS: TRUE 
##  Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
##  Path to PROJ.4 shared files: (autodetected)
##  Linking to sp version: 1.3-1
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.3, PROJ 4.9.2
library(sp)
library(cartography)
library(RColorBrewer)
install.packages("magick")
## Installing package into '/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5'
## (as 'lib' is unspecified)
## Warning in install.packages("magick"): installation of package 'magick' had
## non-zero exit status
library(magick)
## Linking to ImageMagick 6.9.7.4
## Enabled features: fontconfig, freetype, fftw, lcms, pango, x11
## Disabled features: cairo, ghostscript, rsvg, webp
str(magick::magick_config())
## List of 21
##  $ version           :Class 'numeric_version'  hidden list of 1
##   ..$ : int [1:4] 6 9 7 4
##  $ modules           : logi TRUE
##  $ cairo             : logi FALSE
##  $ fontconfig        : logi TRUE
##  $ freetype          : logi TRUE
##  $ fftw              : logi TRUE
##  $ ghostscript       : logi FALSE
##  $ jpeg              : logi TRUE
##  $ lcms              : logi TRUE
##  $ libopenjp2        : logi FALSE
##  $ lzma              : logi TRUE
##  $ pangocairo        : logi TRUE
##  $ pango             : logi TRUE
##  $ png               : logi TRUE
##  $ rsvg              : logi FALSE
##  $ tiff              : logi TRUE
##  $ webp              : logi FALSE
##  $ wmf               : logi TRUE
##  $ x11               : logi TRUE
##  $ xml               : logi TRUE
##  $ zero-configuration: logi FALSE

the rate of illitrate people in the world is reducing arround the world

library(magick)
tiger <- image_read_svg('/cloud/project/literate-and-illiterate-world-population (2).svg', width = 2000)
print(tiger)
##   format width height colorspace matte filesize density
## 1    PNG  2000   1412       sRGB  TRUE        0   72x72

the rate of no education in morocco is diminishing also

library(magick)
tiger <- image_read_svg('/cloud/project/projections-of-the-rate-of-no-education-based-on-current-global-education-trends-1970-2050 (1).svg', width = 2000)
print(tiger)
##   format width height colorspace matte filesize density
## 1    PNG  2000   1412       sRGB  TRUE        0   72x72

the number of children out of school is falling down from 2005 to 2012

library(magick)
tig <- image_read_svg('/cloud/project/number-of-out-of-school-children.svg', width = 2000)
tig

more than 95%of children in morocco from both sex are attending and completing the primary school ,and less than five per cent are dropping out from it

# load GGplot2
library(ggplot2)

# Create test data.
dat = data.frame(count=c(95, 5), category=c("Primary school completion rate for both sex", "droped out of primary school"))
 
# Add addition columns, needed for drawing with geom_rect.
dat$fraction = dat$count / sum(dat$count)
dat = dat[order(dat$fraction), ]
dat$ymax = cumsum(dat$fraction)
dat$ymin = c(0, head(dat$ymax, n=-1))
 
# Make the plot
p1 = ggplot(dat, aes(fill=category, ymax=ymax, ymin=ymin, xmax=4, xmin=3)) +
     geom_rect() +
     coord_polar(theta="y") +
     xlim(c(0, 4)) +
     theme(panel.grid=element_blank()) +
     theme(axis.text=element_blank()) +
     theme(axis.ticks=element_blank()) +
     annotate("text", x = 0, y = 0, label = "the indicaor of the rate
     of studentS who completd 
     the primary school
     in morocco") +
     labs(title="")
p1

the student rate has increased from the 60s to 2015

# Define the cars vector with 5 values
studentrate <- c(25, 50, 75, 100)
years <- c(1960,1980,2005,2015)


# Graph the cars vector with all defaults
plot(years,studentrate)

# Define the cars vector with 5 values
#cars <- c(1, 3, 6, 4, 9)
studentrate <- c(25, 50, 75, 100)
years <- c(1960,1980,2005,2015)
# Graph cars using blue points overlayed by a line 
plot(years, studentrate,type="o", col="blue")

# Create a title with a red, bold/italic font
title(main="student inrollement in primary schools in morocco between 1960 and2015", col.main="red", font.main=4)

it’s abvious from the next pie chart that the rate of boys is higher than girls in attendance of primary school in morocco

# Define cars vector with 5 values
studentpergender <- c(57,43 ) 

# Create test data.


# Create a pie chart for cars
pie(studentpergender) 

# custom colors and labels
pie(studentpergender, main="student enrollement in primary school per gender in morocco ", col=rainbow(length(studentpergender)),
   labels=c("boys","girls"))

the total amount as an expenditure on education is knowing several changement in the last three years,and the moroccan governement is wobbling about caring out of education

barplot( c(45, 42,68), main="Education expenditure in morocco", xlab="the last three years",ylab="billions Moroccan Dirham")

in the region of north africa ,algeria and morocco are the most expenditures on education

library(plotrix)
slices <- c(40.99, 43.75, 14.29, 1.08) 
lbls <- c("morocco", "algeria", "tunisia", "muritania")
pie3D(slices,labels=lbls,explode=0.1,
   main="Pie Chart of Countries ")

indicators of moroccan developement in several matters

library(readr)
cr<-read_csv("/cloud/project/API_MAR_DS2_en_csv_v2_10322524.csv")
## Warning: Missing column names filled in: 'X3' [3]
## Parsed with column specification:
## cols(
##   `Data Source` = col_character(),
##   `World Development Indicators` = col_character(),
##   X3 = col_character()
## )
## Warning: 1601 parsing failures.
## row col  expected     actual                                                file
##   2  -- 3 columns 63 columns '/cloud/project/API_MAR_DS2_en_csv_v2_10322524.csv'
##   3  -- 3 columns 63 columns '/cloud/project/API_MAR_DS2_en_csv_v2_10322524.csv'
##   4  -- 3 columns 63 columns '/cloud/project/API_MAR_DS2_en_csv_v2_10322524.csv'
##   5  -- 3 columns 63 columns '/cloud/project/API_MAR_DS2_en_csv_v2_10322524.csv'
##   6  -- 3 columns 63 columns '/cloud/project/API_MAR_DS2_en_csv_v2_10322524.csv'
## ... ... ......... .......... ...................................................
## See problems(...) for more details.
cr
## # A tibble: 1,602 x 3
##    `Data Source`   `World Development In… X3                               
##    <chr>           <chr>                  <chr>                            
##  1 Last Updated D… 2018-11-14             <NA>                             
##  2 Country Name    Country Code           Indicator Name                   
##  3 Morocco         MAR                    Presence of peace keepers (numbe…
##  4 Morocco         MAR                    Intentional homicides (per 100,0…
##  5 Morocco         MAR                    Intentional homicides, male (per…
##  6 Morocco         MAR                    Intentional homicides, female (p…
##  7 Morocco         MAR                    Internally displaced persons, to…
##  8 Morocco         MAR                    Internally displaced persons, ne…
##  9 Morocco         MAR                    Internally displaced persons, ne…
## 10 Morocco         MAR                    Battle-related deaths (number of…
## # … with 1,592 more rows

the mean year of schooling in morocco

library(magick)
ti <- image_read_svg('/cloud/project/mean-years-of-schooling.svg', width = 2000)
print(ti)
## # A tibble: 1 x 7
##   format width height colorspace matte filesize density
##   <chr>  <int>  <int> <chr>      <lgl>    <int> <chr>  
## 1 PNG     2000   1412 sRGB       TRUE         0 72x72

population breakdown by highest level of education achieved for those aged 15 in morocco

library(magick)
t <- image_read_svg('/cloud/project/population-breakdown-by-highest-level-of-education-achieved-for-those-aged-15-in.svg', width = 2000)
print(t)
## # A tibble: 1 x 7
##   format width height colorspace matte filesize density
##   <chr>  <int>  <int> <chr>      <lgl>    <int> <chr>  
## 1 PNG     2000   1412 sRGB       TRUE         0 72x72

learning outcomes vs gdp per capita in morocco compared with other nations

library(magick)
t <- image_read_svg('/cloud/project/learning-outcomes-vs-gdp-per-capita.svg', width = 2000)
print(t)
## # A tibble: 1 x 7
##   format width height colorspace matte filesize density
##   <chr>  <int>  <int> <chr>      <lgl>    <int> <chr>  
## 1 PNG     2000   1412 sRGB       TRUE         0 72x72

the totall expenditure per in gdp in the moroccan education

library(magick)
kalin <- image_read_svg('/cloud/project/total-government-expenditure-on-education-gdp.svg', width = 2000)
print(kalin)
## # A tibble: 1 x 7
##   format width height colorspace matte filesize density
##   <chr>  <int>  <int> <chr>      <lgl>    <int> <chr>  
## 1 PNG     2000   1412 sRGB       TRUE         0 72x72