The function droplevels is used to drop unused levels from a factor or, more commonly, from factors in a data frame.

droplevels(x, ...)

# S4 method for Ranges
droplevels(x)

# S4 method for SummarizedExperiment
droplevels(x)

Arguments

x

Object.

...

Additional arguments.

Value

Modified object.

Note

Updated 2020-04-10.

Examples

data(RangedSummarizedExperiment, package = "acidtest") ## Ranges ==== rse <- RangedSummarizedExperiment object <- SummarizedExperiment::rowRanges(rse) S4Vectors::droplevels(object)
#> GRanges object with 500 ranges and 8 metadata columns: #> seqnames ranges strand | broadClass #> <Rle> <IRanges> <Rle> | <Rle> #> gene001 X 100627108-100639991 - | coding #> gene002 X 100584936-100599885 + | coding #> gene003 20 50934867-50958555 - | coding #> gene004 1 169849631-169894267 - | coding #> gene005 1 169662007-169854080 + | coding #> ... ... ... ... . ... #> gene496 13 20567069-20691437 + | coding #> gene497 16 5033923-5087379 + | coding #> gene498 12 122471599-122501073 - | coding #> gene499 7 151211484-151227205 - | coding #> gene500 7 151232489-151238827 + | coding #> description #> <Rle> #> gene001 tetraspanin 6 [Source:HGNC Symbol;Acc:HGNC:11858] #> gene002 tenomodulin [Source:HGNC Symbol;Acc:HGNC:17757] #> gene003 dolichyl-phosphate mannosyltransferase subunit 1, catalytic [Source:HGNC Symbol;Acc:HGNC:3005] #> gene004 SCY1 like pseudokinase 3 [Source:HGNC Symbol;Acc:HGNC:19285] #> gene005 chromosome 1 open reading frame 112 [Source:HGNC Symbol;Acc:HGNC:25565] #> ... ... #> gene496 intraflagellar transport 88 [Source:HGNC Symbol;Acc:HGNC:20606] #> gene497 ALG1 chitobiosyldiphosphodolichol beta-mannosyltransferase [Source:HGNC Symbol;Acc:HGNC:18294] #> gene498 zinc finger CCHC-type containing 8 [Source:HGNC Symbol;Acc:HGNC:25265] #> gene499 ATP binding cassette subfamily F member 2 [Source:HGNC Symbol;Acc:HGNC:71] #> gene500 chondroitin polymerizing factor 2 [Source:HGNC Symbol;Acc:HGNC:29270] #> entrezID geneBiotype geneID geneIDVersion geneName #> <list> <Rle> <Rle> <Rle> <Rle> #> gene001 7105 protein_coding ENSG00000000003 ENSG00000000003.15 TSPAN6 #> gene002 64102 protein_coding ENSG00000000005 ENSG00000000005.6 TNMD #> gene003 8813 protein_coding ENSG00000000419 ENSG00000000419.12 DPM1 #> gene004 57147 protein_coding ENSG00000000457 ENSG00000000457.14 SCYL3 #> gene005 55732 protein_coding ENSG00000000460 ENSG00000000460.17 C1orf112 #> ... ... ... ... ... ... #> gene496 8100 protein_coding ENSG00000032742 ENSG00000032742.17 IFT88 #> gene497 56052 protein_coding ENSG00000033011 ENSG00000033011.12 ALG1 #> gene498 55596 protein_coding ENSG00000033030 ENSG00000033030.15 ZCCHC8 #> gene499 10061 protein_coding ENSG00000033050 ENSG00000033050.9 ABCF2 #> gene500 54480 protein_coding ENSG00000033100 ENSG00000033100.16 CHPF2 #> seqCoordSystem #> <Rle> #> gene001 chromosome #> gene002 chromosome #> gene003 chromosome #> gene004 chromosome #> gene005 chromosome #> ... ... #> gene496 chromosome #> gene497 chromosome #> gene498 chromosome #> gene499 chromosome #> gene500 chromosome #> ------- #> seqinfo: 454 sequences from GRCh38 genome
## SummarizedExperiment ==== object <- RangedSummarizedExperiment S4Vectors::droplevels(object)
#> class: RangedSummarizedExperiment #> dim: 500 12 #> metadata(3): version date interestingGroups #> assays(1): counts #> rownames(500): gene001 gene002 ... gene499 gene500 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(12): sample01 sample02 ... sample11 sample12 #> colData names(1): condition