data.prep.R 2.17 KB
Newer Older
1 2
require(vegan)

3 4 5 6 7
bacteria <- read.csv("data-raw/bacteria.csv",
  header = TRUE,
  row.names = 1,
  na.strings = "NA"
)
8

9 10 11 12 13
eukaryotes <- read.csv("data-raw/eukaryotes.csv",
  header = TRUE,
  row.names = 1,
  na.strings = "NA"
)
14

15 16 17 18 19
climat <- read.csv("data-raw/climat.csv",
  header = TRUE,
  row.names = 1,
  na.strings = "NA"
)
20

21 22 23 24 25
soil <- read.csv("data-raw/soil.csv",
  header = TRUE,
  row.names = 1,
  na.strings = "NA"
)
26

27 28 29 30 31
geography <- read.csv("data-raw/geography.csv",
  header = TRUE,
  row.names = 1,
  na.strings = "NA"
)
32

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
usethis::use_data(bacteria, overwrite = TRUE)
usethis::use_data(eukaryotes, overwrite = TRUE)
usethis::use_data(climat, overwrite = TRUE)
usethis::use_data(soil, overwrite = TRUE)
usethis::use_data(geography, overwrite = TRUE)

#
# MicroCurvulatum datasets
#

mc.bacteria <- read.table("data-raw/MicroCurvulatum/rarefied_bacterial_community_matrix.txt",
  row.names = 1,
  header = 1,
  na.strings = "NA"
)

mc.bacteria = as.matrix(mc.bacteria)

mc.fungi <- read.table("data-raw/MicroCurvulatum/rarefied_fungal_community_matrix.txt",
  row.names = 1,
  header = 1,
  na.strings = "NA"
)

mc.fungi <- as.matrix(mc.fungi[row.names(mc.bacteria),])

mc.plants <- read.table("data-raw/MicroCurvulatum/Phytosocio.txt",
  row.names = 1,
  header = 1,
  na.strings = "NA"
)

mc.plants <- as.matrix(mc.plants[substr(row.names(mc.bacteria),
                              1,
                              nchar(row.names(mc.bacteria))-1),])

mc.soil <- read.table("data-raw/MicroCurvulatum/SOIL_CHEM.txt",
  row.names = 1,
  header = 1,
  na.strings = "NA"
)

mc.soil <- as.matrix(mc.soil[row.names(mc.bacteria),5:10])

77 78 79 80 81 82 83 84 85 86
mc.geography <- read.table("data-raw/MicroCurvulatum/Coord_geo.txt",
  row.names = 1,
  header = 1,
  na.strings = "NA"
)

mc.geography <- as.matrix(mc.geography[substr(row.names(mc.bacteria),
                              1,
                              nchar(row.names(mc.bacteria))-1),])

87 88 89 90 91 92
MicroCurvulatum = ProcMod::procmod.frame(bacteria = mc.bacteria,
                                         fungi = mc.fungi,
                                         plants = mc.plants,
                                         soil = mc.soil)

usethis::use_data(MicroCurvulatum, overwrite = TRUE)