Skip to contents

Rename view in a view composition

Usage

rename_view(current.views, old.name, new.name, new.abbrev = new.name)

Arguments

current.views

the current view composition.

old.name

old name of the view.

new.name

new name of the view.

new.abbrev

new abbreviated name.

Value

A mistyR view composition with a renamed view.

See also

Other view manipulation functions: filter_views(), select_markers()

Examples

view1 <- data.frame(marker1 = rnorm(100, 10, 2), marker2 = rnorm(100, 15, 3))
view2 <- data.frame(marker1 = rnorm(100, 10, 5), marker2 = rnorm(100, 15, 5))

misty.views <- create_initial_view(view1) %>%
  add_views(create_view("originalname", view2, "on"))
str(misty.views)
#> List of 3
#>  $ intraview     :List of 2
#>   ..$ abbrev: chr "intra"
#>   ..$ data  :'data.frame':	100 obs. of  2 variables:
#>   .. ..$ marker1: num [1:100] 7.05 7.19 13.98 9.18 8.68 ...
#>   .. ..$ marker2: num [1:100] 5.82 17.39 13.54 7.83 18.56 ...
#>  $ misty.uniqueid: chr "397aabb41517c46aac7d78a2001bec9f"
#>  $ originalname  :List of 2
#>   ..$ abbrev: chr "on"
#>   ..$ data  :'data.frame':	100 obs. of  2 variables:
#>   .. ..$ marker1: num [1:100] 12.61 9.46 12.83 17.66 8.12 ...
#>   .. ..$ marker2: num [1:100] 20.7 17.2 19.1 20.7 17.1 ...

# rename and preview
misty.views %>%
  rename_view("originalname", "renamed", "rn") %>%
  str()
#> List of 3
#>  $ intraview     :List of 2
#>   ..$ abbrev: chr "intra"
#>   ..$ data  :'data.frame':	100 obs. of  2 variables:
#>   .. ..$ marker1: num [1:100] 7.05 7.19 13.98 9.18 8.68 ...
#>   .. ..$ marker2: num [1:100] 5.82 17.39 13.54 7.83 18.56 ...
#>  $ misty.uniqueid: chr "397aabb41517c46aac7d78a2001bec9f"
#>  $ renamed       :List of 2
#>   ..$ abbrev: chr "rn"
#>   ..$ data  :'data.frame':	100 obs. of  2 variables:
#>   .. ..$ marker1: num [1:100] 12.61 9.46 12.83 17.66 8.12 ...
#>   .. ..$ marker2: num [1:100] 20.7 17.2 19.1 20.7 17.1 ...