Functions that will take a Dataset object, and remove samples and/or taxons with different criteria

clean(Dat, verbose = TRUE)

Arguments

Dat

A Dataset object

verbose

logical indicating whether to print info about the results.

Value

A Dataset object

Details

clean will remove any sample (column) or taxon (row) fromt your Dataset, that has no observations. Some functions like PCA and some linear models won't work if one of the rows or columns of the matrix are all zero, and so it is always a good idea to "clean" your dataset.

remove_samples and remove_taxons take respectively a list of samples or taxons to remove from the Dataset.

See also

Examples

data(Rhizo) data(Rhizo.map) Dat <- create_dataset(Rhizo,Rhizo.map) Dat <- remove_samples(Dat,colnames(Dat$Tab)[1:50]) Dat <- remove_taxons(Dat,row.names(Dat$Tab)[1:115]) sum(colSums(Dat$Tab) == 0)
#> [1] 3
sum(rowSums(Dat$Tab) == 0)
#> [1] 1
Dat$Tab
#> D429 D447 D448 D449 D450 D451 D452 D453 D454 D455 D456 D678 D679 D680 #> OTU_19916 0 0 0 0 1 0 1 0 0 0 0 1 0 0 #> OTU_6457 0 0 0 1 0 1 0 0 0 0 0 0 0 0 #> OTU_6024 0 0 0 0 0 1 0 0 0 0 0 14 3 12 #> OTU_14844 0 0 0 0 0 0 0 0 0 0 0 10 5 13 #> OTU_18380 0 1 0 0 0 0 0 0 0 0 0 0 0 0 #> OTU_14780 0 0 0 0 0 0 0 0 0 0 0 4 1 3 #> OTU_20070 0 0 0 0 0 0 0 0 1 0 0 2 10 4 #> OTU_19960 0 0 1 0 0 0 0 0 0 0 0 1 0 0 #> OTU_12223 0 0 0 0 0 1 0 0 0 0 2 3 1 7 #> OTU_18927 0 0 0 0 0 0 1 0 0 0 0 1 8 1 #> OTU_19093 0 0 0 0 0 0 0 0 0 0 0 35 3 4 #> OTU_11949 0 0 0 0 0 0 0 0 0 0 0 2 14 6 #> OTU_7118 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #> OTU_16233 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #> D681 D682 D1045 D1046 D1047 #> OTU_19916 1 0 0 0 0 #> OTU_6457 0 0 0 0 0 #> OTU_6024 38 25 28 8 3 #> OTU_14844 43 10 11 12 2 #> OTU_18380 0 0 1 0 0 #> OTU_14780 19 8 11 0 11 #> OTU_20070 1 10 2 21 6 #> OTU_19960 0 0 0 0 0 #> OTU_12223 3 3 3 0 0 #> OTU_18927 5 6 1 1 3 #> OTU_19093 10 2 6 4 3 #> OTU_11949 2 4 10 19 1 #> OTU_7118 1 0 0 0 0 #> OTU_16233 0 0 0 0 0
Dat.clean <- clean(Dat)
#> 3 samples removed #> 1 taxons removed
Dat.clean$Tab
#> D447 D448 D449 D450 D451 D452 D454 D456 D678 D679 D680 D681 D682 #> OTU_19916 0 0 0 1 0 1 0 0 1 0 0 1 0 #> OTU_6457 0 0 1 0 1 0 0 0 0 0 0 0 0 #> OTU_6024 0 0 0 0 1 0 0 0 14 3 12 38 25 #> OTU_14844 0 0 0 0 0 0 0 0 10 5 13 43 10 #> OTU_18380 1 0 0 0 0 0 0 0 0 0 0 0 0 #> OTU_14780 0 0 0 0 0 0 0 0 4 1 3 19 8 #> OTU_20070 0 0 0 0 0 0 1 0 2 10 4 1 10 #> OTU_19960 0 1 0 0 0 0 0 0 1 0 0 0 0 #> OTU_12223 0 0 0 0 1 0 0 2 3 1 7 3 3 #> OTU_18927 0 0 0 0 0 1 0 0 1 8 1 5 6 #> OTU_19093 0 0 0 0 0 0 0 0 35 3 4 10 2 #> OTU_11949 0 0 0 0 0 0 0 0 2 14 6 2 4 #> OTU_7118 0 0 0 0 0 0 0 0 0 0 0 1 0 #> D1045 D1046 D1047 #> OTU_19916 0 0 0 #> OTU_6457 0 0 0 #> OTU_6024 28 8 3 #> OTU_14844 11 12 2 #> OTU_18380 1 0 0 #> OTU_14780 11 0 11 #> OTU_20070 2 21 6 #> OTU_19960 0 0 0 #> OTU_12223 3 0 0 #> OTU_18927 1 1 3 #> OTU_19093 6 4 3 #> OTU_11949 10 19 1 #> OTU_7118 0 0 0