indexing - making an integer vector from index of another vector in R -


i have started learn r, , trying following task.

i have vector of 10 random values few nas , few numeric values in it,

 <- rnorm(100)  b <- rep(na, 100)  c <- sample(c(a, b), 10) 

now want make vector "d" has indices of na values in "c" example

 d <- c(2, 7, 9) 

i tried

 d <- which(c %in% is.na(c)) 

but not giving me desired result

also wrong code tried above purpose

navects <- function(x) {   for(i in 1:length(x)) {        if(is.na(x[i])) c(i)   } } 

you can try which

 which(is.na(c)) 

note: c function, better not name objects c.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -