data(UShouseprice)
# Helper function to calculate log differences and scale
log_diff <- function(x) {
T <- nrow(x)
res <- log(x[2:T, ] / x[1:(T - 1), ]) * 100
scale(res, center = TRUE, scale = TRUE)
}
# Apply to all states
UShouseprice1 <- lapply(UShouseprice, log_diff)
Run the code above in your browser using DataLab