Reputation: 341
I am very new to R Programming,
I am triyng to calculate the mean of z[1]
and keeping 70=<z[2]<=72
by the way
z[1]
includes NA s.
I try this
mean([z[1]!is.na(z[1])]& 70 =<z[2]<= 72)
but does not work.
If you help me , I would really appreciate.
Thanks
Upvotes: 0
Views: 43
Reputation: 887183
I guess you need
mean(z[,1][70 <= z[,2] & z[,2] <= 72], na.rm=TRUE)
set.seed(45)
z <- matrix(sample(c(NA,70:80), 5*10, replace=TRUE), ncol=5, nrow=10)
Upvotes: 2