Mercurial > repos > ecology > ecology_stat_presence_abs
comparison funct_anomy.r @ 1:9a2e0195bb43 draft default tip
"planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
author | ecology |
---|---|
date | Fri, 13 Aug 2021 18:18:21 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:e5552099d0e3 | 1:9a2e0195bb43 |
---|---|
1 #Rscript | |
2 | |
3 ########################### | |
4 ## Anonymization ## | |
5 ########################### | |
6 | |
7 #####Packages : tangles | |
8 | |
9 #Load arguments | |
10 | |
11 args <- commandArgs(trailingOnly = TRUE) | |
12 | |
13 if (length(args) == 0) { | |
14 stop("This tool needs at least one argument") | |
15 }else{ | |
16 table <- args[1] | |
17 hr <- args[2] | |
18 latitude <- as.numeric(args[3]) | |
19 longitude <- as.numeric(args[4]) | |
20 } | |
21 | |
22 if (hr == "false") { | |
23 hr <- FALSE | |
24 }else{ | |
25 hr <- TRUE | |
26 } | |
27 | |
28 #####Import data | |
29 data <- read.table(table, sep = "\t", dec = ".", header = hr, fill = TRUE, encoding = "UTF-8") | |
30 | |
31 randomized_data <- tangles::tangles(data = as.matrix(data[, c(latitude, longitude)]), depth = 3, rasterdata = FALSE, raster_object = FALSE, saveTangles = FALSE, path = NULL) | |
32 | |
33 data[, c(latitude, longitude)] <- NULL | |
34 | |
35 tab_anon <- data.frame(longitude = randomized_data[[1]]$X, latitude = randomized_data[[1]]$Y) | |
36 | |
37 tab_anon <- cbind(data, tab_anon) | |
38 | |
39 write.table(tab_anon, "anonym_data.tabular", row.names = FALSE, quote = FALSE, sep = "\t", dec = ".", fileEncoding = "UTF-8") |