I would like to randomly delete up to three elements per row of a data set containing five columns. Below is R code I thought would do it, but it allows up to all five elements in a row to be deleted. This seems basic, but I cannot find the error. Thank you for any advice.
set.seed(1234)
# create matrix to contain flags identifying elements to be deleted
delete.these <- matrix(0, nrow=10, ncol=5)
for(i in 1:nrow(delete.these)) {
# for each row randomly select the order of the columns
# to be tested for deletion
rcols <- sample(5, 5, replace = FALSE)
for(j in 1:ncol(delete.these)) {
# select a random draw
delete.it <- runif(1,0,1)
# if random draw is below specified threshold and fewer than three
# elements have already been deleted from the row then delete element
if((delete.it <= 0.7) & sum(delete.these[i,1:5] <= 2)) { delete.these[i,rcols[j]] = 1}
if((delete.it > 0.7) | sum(delete.these[i,1:5] >= 3)) { delete.these[i,rcols[j]] = 0}
}
}
delete.these
Instead of using runif() try drawing the indices directly
delete.these <- matrix(0, nrow=10, ncol=5)
for (i in 1:NROW(delete.these)){
delete.these[i,sample.int(5,sample.int(4,1)-1)] <- 1
}
delete.these
[,1] [,2] [,3] [,4] [,5]
[1,] 1 1 1 0 0
[2,] 0 0 0 0 0
[3,] 0 1 0 1 1
[4,] 0 1 1 0 1
[5,] 1 0 1 0 0
[6,] 0 0 0 0 0
[7,] 1 0 1 0 0
[8,] 0 1 0 1 1
[9,] 0 1 1 0 0
[10,] 1 0 1 0 1
By the way your code doesn't work because of a misplaced paren.
sum(delete.these[i,1:5] <= 2)
should be instead
sum(delete.these[i,1:5]) <= 2
It would be easier (and much faster) to delete with a two column-matrix as an argument to [<-. You did not propose a test case but I will:
dfrm <- data.frame(a1=rnorm(20), a2=rnorm(20),a3=rnorm(20),
a4=rnorm(20),a5=rnorm(20))
dfrm[ matrix( c( rep(1:20,each=3),
replicate(20, {sample(5, 3)} ) ), ncol=2) ] <- NA
> dfrm
a1 a2 a3 a4 a5
1 NA 0.70871541 NA NA -0.6922827
2 1.9846227 1.70592512 NA NA NA
3 0.2684487 NA 0.0008968694 NA NA
4 NA NA 0.5546355410 0.07399188 NA
5 NA 0.82324761 -0.0410918599 NA NA
6 NA NA -1.0715205164 NA -0.1683819
7 0.0933059 NA NA NA 1.3129301
8 NA 0.79382695 0.1877369725 NA NA
9 0.3124101 NA NA -1.22087347 NA
10 -0.1657043 NA NA 1.36626832 NA
11 NA -0.06095247 -0.9622792102 NA NA
12 NA -1.29243386 -1.2133819819 NA NA
13 -0.0886702 NA NA 0.37495775 NA
14 1.0812527 -1.54215156 NA NA NA
15 NA -0.24765627 NA 0.81374405 NA
16 NA 0.21307051 NA NA -0.6825013
17 -0.4129100 NA NA NA -0.9844177
18 NA 1.95881167 0.7977172969 NA NA
19 NA NA 0.0953287645 NA 1.7067591
20 NA NA -0.1057690912 0.73408897 NA
This is assuming that by "delete" you meant set to missing. If the intent were something else you will need to supply a test case and clarify.
This (nested sampling strategy will provide a variable number of rows in the indexing matrix per row of the target matrix:
idx <- sapply(1:20, function(x) {n<- sample(1:5, sample(1:3,1))
matrix( c(rep(x,length(n)), n), ncol=2) }) # list
idx <- do.call(rbind, idx) # now a 2 col matrix
dfrm[ idx] <- NA
> idx <- sapply(1:20, function(x) {n<- sample(1:5, sample(1:3,1))
+ matrix( c(rep(x,length(n)), n), ncol=2) }) # list
> idx <- do.call(rbind, idx) # now a 2 col matrix
>
> dfrm[ idx] <- NA
>
> dfrm
a1 a2 a3 a4 a5
1 -0.048776740 NA 1.1879195 -0.23142932 -3.6185891
2 NA 0.4613289 -0.4532400 -0.85891682 -2.2034714
3 NA NA 1.1191833 1.12545821 NA
4 0.646399767 -0.7126735 2.9474470 0.36358070 NA
5 -0.630929314 1.3770828 NA NA 1.3987857
6 NA NA NA 1.06680025 0.4445383
7 0.484728630 NA 0.7382064 NA 0.9838159
8 -1.558031074 1.1630888 NA NA NA
9 -0.968887379 -0.7330051 NA 0.04621124 -0.9785049
10 0.935436533 NA NA -1.07365274 NA
11 NA 0.2529093 NA -1.38643245 -1.3389529
12 NA -0.2639166 -0.2301257 NA NA
13 2.026646586 -0.2452684 NA -0.30346521 NA
14 0.522717033 NA NA 1.25870278 NA
15 NA NA -0.9934046 -0.89009964 -0.8403772
16 NA NA 0.0987765 -0.98608109 1.4646301
17 NA 0.7693064 -0.9326388 -0.16240266 NA
18 -0.005393965 NA NA NA -0.8111057
19 NA 1.6241122 -1.1376916 0.15812435 NA
20 NA NA NA 0.71059666 0.5170046
Related
I have created a data frame, in the data frame there are 3 sites and I have created a nested for loop to create my desired matrices. THe overall objective is find a more efficient way to do this for each of the 3 sites instead of just the one.
The outputs from the nested for loop (EDmatrix and timelags) are the expected results for the other two sites. I would like to find a more efficient way of obtaining these matrices as well as be able to do it for all site instead of just the one in this example.
set.seed(123)
d1 = sample.int(50, 27)
d2 = sample.int(50, 27)
d3 = sample.int(50, 27)
year <- c(1990:1998)
site <- c(rep("a", 9), rep("b", 9), rep("c", 9))
ED = function(x,y){
#x and y are vectors of spp abundances
#they must be the same length!
if(length(x)!=length(y)) stop("Bad abundances!")
out = sqrt(sum((x-y)^2))
out
}
df <- data.frame(site, year, d1 = d1, d2 = d2, d3 = d3)
Here is the code to get the expected output for only a single site, but I would like to be able to do this for all of the sites in the data frame df.
subdf = subset(df,site=="a") # subset data for one site
EDmatrix = matrix(NA,dim(subdf)[1],dim(subdf)[1]) # create a place to store the dissimilarity values
timeLags = matrix(NA,dim(subdf)[1],dim(subdf)[1]) # create a place to store the time lags
# First loop through all "j" years from 1 to the total number of years
# Now loop through all "k" years from 1 to the total number of years
for(j in 1: length(subdf$year)){
for(k in 1: length(subdf$year)){
# grab density data for year "j"
jdensity <- subdf[j,-c(1:2)]
# grab density data for year "k"
kdensity <- subdf[k,-c(1:2)]
# calculate and store (in the EDmatrix) the ED value based on the data for year j and k
EDmatrix[j,k] <- ED(jdensity, kdensity)
# calculate and store (in timeLags) the time lag (the absolute value of the difference
# in time between year j and k
timeLags[j,k] <- abs(subdf[j, 2] - subdf[k, 2])
}# exit k loop
}# exit j loop
EDmatrix[lower.tri(EDmatrix, diag=T)]=NA # set duplicate entries to NA
timeLags[lower.tri(timeLags, diag=T)]=NA # set duplicate entries to NA
y = as.vector(EDmatrix) # turn the matrix into a vector
x = as.vector(timeLags)
We may use outer for this operation
library(dplyr)
library(tidyr)
library(purrr)
f1 <- function(dat, i, j) {
subdat <- dat %>%
select(starts_with('d'))
jdensity <- subdat[i, ]
kdensity <- subdat[j,]
EDtmp <- ED(jdensity, kdensity)
timetmp <- abs(dat$year[i] - dat$year[j])
tibble(EDtmp, timetmp)
}
f2 <- function(dat, s1, s2) {
mat <- outer(s1, s2, Vectorize(\(i, j) list(f1(dat, i, j))))
EDmatrix <- matrix(map_dbl(mat, ~ .x$EDtmp), length(s1), length(s1))
timeLags <- matrix(map_dbl(mat, ~ .x$timetmp), length(s1), length(s1))
EDmatrix[lower.tri(EDmatrix, diag=TRUE)]=NA
timeLags[lower.tri(timeLags, diag=TRUE)]=NA
y = as.vector(EDmatrix)
x = as.vector(timeLags)
tibble(y, x)
}
out1 <- df %>%
group_by(site) %>%
summarise(out = f2(cur_data(), row_number(), row_number()),
.groups = 'drop') %>%
unnest(out)
-checking with OP's output
> out1$x[out1$site == "a"]
[1] NA NA NA NA NA NA NA NA NA 1 NA NA NA NA NA NA NA NA 2 1 NA NA NA NA NA NA NA 3 2 1 NA NA NA NA NA NA 4 3 2 1 NA NA NA NA NA 5 4 3
[49] 2 1 NA NA NA NA 6 5 4 3 2 1 NA NA NA 7 6 5 4 3 2 1 NA NA 8 7 6 5 4 3 2 1 NA
> x
[1] NA NA NA NA NA NA NA NA NA 1 NA NA NA NA NA NA NA NA 2 1 NA NA NA NA NA NA NA 3 2 1 NA NA NA NA NA NA 4 3 2 1 NA NA NA NA NA 5 4 3
[49] 2 1 NA NA NA NA 6 5 4 3 2 1 NA NA NA 7 6 5 4 3 2 1 NA NA 8 7 6 5 4 3 2 1 NA
> out1$y[out1$site == "a"]
[1] NA NA NA NA NA NA NA NA NA 30.675723 NA NA NA NA
[15] NA NA NA NA 41.388404 18.055470 NA NA NA NA NA NA NA 42.485292
[29] 33.136083 25.729361 NA NA NA NA NA NA 38.288379 41.581246 34.770677 39.433488 NA NA
[43] NA NA NA 13.038405 38.379682 49.264592 54.083269 40.865633 NA NA NA NA 16.431677 25.317978
[57] 36.701499 47.549974 36.359318 15.362291 NA NA NA 34.799425 54.680892 54.018515 49.254441 26.019224 35.791060 41.484937
[71] NA NA 9.433981 34.842503 46.108568 42.801869 45.199558 19.924859 25.079872 38.652296 NA
> y
[1] NA NA NA NA NA NA NA NA NA 30.675723 NA NA NA NA
[15] NA NA NA NA 41.388404 18.055470 NA NA NA NA NA NA NA 42.485292
[29] 33.136083 25.729361 NA NA NA NA NA NA 38.288379 41.581246 34.770677 39.433488 NA NA
[43] NA NA NA 13.038405 38.379682 49.264592 54.083269 40.865633 NA NA NA NA 16.431677 25.317978
[57] 36.701499 47.549974 36.359318 15.362291 NA NA NA 34.799425 54.680892 54.018515 49.254441 26.019224 35.791060 41.484937
[71] NA NA 9.433981 34.842503 46.108568 42.801869 45.199558 19.924859 25.079872 38.652296 NA
I am trying to add two columns. My dataframe is like this one:
data <- data.frame(a = c(0,1,NA,0,NA,NA),
x = c(NA,NA,NA,NA,1,0),
t = c(NA,2,NA,NA,2,0))
I want to add some of the columns like this:
yep <- cbind.data.frame( data$a, data$x, rowSums(data[,c(1, 2)], na.rm = TRUE))
However the output looks like this:
> yep
data$a data$x rowSums(data[,c(1, 2)], na.rm = TRUE)
1 0 NA 0
2 1 NA 1
3 NA NA 0
4 0 NA 0
5 NA 1 1
6 NA 0 0
And I would like an oputput like this:
> yep
data$a data$x rowSums(data[,c(1, 2)], na.rm = TRUE)
1 0 NA 0
2 1 NA 1
3 NA NA NA
4 0 NA 0
5 NA 1 1
6 NA 0 0
If the columns contain only NA values I want to leave the NA values.
How I could achive this?
Base R:
data <- data.frame("a" = c(0,1,NA,0,NA,NA),
"x" = c(NA,NA,NA,NA,1,0),
"t" = c(NA,2,NA,NA,2,0)
)
yep <- cbind.data.frame( data$a, data$x, rs = rowSums(data[,c(1, 2)], na.rm = TRUE))
yep$rs[is.na(data$a) & is.na(data$x)] <- NA
yep
Base R (ifelse):
cbind(data$a,data$x,ifelse(is.na(data$a) & is.na(data$x),NA,rowSums(data[,1:2],na.rm = TRUE)))
If you are looking for the column name then replace cbind with cbind.data.frame
Output:
[,1] [,2] [,3]
[1,] 0 NA 0
[2,] 1 NA 1
[3,] NA NA NA
[4,] 0 NA 0
[5,] NA 1 1
[6,] NA 0 0
You might try dplyr::coalesce
cbind.data.frame( data$a, data$x, dplyr::coalesce(data$a, data$x))
# data$a data$x dplyr::coalesce(data$a, data$x)
#1 0 NA 0
#2 1 NA 1
#3 NA NA NA
#4 0 NA 0
#5 NA 1 1
#6 NA 0 0
base r ifelse
data[['rowsum']]<-ifelse(is.na(data$a) & is.na(data$x),NA,ifelse(is.na(data$a),0,data$a)+ifelse(is.na(data$x),0,data$x))
a x t rowsum
1: 0 NA NA 0
2: 1 NA 2 1
3: NA NA NA NA
4: 0 NA NA 0
5: NA 1 2 1
6: NA 0 0 0
Another base R approach.
If all the values in the rows are NA then return NA or else return sum of the row ignoring NA's.
#Select only the columns which we need
sub_df <- data[c("a", "x")]
sub_df$answer <- ifelse(rowSums(is.na(sub_df)) == ncol(sub_df), NA,
rowSums(sub_df, na.rm = TRUE))
sub_df
# a x answer
#1 0 NA 0
#2 1 NA 1
#3 NA NA NA
#4 0 NA 0
#5 NA 1 1
#6 NA 0 0
I have a matrix of pairwise comparisons of all plots in my dataset. Matrix fill represents shared species among plots.
Plot4 Plot5 Plot6 Plot7 Plot8 Plot9 Plot10
Plot4 NA NA NA NA NA NA NA
Plot5 0 NA NA NA NA NA NA
Plot6 1 0 NA NA NA NA NA
Plot7 0 0 0 NA NA NA NA
Plot8 0 1 0 0 NA NA NA
Plot9 0 1 0 0 2 NA NA
Plot10 0 0 0 0 1 1 NA
This matrix came from the following dataframe:
data<-
region plot species
1 104 A_B
1 105 B_C
1 106 A_B
1 107 C_D
2 108 B_C
2 108 E_F
2 109 B_C
2 109 E_F
2 110 E_F
These plots are associated with certain regions. I generated the following loop that creates this pairwise comparison matrix for all 500 plots:
plots<-unique(data$plot)
plot.num<-length(plots)
output<-matrix(0, plot.num, plot.num)
for (i in 1:plot.num) {
for (j in 1:plot.num) {
plot_i<-data[data$plot==plots[i],]
plot_j<-data[data$plot==plots[j],]
output[i,j]<-length(intersect(plot_i$species, plot_j$species))
}
}
F.mat<-output
F.mat[lower.tri(F.mat, diag=T)]<-0
However, now I want to create a loop that subsets the larger matrix above by region to make a list of regional matrices.
output<-
[[1]]
Plot4 Plot5 Plot6 Plot7
Plot4 NA NA NA NA
Plot5 0 NA NA NA
Plot6 1 0 NA NA
Plot7 0 0 0 NA
[[2]] Plot8 Plot9 Plot10
Plot8 NA NA NA
Plot9 2 NA NA
Plot10 1 1 NA
NOTE: This is a quantitative matrix not presence/absence.
You could put your evaluation into a function and then lapply over the regions:
countFun <- function(relData){
plots <- unique(relData$plot)
plot.num <- length(plots)
output <- matrix(NA, plot.num, plot.num)
if (plot.num > 1){
for (i in 2:plot.num) {
for (j in 1:(i-1)) {
plot_i <- relData[relData$plot==plots[i],]
plot_j <- relData[relData$plot==plots[j],]
output[i,j] <- length(intersect(plot_i$species, plot_j$species))
}
}
}
output
}
lapply(unique(data$region), function(region) countFun(data[data$region == region,]))
# [[1]]
# [,1] [,2] [,3] [,4]
# [1,] NA NA NA NA
# [2,] 0 NA NA NA
# [3,] 1 0 NA NA
# [4,] 0 0 0 NA
#
# [[2]]
# [,1] [,2] [,3]
# [1,] NA NA NA
# [2,] 2 NA NA
# [3,] 1 1 NA
I have a dataframe of 3500 observations and 278 variables. For each row going from the first column, I want to replace all values occurring after the first NA by NAs. For instance, I want to go from a dataframe like so:
X1 X2 X3 X4 X5
1 3 NA 6 9
1 NA 4 6 18
6 7 NA 3 1
10 1 2 NA 2
To something like
X1 X2 X3 X4 X5
1 3 NA NA NA
1 NA NA NA NA
6 7 NA NA NA
10 1 2 NA NA
I tried using the following nested for loop, but it is not terminating:
for(i in 2:3500){
firstna <- min(which(is.na(df[i,])))
df[i, firstna:278] <- NA
}
Is there a more efficient way to do this? Thanks in advance.
You could do something like this:
# sample data
mat <- matrix(1, 10, 10)
set.seed(231)
mat[sample(100, 7)] <- NA
You can use apply with cumsum and is.na to keep track of where NAs need to be placed (i.e. places across the row where the cumulative sum of NAs is greater than 0). Then, use those locations to assign NAs to the original structure in the appropriate places.
mat[t(apply(is.na(mat), 1, cumsum)) > 0 ] <- NA
# [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
# [1,] 1 1 1 1 1 1 NA NA NA NA
# [2,] NA NA NA NA NA NA NA NA NA NA
# [3,] 1 1 1 1 1 1 1 1 1 1
# [4,] 1 1 1 1 1 1 1 1 1 1
# [5,] 1 1 1 NA NA NA NA NA NA NA
# [6,] 1 1 1 1 1 1 1 1 1 1
# [7,] 1 NA NA NA NA NA NA NA NA NA
# [8,] 1 1 1 1 1 1 1 1 1 1
# [9,] 1 1 1 1 1 1 1 1 1 1
#[10,] 1 1 NA NA NA NA NA NA NA NA
Works the fine with data frames. Using the provided example data:
d<-read.table(text="
X1 X2 X3 X4 X5
1 3 NA 6 9
1 NA 4 6 18
6 7 NA 3 1
10 1 2 NA 2 ", header=TRUE)
d[t(apply(is.na(d), 1, cumsum)) > 0 ] <- NA
# X1 X2 X3 X4 X5
#1 1 3 NA NA NA
#2 1 NA NA NA NA
#3 6 7 NA NA NA
#4 10 1 2 NA NA
We can use rowCumsums from library(matrixStats)
library(matrixStats)
d*NA^rowCumsums(+(is.na(d)))
# X1 X2 X3 X4 X5
#1 1 3 NA NA NA
#2 1 NA NA NA NA
#3 6 7 NA NA NA
#4 10 1 2 NA NA
Or a base R option is
d*NA^do.call(cbind,Reduce(`+`,lapply(d, is.na), accumulate=TRUE))
I did this using the cumany function from the dplyr package, which returns TRUE for each element after the condition is met.
df <- read.table(text = "X1 X2 X3 X4 X5
1 3 NA 6 9
1 NA 4 6 18
6 7 NA 3 1
10 1 2 NA 2 ",
header = T)
library(plyr)
library(dplyr)
na_row_replace <- function(x){
x[which(cumany(is.na(x)))] <- NA
return(x)
}
adply(df, 1, na_row_replace)
my problem at the moment is the following. I have an directed 1-mode edgelist representing pairs of actors participating in joint projects in a certain year, which might look like:
projektleader projectpartner year
A B 2005
A C 2000
B A 2002
... ... ...
Now I need only a subset for one particular year. Not all actors are active in very year, so the dimensions of the subsets differ. For a following Network Analysis, I need a weighted and directed adjacency matrix, so I use the option of the [network package] to create it. I first load it as a network object and transform it then in a adjacency matrix.
grants_00 <- subset(grants, (year_grant=2000), select = c(projectpartner, projectleader))
nw_00 <- network(grants_08to11[,1:2], matrix="edgelist", directed=TRUE)
grants_00.adj <- as.matrix(nw_00, matrix.type = "adjacency")
The resulting matrix looks somewhat like
A B C E ...
A 0 1 1 0
B 1 0 0 0
...
So far so good. My problem is now: For the further analysis I am planning to do I need an adjacency Matrix for every year with the same dimension and order. That means that all actors from the initial dataset have to be the row and column names of the matrix for the corresponding years, but the matrix should only contain observed pairs for this certain year. I hope my problem is clear. I appreciate any kind of constructive solutions.
My idea ATM is the following: I create a matrix of the initial dataset and the reduced dataset. Then I set all matrix values there to Zero. Then I somehow match it with the reduced matrix and fill it with the right values in the right rows and columns. Unfortunately I have no clue how this might be possible.
Has anybody an idea how to solve this problem?
Unfortunately , your question is not clear, so I will try to answer.
If I understand you want :
****Given a big and small matrix : Find the locations where they match?****
I regenerate your data
library(network)
N <- 20
grants <- data.frame(
projectleader = sample(x=LETTERS[1:20],size=N,replace = TRUE),
projectpartner = sample(x=LETTERS[1:20],size=N,replace = TRUE),
year_grant = sample(x=0:5 ,size=N,replace = TRUE) +2000
)
head(grants)
projectleader projectpartner year_grant
1 D K 2002
2 M M 2001
3 K L 2005
4 N Q 2002
5 G D 2003
6 I B 2004
Function to create the small matrix
##
adjency <- function(year){
grants_00 <- subset(grants, (year_grant==year),
select = c(projectpartner, projectleader))
nw_00 <- network(grants_00, matrix="edgelist", directed=TRUE)
grants_00.adj <- as.matrix(nw_00, matrix.type = "adjacency")
as.data.frame(grants_00.adj)
}
use plyr to get a list for every year
library(plyr)
years <- unique(grants$year_grant)
years <- years[order(years)]
bigMatrix <- llply(as.list(years),.fun=adjm)
Create full matrix (The answer)
# create an empty matrix with NAs
population <- union(grants$projectpartner,grants$projectleader)
population_size <- length(population)
full_matrix <- matrix(rep(NA, population_size*population_size),
nrow=population_size)
rownames(full_matrix) <- colnames(full_matrix) <- population
find the location where they match
frn <- as.matrix(bigMatrix[[1]])
tmp <- match(rownames(frn), rownames(full_matrix))
tmp2 <- match(colnames(frn), colnames(full_matrix))
# do a merge
full_matrix[tmp,tmp2] <- frn
head(bigMatrix[[1]])
D I J K O Q S
D 0 0 0 0 0 0 0
I 0 0 0 0 0 0 0
J 1 0 0 0 0 0 0
K 0 0 0 0 0 0 0
O 0 0 0 1 0 0 0
Q 0 1 0 0 0 0 0
the full matrix
K M L Q D B E J C S O F G N I A H
K 0 NA NA 0 0 NA NA 0 NA 0 0 NA NA NA 0 NA NA
M NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
L NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
Q 0 NA NA 0 0 NA NA 0 NA 0 0 NA NA NA 1 NA NA
D 0 NA NA 0 0 NA NA 0 NA 0 0 NA NA NA 0 NA NA
B NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
E NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
J 0 NA NA 0 1 NA NA 0 NA 0 0 NA NA NA 0 NA NA
C NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
S 0 NA NA 1 0 NA NA 0 NA 0 0 NA NA NA 0 NA NA
O 1 NA NA 0 0 NA NA 0 NA 0 0 NA NA NA 0 NA NA
F NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
G NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
N NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
I 0 NA NA 0 0 NA NA 0 NA 0 0 NA NA NA 0 NA NA
A NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
H NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA