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)) |
NewerOlder