查看 R 的变量的数据类型

==========================


dim(t1)  

attributes(t1)    #综合输出所有行名、列名、以及class结果。     

str(t1)    #显示每个变量的行列数和类型  

class(t1) #查看变量类型,vector、data.frame、matrix、factor、list

mode(t1) #查看数据大类,character、numeric、logical

typeof(t1) #查看数据细类,integer、double、single、float

 

==========================

> dim(t1) #  
NULL
>
> attributes(t1)    #综合输出所有行名、列名、以及class结果。     
$seqnames
factor-Rle of length 410519 with 30 runs
  Lengths:                25139 ...                    9
  Values :                 chr1 ...       chrUn_JH584304
Levels(66): chr1 chr2 ... chrUn_GL456396 chrUn_JH584304

$strand
factor-Rle of length 410519 with 48 runs
  Lengths: 12327 12812 16807 ...     8    19
  Values :     +     -     + ...     +     -
Levels(3): + - *

$ranges
IRanges object with 410519 ranges and 0 metadata columns:
               start       end     width
           <integer> <integer> <integer>
       [1]   4807788   4807982       195
       [2]   4807823   4807982       160
       [3]   4807830   4807982       153
       [4]   4807892   4807982        91
       [5]   4807896   4807982        87
       ...       ...       ...       ...
  [410515]     55112     55701       590
  [410516]     56986     57151       166
  [410517]     58564     58835       272
  [410518]     58564     59690      1127
  [410519]     59592     59667        76

$seqinfo
Seqinfo object with 66 sequences (1 circular) from mm10 genome:
  seqnames       seqlengths isCircular genome
  chr1            195471971       <NA>   mm10
  chr2            182113224       <NA>   mm10
  chr3            160039680       <NA>   mm10
  chr4            156508116       <NA>   mm10
  chr5            151834684       <NA>   mm10
  ...                   ...        ...    ...
  chrUn_GL456392      23629       <NA>   mm10
  chrUn_GL456393      55711       <NA>   mm10
  chrUn_GL456394      24323       <NA>   mm10
  chrUn_GL456396      21240       <NA>   mm10
  chrUn_JH584304     114452       <NA>   mm10

$elementMetadata
DataFrame with 410519 rows and 2 columns
         exon_id      geneid
       <integer> <character>
1             18       18777
2             19       18777
3             20       18777
4             21       18777
5             22       18777
...          ...         ...
410515    447554       66776
410516    447555       66776
410517    447556       66776
410518    447557       66776
410519    447558       66776

$elementType
[1] "ANY"

$metadata
$metadata$genomeInfo
$metadata$genomeInfo$`Db type`
[1] "TxDb"

$metadata$genomeInfo$`Supporting package`
[1] "GenomicFeatures"

$metadata$genomeInfo$`Data source`
[1] "UCSC"

$metadata$genomeInfo$Genome
[1] "mm10"

$metadata$genomeInfo$Organism
[1] "Mus musculus"

$metadata$genomeInfo$`Taxonomy ID`
[1] "10090"

$metadata$genomeInfo$`UCSC Table`
[1] "knownGene"

$metadata$genomeInfo$`UCSC Track`
[1] "GENCODE VM23"

$metadata$genomeInfo$`Resource URL`
[1] "http://genome.ucsc.edu/"

$metadata$genomeInfo$`Type of Gene ID`
[1] "Entrez Gene ID"

$metadata$genomeInfo$`Full dataset`
[1] "yes"

$metadata$genomeInfo$`miRBase build ID`
[1] NA

$metadata$genomeInfo$transcript_nrow
[1] "142446"

$metadata$genomeInfo$exon_nrow
[1] "447558"

$metadata$genomeInfo$cds_nrow
[1] "243727"

$metadata$genomeInfo$`Db created by`
[1] "GenomicFeatures package from Bioconductor"

$metadata$genomeInfo$`Creation time`
[1] "2019-10-21 20:52:26 +0000 (Mon, 21 Oct 2019)"

$metadata$genomeInfo$`GenomicFeatures version at creation time`
[1] "1.37.4"

$metadata$genomeInfo$`RSQLite version at creation time`
[1] "2.1.2"

$metadata$genomeInfo$DBSCHEMAVERSION
[1] "1.2"



$class
[1] "GRanges"
attr(,"package")
[1] "GenomicRanges"

>
> str(t1)    #显示每个变量的行列数和类型  
Formal class 'GRanges' [package "GenomicRanges"] with 7 slots
  ..@ seqnames       :Formal class 'Rle' [package "S4Vectors"] with 4 slots
  .. .. ..@ values         : Factor w/ 66 levels "chr1","chr2",..: 1 2 3 4 5 6 7 8 9 10 ...
  .. .. ..@ lengths        : int [1:30] 25139 32977 18919 23826 26471 20448 34789 19936 23361 18793 ...
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ ranges         :Formal class 'IRanges' [package "IRanges"] with 6 slots
  .. .. ..@ start          : int [1:410519] 4807788 4807823 4807830 4807892 4807896 4807898 4807911 4808237 4808455 4828584 ...
  .. .. ..@ width          : int [1:410519] 195 160 153 91 87 85 72 129 32 66 ...
  .. .. ..@ NAMES          : NULL
  .. .. ..@ elementType    : chr "ANY"
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ strand         :Formal class 'Rle' [package "S4Vectors"] with 4 slots
  .. .. ..@ values         : Factor w/ 3 levels "+","-","*": 1 2 1 2 1 2 1 2 1 2 ...
  .. .. ..@ lengths        : int [1:48] 12327 12812 16807 16170 9829 9090 12035 11791 13416 13055 ...
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ seqinfo        :Formal class 'Seqinfo' [package "GenomeInfoDb"] with 4 slots
  .. .. ..@ seqnames   : chr [1:66] "chr1" "chr2" "chr3" "chr4" ...
  .. .. ..@ seqlengths : int [1:66] 195471971 182113224 160039680 156508116 151834684 149736546 145441459 129401213 124595110 130694993 ...
  .. .. ..@ is_circular: logi [1:66] NA NA NA NA NA NA ...
  .. .. ..@ genome     : chr [1:66] "mm10" "mm10" "mm10" "mm10" ...
  ..@ elementMetadata:Formal class 'DFrame' [package "S4Vectors"] with 6 slots
  .. .. ..@ rownames       : NULL
  .. .. ..@ nrows          : int 410519
  .. .. ..@ listData       :List of 2
  .. .. .. ..$ exon_id: int [1:410519] 18 19 20 21 22 23 24 25 26 27 ...
  .. .. .. ..$ geneid : chr [1:410519] "18777" "18777" "18777" "18777" ...
  .. .. ..@ elementType    : chr "ANY"
  .. .. ..@ elementMetadata: NULL
  .. .. ..@ metadata       : list()
  ..@ elementType    : chr "ANY"
  ..@ metadata       :List of 1
  .. ..$ genomeInfo:List of 20
  .. .. ..$ Db type                                 : chr "TxDb"
  .. .. ..$ Supporting package                      : chr "GenomicFeatures"
  .. .. ..$ Data source                             : chr "UCSC"
  .. .. ..$ Genome                                  : chr "mm10"
  .. .. ..$ Organism                                : chr "Mus musculus"
  .. .. ..$ Taxonomy ID                             : chr "10090"
  .. .. ..$ UCSC Table                              : chr "knownGene"
  .. .. ..$ UCSC Track                              : chr "GENCODE VM23"
  .. .. ..$ Resource URL                            : chr "http://genome.ucsc.edu/"
  .. .. ..$ Type of Gene ID                         : chr "Entrez Gene ID"
  .. .. ..$ Full dataset                            : chr "yes"
  .. .. ..$ miRBase build ID                        : chr NA
  .. .. ..$ transcript_nrow                         : chr "142446"
  .. .. ..$ exon_nrow                               : chr "447558"
  .. .. ..$ cds_nrow                                : chr "243727"
  .. .. ..$ Db created by                           : chr "GenomicFeatures package from Bioconductor"
  .. .. ..$ Creation time                           : chr "2019-10-21 20:52:26 +0000 (Mon, 21 Oct 2019)"
  .. .. ..$ GenomicFeatures version at creation time: chr "1.37.4"
  .. .. ..$ RSQLite version at creation time        : chr "2.1.2"
  .. .. ..$ DBSCHEMAVERSION                         : chr "1.2"
>
> class(t1)#: 查看变量类型,vector、data.frame、matrix、factor、list
[1] "GRanges"
attr(,"package")
[1] "GenomicRanges"
>
> mode(t1)#: 查看数据大类,character、numeric、logical
[1] "S4"
>
> typeof(t1)#: 查看数据细类,integer、double、single、float
[1] "S4"

 

==========================

 

posted @ 2021-06-16 20:42  emanlee  阅读(7357)  评论(0编辑  收藏  举报