Last data update: 2014.03.03

R: abundance
abundanceR Documentation

abundance

Description

abundance generates an abundance table. This table can be either weighted or unweighted.

Usage

abundance(object, ...)

Arguments

object

An OTUset or a TAXset object

...

Additional arguments. These will depend on if the object is an OTUset or a TAXset object.

Details

These are other arguments passed to abundance

  • taxCol If generating the abundance from a TAXset object, taxCol selects the column of the tax dataframe from which to calculate the abundance.

  • assignmentCol If generating the abundance from an OTUset object assignmentCol will select a column of the assignmentData dataframe to use when calculating abundance. This will override the default of creating an abundance table of the OTUs and instead create an abundance table of a column in the assignmentData dataframe.

  • sampleCol sampleCol generates the abundance table using a column in the sampleData data fram instead of the default of using the sampleID.

  • collab An optional parameter that selets a column of the sampleData dataframe to use when labeling the columns of the abundance table.

  • weighted By default this is FALSE. When set to TRUE abundance will return proportional abundances.

Value

The returned value will be a data.frame.

Examples


## locate directory with data
dirPath <- system.file("extdata/Sogin_2006", package="OTUbase")

## read in data into OTUset object
soginOTU <- readOTUset(dirPath=dirPath, level="0.03", samplefile="sogin.groups", fastafile="sogin.fasta", otufile="sogin.unique.filter.fn.list", sampleADF="sample_metadata.txt")

## calculate abundance
abundance(soginOTU, collab="Site")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(OTUbase)
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit


Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: ShortRead
Loading required package: BiocParallel
Loading required package: Biostrings
Loading required package: XVector
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: GenomicRanges
Loading required package: GenomicAlignments
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-0
================================================================================
Welcome to OTUbase version 1.22.0

Attaching package: 'OTUbase'

The following object is masked from 'package:GenomicAlignments':

    seqnames

The following object is masked from 'package:SummarizedExperiment':

    seqnames

The following object is masked from 'package:GenomicRanges':

    seqnames

The following object is masked from 'package:GenomeInfoDb':

    seqnames

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/OTUbase/abundance.Rd_%03d_medium.png", width=480, height=480)
> ### Name: abundance
> ### Title: abundance
> ### Aliases: abundance,.TAXset-method abundance,.OTUset-method abundance
> ### Keywords: abundance
> 
> ### ** Examples
> 
> 
> ## locate directory with data
> dirPath <- system.file("extdata/Sogin_2006", package="OTUbase")
> 
> ## read in data into OTUset object
> soginOTU <- readOTUset(dirPath=dirPath, level="0.03", samplefile="sogin.groups", fastafile="sogin.fasta", otufile="sogin.unique.filter.fn.list", sampleADF="sample_metadata.txt")
Looking for column with names
> 
> ## calculate abundance
> abundance(soginOTU, collab="Site")
        s
o        Lower deep water Oxygen minimum Labrador seawater Labrador seawater
  otu1                  0              0                 2                 1
  otu10                 2              0                 0                 0
  otu100                1              0                 0                 0
  otu101                0              0                 0                 0
  otu102                0              0                 0                 1
  otu103                0              0                 0                 0
  otu104                0              0                 0                 0
  otu105                1              0                 0                 1
  otu106                0              1                 0                 1
  otu107                0              0                 1                 0
  otu108                0              0                 1                 0
  otu109                0              0                 0                 1
  otu11                 0              0                 0                 1
  otu110                0              0                 1                 0
  otu111                1              0                 0                 0
  otu112                1              0                 0                 0
  otu113                1              0                 0                 0
  otu114                0              0                 0                 0
  otu115                1              0                 0                 0
  otu116                0              1                 0                 0
  otu117                0              0                 0                 1
  otu118                0              0                 0                 0
  otu119                0              0                 0                 0
  otu12                 0              4                 2                 0
  otu120                0              0                 0                 0
  otu121                0              1                 0                 0
  otu122                0              0                 0                 0
  otu123                0              0                 0                 0
  otu124                0              0                 0                 0
  otu125                0              0                 0                 0
  otu126                0              0                 1                 0
  otu127                0              0                 0                 0
  otu128                0              0                 0                 0
  otu129                0              0                 0                 0
  otu13                 0              0                 0                 0
  otu130                0              0                 0                 0
  otu131                0              0                 0                 0
  otu132                0              0                 0                 0
  otu133                0              0                 0                 0
  otu134                0              0                 0                 0
  otu135                0              0                 0                 0
  otu136                0              0                 0                 0
  otu137                0              0                 0                 0
  otu138                0              1                 3                 2
  otu139                0              0                 0                 0
  otu14                 1              6                 5                 9
  otu140                0              0                 0                 0
  otu141                0              0                 0                 0
  otu142                0              0                 1                 0
  otu143                0              0                 1                 0
  otu144                0              0                 0                 1
  otu145                0              0                 0                 0
  otu146                0              0                 0                 1
  otu147                0              0                 0                 1
  otu148                0              0                 0                 0
  otu149                0              1                 0                 0
  otu15                 0              0                 0                 0
  otu150                0              0                 0                 0
  otu151                0              0                 0                 0
  otu152                0              0                 1                 0
  otu153                1              0                 0                 0
  otu154                0              0                 0                 0
  otu155                0              0                 0                 0
  otu156                0              0                 0                 0
  otu157                0              1                 0                 0
  otu158                1              0                 0                 0
  otu159                0              0                 0                 1
  otu16                 0              0                 1                 0
  otu160                0              0                 0                 0
  otu161                0              0                 0                 0
  otu162                0              0                 0                 0
  otu163                0              0                 0                 0
  otu164                0              0                 0                 0
  otu165                0              0                 0                 0
  otu166                0              0                 0                 0
  otu167                0              0                 0                 0
  otu168                0              0                 0                 0
  otu169                0              0                 0                 0
  otu17                 0              0                 0                 1
  otu170                0              0                 0                 0
  otu171                0              0                 0                 0
  otu172                0              0                 0                 0
  otu173                0              0                 0                 0
  otu174                0              0                 0                 0
  otu175                0              0                 0                 0
  otu176                0              0                 0                 0
  otu177                0              0                 0                 0
  otu178                0              0                 0                 0
  otu179                0              0                 0                 0
  otu18                 2              1                 0                 0
  otu180                0              0                 0                 0
  otu181                0              0                 0                 0
  otu182                0              0                 0                 0
  otu183                0              0                 0                 0
  otu184                0              0                 0                 0
  otu185                0              0                 0                 0
  otu186                0              0                 0                 0
  otu187                0              0                 0                 0
  otu188                0              0                 0                 0
  otu189                0              0                 0                 0
  otu19                 0              0                 1                 0
  otu190                0              0                 0                 0
  otu191                0              0                 0                 0
  otu192                0              0                 0                 0
  otu193                0              0                 0                 0
  otu194                0              0                 0                 0
  otu195                0              0                 0                 0
  otu196                0              0                 0                 0
  otu197                0              0                 0                 0
  otu198                0              0                 0                 0
  otu199                0              0                 0                 0
  otu2                  0              0                 0                 1
  otu20                 1              1                 0                 1
  otu200                0              0                 0                 0
  otu201                0              0                 0                 0
  otu202                0              0                 0                 0
  otu203                0              0                 0                 0
  otu204                0              0                 0                 0
  otu205                0              0                 1                 0
  otu206                1              0                 0                 0
  otu207                0              0                 0                 1
  otu208                1              0                 0                 0
  otu209                1              0                 0                 0
  otu21                 0              2                 0                 0
  otu210                0              0                 0                 0
  otu211                0              0                 0                 0
  otu212                0              0                 1                 0
  otu213                0              0                 0                 0
  otu214                0              0                 1                 0
  otu215                0              0                 0                 0
  otu216                0              1                 0                 0
  otu217                0              0                 0                 0
  otu218                0              0                 1                 0
  otu219                0              0                 0                 1
  otu22                 0              0                 0                 0
  otu220                0              1                 0                 0
  otu221                1              2                 0                 0
  otu222                0              0                 0                 0
  otu223                0              0                 1                 0
  otu224                0              0                 2                 0
  otu225                0              0                 0                 0
  otu226                0              1                 0                 0
  otu227                0              0                 0                 0
  otu228                0              0                 0                 0
  otu229                1              0                 0                 0
  otu23                 0              0                 0                 0
  otu230                1              0                 0                 0
  otu231                0              0                 0                 0
  otu232                0              0                 0                 1
  otu233                0              0                 0                 2
  otu234                3              0                 1                 0
  otu235                0              0                 0                 0
  otu236                0              0                 0                 0
  otu237                0              0                 0                 0
  otu238                0              0                 0                 0
  otu239                2              0                 0                 0
  otu24                 0              0                 0                 0
  otu240                0              1                 0                 0
  otu241                0              0                 0                 0
  otu242                2              1                 0                 0
  otu243                1              0                 0                 0
  otu244                0              0                 1                 0
  otu245                0              1                 1                 0
  otu246                0              0                 0                 1
  otu247                0              0                 0                 1
  otu248                0              1                 0                 0
  otu249                0              0                 1                 0
  otu25                 0              0                 0                 0
  otu250                1              0                 0                 0
  otu251                4              0                 0                 0
  otu252                0              3                 1                 1
  otu253                1              0                 0                 0
  otu254                0              0                 0                 0
  otu255                0              0                 0                 0
  otu256                0              0                 0                 0
  otu257                0              0                 0                 0
  otu258                0              0                 0                 0
  otu259                0              0                 0                 0
  otu26                 0              1                 0                 0
  otu260                0              0                 0                 1
  otu261                0              0                 0                 0
  otu262                0              0                 0                 0
  otu263                0              0                 0                 0
  otu264                0              0                 0                 0
  otu265                0              0                 0                 0
  otu266                0              0                 0                 0
  otu267                0              0                 0                 0
  otu268                0              0                 0                 0
  otu269                0              0                 0                 0
  otu27                 0              0                 1                 0
  otu270                0              0                 0                 0
  otu271                0              0                 0                 0
  otu272                0              1                 0                 0
  otu273                0              0                 0                 0
  otu274                0              0                 0                 0
  otu275                0              1                 0                 0
  otu276                0              0                 0                 1
  otu277                0              0                 0                 1
  otu278                2              3                 0                 0
  otu279                0              0                 1                 1
  otu28                 0              0                 0                 0
  otu280                0              0                 1                 0
  otu281                0              0                 0                 0
  otu282                0              0                 0                 0
  otu283                0              0                 0                 0
  otu284                0              0                 0                 0
  otu285                0              0                 0                 0
  otu286                0              0                 0                 0
  otu287                0              0                 0                 0
  otu288                0              0                 0                 0
  otu289                0              0                 0                 0
  otu29                 0              0                 0                 0
  otu290                1              0                 0                 0
  otu291                1              0                 0                 0
  otu292                1              0                 0                 0
  otu293                0              0                 0                 0
  otu294                0              0                 0                 0
  otu295                0              0                 0                 0
  otu296                0              0                 0                 0
  otu297                0              0                 0                 0
  otu298                0              0                 0                 0
  otu299                0              0                 0                 0
  otu3                  0              0                 0                 0
  otu30                 0              0                 0                 0
  otu300                0              0                 0                 0
  otu301                0              0                 0                 0
  otu302                0              0                 0                 0
  otu303                0              0                 0                 0
  otu304                0              0                 0                 0
  otu305                1              0                 0                 0
  otu306                2              0                 0                 0
  otu307                0              1                 0                 0
  otu308                1              0                 0                 0
  otu309                0              0                 1                 0
  otu31                 0              0                 0                 0
  otu310                0              0                 0                 0
  otu311                0              0                 0                 0
  otu312                0              0                 0                 0
  otu313                0              1                 1                 0
  otu314                0              0                 0                 0
  otu315                0              0                 0                 0
  otu316                0              0                 0                 0
  otu317                0              0                 0                 0
  otu318                0              0                 0                 0
  otu319                0              0                 0                 0
  otu32                 0              0                 0                 0
  otu320                0              0                 0                 0
  otu321                1              0                 0                 0
  otu322                0              0                 0                 0
  otu323                0              0                 0                 0
  otu324                0              0                 0                 0
  otu325                0              0                 0                 0
  otu326                0              0                 0                 0
  otu327                1              0                 0                 0
  otu328                1              0                 0                 0
  otu329                0              0                 0                 0
  otu33                 1              0                 0                 0
  otu330                0              0                 0                 0
  otu331                0              0                 0                 0
  otu332                0              0                 0                 0
  otu333                0              0                 0                 0
  otu334                0              0                 0                 0
  otu335                0              0                 0                 1
  otu336                0              0                 0                 0
  otu337                0              1                 0                 0
  otu338                0              1                 0                 0
  otu339                1              0                 0                 0
  otu34                 0              0                 1                 0
  otu340                2              0                 0                 0
  otu341                0              0                 0                 0
  otu342                0              0                 0                 0
  otu343                0              0                 0                 0
  otu344                0              0                 0                 0
  otu345                0              0                 0                 0
  otu346                0              0                 0                 0
  otu347                0              0                 0                 0
  otu348                0              0                 0                 0
  otu349                0              0                 0                 0
  otu35                 0              0                 1                 0
  otu350                0              0                 0                 0
  otu351                0              0                 0                 0
  otu352                0              0                 0                 0
  otu353                0              0                 0                 0
  otu354                0              0                 0                 0
  otu355                0              1                 0                 0
  otu356                0              0                 0                 0
  otu357                0              0                 0                 0
  otu358                0              1                 0                 0
  otu359                0              0                 0                 1
  otu36                 1              0                 0                 0
  otu360                0              0                 0                 0
  otu361                0              0                 0                 0
  otu362                0              1                 1                 0
  otu363                0              0                 1                 2
  otu364                7              4                 1                 0
  otu365                0              0                 0                 1
  otu366                1              0                 0                 0
  otu367                0              0                 0                 0
  otu368                0              0                 0                 0
  otu369                0              0                 0                 0
  otu37                 0              0                 0                 0
  otu370                1              0                 0                 1
  otu371                1              0                 0                 0
  otu372                0              0                 0                 0
  otu373                1              0                 0                 0
  otu374                0              0                 0                 0
  otu375                0              0                 0                 0
  otu376                0              0                 0                 1
  otu377                0              0                 0                 1
  otu378                0              0                 0                 0
  otu379                0              0                 0                 0
  otu38                 0              0                 0                 2
  otu380                0              0                 0                 0
  otu381                0              0                 0                 0
  otu382                0              0                 0                 0
  otu383                0              0                 0                 0
  otu384                0              0                 0                 0
  otu385                0              0                 0                 0
  otu386                0              4                 0                 2
  otu387                0              0                 0                 0
  otu388                0              0                 0                 1
  otu389                1              9                 5                 4
  otu39                 1              3                 0                 1
  otu390                0              0                 0                 1
  otu391                0              0                 0                 1
  otu392                0              0                 0                 0
  otu393                0              1                 0                 0
  otu394                0              0                 1                 0
  otu395                0              2                 3                 1
  otu396                0              0                 0                 1
  otu397                0              1                 0                 0
  otu398                0              0                 0                 0
  otu399                1              0                 0                 0
  otu4                  1              0                 0                 0
  otu40                 0              0                 0                 0
  otu41                 0              1                 1                 0
  otu42                 1              0                 0                 0
  otu43                 1              0                 0                 1
  otu44                 0              0                 0                 0
  otu45                 0              0                 0                 0
  otu46                 0              0                 0                 0
  otu47                 0              0