Displaying 3 results from an estimated 3 matches for "grand_tot".
Did you mean:
grand_total
2017 Oct 29
0
Count non-zero values in excluding NA Values
...t;- matrix(1:100, ncol = 10)
data[sample(100, 15)] <- 0
data[sample(100, 10)] <- NA
data <- as.data.frame(data)
zero <- sapply(data, function(x) sum(x == 0, na.rm = TRUE))
na <- sapply(data, function(x) sum(is.na(x)))
totals <- nrow(data) - zero - na # totals non zero per column
grand_total <- sum(totals) # total non zero
totals
# V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
# 6 8 8 8 8 7 7 8 6 10
grand_total
#[1] 76
# another way
prod(dim(data)) - sum(zero + na)
#[1] 76
Hope this helps,
Rui Barradas
Em 29-10-2017 10:25, Engin YILMAZ escreveu:
> Dear...
2017 Oct 29
7
Count non-zero values in excluding NA Values
Dear R Staff
You can see my data.csv file in the annex.
I try to count non-zero values in dataset but I need to exclude NA in this
calculation
My code is very long (following),
How can I write this code more efficiently and shortly?
## [NA_Count] - Find NA values
data.na =sapply(data[,3:ncol(data)], function(c) sum(length(which(is.na
(c)))))
## [Zero] - Find zero values
2004 Oct 06
0
2x2 test: total confusion.
...ximation to the
binomial distribution with mean np and variance np(1-p), and correction
for continuity (+-0.5 depending on the direction of the test).
Should I use Fishers exact test? What do I do when the numbers are very
large?
Here is a sample of my data...
COLOR PICKER PICKED C_TOTAL P_TOTAL GRAND_TOTAL
46458 rs 2 706 3285 878702
46548 rs 6 725 3285 878702
46557 rs 2 180 3285 878702
46561 rs 1 243 3285 878702
46565 rs 2 1864 3285 878702
46579 rs 1 1263 3285 878702
46589 rs...