Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Lanzate vector growing issue #29

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions R/Lanzante.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ Lanzante <- function(data, col, time, p =0.05, merge = FALSE){
db <- data

#vectors for later
SR_vec <- vector()
SA_vec <- vector()
shift_years <- vector()
p_vals <- vector()

#creates rank sum and adjusted sum table
for(n in 1:nrows_full){

#vectors for SR and SA
SR_vec <- vector()
SA_vec <- vector()

ranks <- rank(db[[col]])
nrows <- nrow(db)
for(i in 1:nrows){
SR <- sum(ranks[1:i])
SR_vec <- c(SR_vec, SR)
SA <- abs(2 * SR - i * (nrows + 1))
SA_vec <- c(SA_vec, SA)
}
}
#creates table of SR and corresponding SA
sum_vals <- as.data.frame(cbind(SR_vec, SA_vec))

Expand Down
Loading