The code provided below works on one R Studio window. When I copy/paste into another window, it doesn't work. Why is this???

#Hand Written Soil Test Report Array

T <- structure(list(SITE = structure(c(3L, 2L, 1L), .Label = c("Cedartown", "KSU Field Station", "Decatur"), class = "factor"), PHOSPHORUS = c(11L, 16L, 7L), POTASSIUM = c(283L, 170L, 216L), CALCIUM = c(1178L, 7956L, 7202L), MAGNESIUM = c(225L, 292L, 656L), ZINC = c(9L, 6L, 245L)), Names = c("SITE", "PHOSPHORUS", "POTASSIUM", "CALCIUM", "MAGNESIUM", "ZINC"), class = "data.frame", row.names = c(NA, -3L))

T

#Correlation Between P and K; Round Decimals; Percentage of Shared Variance

R1 <- cor(PHOSPHORUS, POTASSIUM)

round(R1, 2)

100 * (R1**2)

#Correlation Between P and Ca; Round Decimals; Percentage of Shared Variance

R2 <- cor(PHOSPHORUS, CALCIUM)

round(R2, 2)

100 * (R2**2)

#Correlation Between P and Mg; Round Decimals; Percentage of Shared Variance

R3 <- cor(PHOSPHORUS, MAGNESIUM)

round(R3, 2)

100 * (R3**2)

#Correlation Between P and Zn; Round Decimals; Percentage of Shared Variance

R4 <- cor(PHOSPHORUS, ZINC)

round(R4, 2)

100 * (R4**2)

#Correlation Between K and Ca; Round Decimals; Percentage of Shared Variance

R5 <- cor(POTASSIUM, CALCIUM)

round(R5, 2)

100 * (R5**2)

#Correlation Between K and Mg; Round Decimals; Percentage of Shared Variance

R6 <- cor(POTASSIUM, MAGNESIUM)

round(R6, 2)

100 * (R6**2)

#Correlation Between K and Zn; Round Decimals; Percentage of Shared Variance

R7 <- cor(POTASSIUM, ZINC)

round(R7, 2)

100 * (R7**2)

#Correlation Between Ca and Mg; Round Decimals; Percentage of Shared Variance

R8 <- cor(CALCIUM, MAGNESIUM)

round(R8, 2)

100 * (R8**2)

#Correlation Between Ca and Zn; Round Decimals; Percentage of Shared Variance

R9 <- cor(CALCIUM, ZINC)

round(R9, 2)

100 * (R9**2)

#Correlation Between Mg and Zn; Round Decimals; Percentage of Shared Variance

R10 <- cor(MAGNESIUM, ZINC)

round(R10, 2)

100 * (R10**2)

#Test If Correlation Coefficient Differs From 0

cor.test(PHOSPHORUS, POTASSIUM)

cor.test(PHOSPHORUS, CALCIUM)

cor.test(PHOSPHORUS, MAGNESIUM)

cor.test(PHOSPHORUS, ZINC)

cor.test(POTASSIUM, CALCIUM)

cor.test(POTASSIUM, MAGNESIUM)

cor.test(POTASSIUM, ZINC)

cor.test(CALCIUM, MAGNESIUM)

cor.test(CALCIUM, ZINC)

cor.test(MAGNESIUM, ZINC)

#Spearman Correlation

cor(PHOSPHORUS, POTASSIUM, method = "spearman")

cor(PHOSPHORUS, CALCIUM, method = "spearman")

cor(PHOSPHORUS, MAGNESIUM, method = "spearman")

cor(PHOSPHORUS, ZINC, method = "spearman")

cor(POTASSIUM, CALCIUM, method = "spearman")

cor(POTASSIUM, MAGNESIUM, method = "spearman")

cor(POTASSIUM, ZINC, method = "spearman")

cor(CALCIUM, MAGNESIUM, method = "spearman")

cor(CALCIUM, ZINC, method = "spearman")

cor(MAGNESIUM, ZINC, method = "spearman")