How do I replace columns with fewer than x values with NA in R -


i have matrix columns have 10 rows. want replace values in each column has fewer 10 rows. how accomplish in r?

thanks

you can try this

df[df==""] <- na   name dist 1       0 2    <na> 3     100 4       2 5       1 6       4 7    <na> 8       1 9       1 

#data

df <- data.frame(name = rep("a",9), dist = c(0,"",100,2,1,4,"",1,1)) 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -