This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' List the files in a FTP (remote) directory/folder | |
#' @description | |
#' This function produce a character vector of the names of files in the ftp folder provided | |
#' | |
#' @param ftp FTP base directory/folder | |
#' @param pattern an optional regular expression. Only file names which match the regular expression will be returned. | |
#' @author Adam H. Sparks, Ousmane Ouedraogo | |
#' | |
#' @return character vector of the names of files in FTP base directory | |
#' @export |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Title | |
#' | |
#' @param x | |
#' | |
#' @return | |
#' @export | |
#' | |
#' @examples | |
is_integer <- function(x){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Get sunrise and sunset time for any location and date from sunsetsunrise.io API | |
#' | |
#' @param lon longitude in decimal degree of the location | |
#' @param lat latitude in decimal degree of the location | |
#' @param date a date string in 'yyy-mm-dd' format. | |
#' | |
#' @return a tibble with sunset/sunrise time, day length, location timezone and date | |
#' @export | |
#' | |
#' @examples |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Default atmospheric CO2 concentration from 1902 to 2099 (updated 01/08/2022) | |
Year CO2 (ppm by volume) | |
============================ | |
1902 297.4 | |
1905 298.2 | |
1912 300.7 | |
1915 301.3 | |
1924 304.5 | |
1926 305.0 | |
1929 305.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Generate fixed width file in R | |
#' @description This simple function creates fixed width file with no | |
#' extra dependencies. | |
#' @param justify "l", "r" or something like "lrl" for left, right, left. | |
#' @examples dt <- data.frame(a = 1:3, b = NA, c = c('a', 'b', 'c')) | |
#' write_fwf(dt, "test.txt", width = c(4, 4, 3)) | |
#' @export | |
write_fwf = function(dt, file, width, | |
justify = "l", replace_na = "NA") { | |
fct_col = which(sapply(dt, is.factor)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(terra) # Spatial Data Analysis | |
library(tidyterra) # 'tidyverse' Methods and 'ggplot2' Helpers for 'terra' | |
library(ggplot2) # For Data Visualisations Using the Grammar of Graphics | |
library(rgeoboundaries) # For Political Administrative Boundaries | |
library(ggspatial) # Spatial Data Framework for ggplot2 | |
library(ggtext) # Improved Text Rendering Support for 'ggplot2' | |
library(ggsflabel) # for spatial labeling | |
x <- terra::rast(x = "/Volumes/OUSMANE/exo_BSD/semis_fin_07/sem0173.rst") | |
y <- classify(x,c(0,1,2,3,4,5,6,7,8)) |