Translated fiksaaPartitioYksiloTasolle() (#2)
This commit is contained in:
parent
cf77908604
commit
8860f0159c
1 changed files with 17 additions and 0 deletions
17
R/fiksaaPartitioYksiloTasolle.R
Normal file
17
R/fiksaaPartitioYksiloTasolle.R
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
fiksaaPartitioYksiloTasolle <- function(rows, rowsFromInd) {
|
||||
# Fix partition to individual level
|
||||
totalRows <- 0
|
||||
for (ind in 1:size(rows, 1)) {
|
||||
totalRows <- totalRows + (rows[ind, 2] - rows[ind, 1] + 1)
|
||||
}
|
||||
partitio2 <- zeros(totalRows / rowsFromInd, 1)
|
||||
|
||||
for (ind in 1:size(rows, 1)) {
|
||||
kaikkiRivit <- rows[ind, 1]:rows[ind, 2]
|
||||
for (riviNumero in seq(rowsFromInd, length(kaikkiRivit), rowsFromInd)) {
|
||||
rivi <- kaikkiRivit[riviNumero]
|
||||
partitio2[rivi / rowsFromInd] <- PARTITION[ind]
|
||||
}
|
||||
}
|
||||
PARTITION <<- partitio2
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue