Skip to contents

Set facets for a GDCQuery

Get facets for a GDCQuery

Usage

facet(x, facets)

get_facets(x)

# S3 method for GDCQuery
get_facets(x)

Arguments

x

a GDCQuery object

facets

a character vector of fields that will be used for forming aggregations (facets). Default is to set facets for all default fields. See default_fields for details

Value

returns a GDCQuery object, with facets field updated.

Examples

# create a new GDCQuery against the projects endpoint
gProj = projects()

# default facets are NULL
get_facets(gProj)
#> NULL

# set facets and save result
gProjFacet = facet(gProj)

# check facets
get_facets(gProjFacet)
#>  [1] "dbgap_accession_number" "disease_type"           "intended_release_date" 
#>  [4] "name"                   "primary_site"           "project_autocomplete"  
#>  [7] "project_id"             "releasable"             "released"              
#> [10] "state"                 

# and get a response, noting that
# the aggregations list member contains
# tibbles for each facet
str(response(gProjFacet,size=2),max.level=2)
#> List of 4
#>  $ results     :'data.frame':	2 obs. of  9 variables:
#>   ..$ id                    : chr [1:2] "TARGET-NBL" "GENIE-GRCC"
#>   ..$ primary_site          :List of 2
#>   ..$ dbgap_accession_number: chr [1:2] "phs000467" NA
#>   ..$ project_id            : chr [1:2] "TARGET-NBL" "GENIE-GRCC"
#>   ..$ disease_type          :List of 2
#>   ..$ name                  : chr [1:2] "Neuroblastoma" "AACR Project GENIE - Contributed by Institut Gustave Roussy"
#>   ..$ releasable            : logi [1:2] TRUE TRUE
#>   ..$ state                 : chr [1:2] "open" "open"
#>   ..$ released              : logi [1:2] TRUE TRUE
#>  $ query       :List of 5
#>   ..$ fields : chr [1:10] "dbgap_accession_number" "disease_type" "intended_release_date" "name" ...
#>   ..$ filters: NULL
#>   ..$ facets : chr [1:10] "dbgap_accession_number" "disease_type" "intended_release_date" "name" ...
#>   ..$ legacy : logi FALSE
#>   ..$ expand : NULL
#>   ..- attr(*, "class")= chr [1:3] "gdc_projects" "GDCQuery" "list"
#>  $ pages       :List of 7
#>   ..$ count: int 2
#>   ..$ total: int 72
#>   ..$ size : int 2
#>   ..$ from : int 0
#>   ..$ sort : chr ""
#>   ..$ page : int 1
#>   ..$ pages: int 36
#>  $ aggregations:List of 10
#>   ..$ dbgap_accession_number:'data.frame':	27 obs. of  2 variables:
#>   ..$ releasable            :'data.frame':	2 obs. of  2 variables:
#>   ..$ released              :'data.frame':	1 obs. of  2 variables:
#>   ..$ project_id            :'data.frame':	72 obs. of  2 variables:
#>   ..$ state                 :'data.frame':	2 obs. of  2 variables:
#>   ..$ primary_site          :'data.frame':	68 obs. of  2 variables:
#>   ..$ project_autocomplete  :'data.frame':	200 obs. of  2 variables:
#>   ..$ name                  :'data.frame':	71 obs. of  2 variables:
#>   ..$ disease_type          :'data.frame':	59 obs. of  2 variables:
#>   ..$ intended_release_date :'data.frame':	1 obs. of  2 variables:
#>  - attr(*, "class")= chr [1:3] "GDCprojectsResponse" "GDCResponse" "list"