r - NA values not being excluded in `cor` -
to simplify, have data set follows:
b <- 1:6 # > b # [1] 1 2 3 4 5 6 jnk <- c(2, 4, 5, na, 7, 9) # > jnk # [1] 2 4 5 na 7 9 when try:
cor(b, jnk, na.rm=true) i get:
> cor(b, jnk, na.rm=t) error in cor(b, jnk, na.rm = t) : unused argument (na.rm = t) i've tried na.action = na.exclude, etc. none seem work. it'd helpful know issue , how can fix it. thanks.
read ?cor:
cor(x, y = null, use = "everything", method = c("pearson", "kendall", "spearman")) it doesn't have na.rm, has use.
an optional character string giving method computing covariances in presence of missing values. must (an abbreviation of) 1 of strings
"everything","all.obs","complete.obs","na.or.complete", or"pairwise.complete.obs".
pick one. details of each in details section of ?cor.
Comments
Post a Comment