Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAs converted to character in antigen & sera attributes #118

Open
drserajames opened this issue Mar 20, 2022 · 0 comments
Open

NAs converted to character in antigen & sera attributes #118

drserajames opened this issue Mar 20, 2022 · 0 comments
Assignees

Comments

@drserajames
Copy link
Member

drserajames commented Mar 20, 2022

I noticed this unexpected behaviour when colouring a map. If you try to set an attribute as a vector of NAs, you get an error. If you have some character values and some NAs, there's no error/warning and result have changed NA values to "NA".

I'm assuming that there's a reason for this; I'd be interested to know what it is.

I think a warning, "NA values have been converted too character", would be useful and some detail in the documentation. I'm happy to do this next time I work on Racmacs (but might need a hand with the warning).

Edit: Perhaps the NA values should be converted to ""?

> library(Racmacs)
> packageVersion("Racmacs")
[1] ‘1.1.35’
> set.seed(850909)
> dat <- matrix(10*2^round(10*runif(100)), ncol=10)
> map <- make.acmap(dat)
Performing 100 optimizations
============================================================================================================
Optimization runs complete
Took 0.05 secs

> 
> map_col <- rep(NA, 10)
> map_col[1:5] <- rainbow(5)
> map_col
 [1] "#FF0000" "#CCFF00" "#00FF66" "#0066FF" "#CC00FF" NA        NA        NA        NA        NA       
> 
> agFill(map) <- map_col
> agFill(map)
 [1] "#FF0000" "#CCFF00" "#00FF66" "#0066FF" "#CC00FF" "NA"      "NA"      "NA"      "NA"      "NA"     
> 
> 
> srIDs(map) <- rep(NA,10)
Error: Input must be a character vector
> 
> sr_id <- rep(NA,10)
> sr_id[1:5] <- paste0("S",1:5)
> srIDs(map) <- sr_id
> srIDs(map)
 [1] "S1" "S2" "S3" "S4" "S5" "NA" "NA" "NA" "NA" "NA"
@drserajames drserajames self-assigned this Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant