I have a whole bunch of libraries/packages that I have been using. Some of them may not be required anymore, but I have included them all here. But like I have said, this code worked at the beginning of this week with all of the libraries/packages being loaded.
library(mdatools)
library(dplyr)
library(dslabs)
library(fields)
library(baseline)
library(pacman)
library(reticulate)
library(readr)
library(data.table)
library(rio)
sampledata <- structure(list(x1 = c(18.54816582, -9.891353189, -23.31242892, -5.287650562, -46.16125934, -30.03333883, 28.90548588),
x2 = c(57.8288443, 38.45170556, -17.39087878, 57.21453769, -13.56757757, 14.64351475, 52.99724872),
x3 = c(33.48125264, -14.85429708, 81.054707, 54.38507743, 23.55128244, 72.30890315, -14.24428181),
x4 = c(40.78582339, 32.22607164, 25.12497665, 56.53952981, 44.53448759, 20.66578226, -12.80369032),
x5 = c(1.512071101, -21.47975789, 45.49699468, -4.385417277, -15.73853734, 83.99240902, 28.73790278),
x40000 = c(-17.62384625, -3.795576346, 29.76438967, 72.23170572, -68.45795549, 60.37422804, -56.76775319),
x40001 = c(-24.41231102, 9.026253106, -12.88077044, -57.67095095, -30.3538712, -59.13110021, -7.551038783),
x40002 = c(-24.03026086, 3.353540934, 37.25669276, 17.05503916, -9.310649566, 52.68837871, -53.71208923),
x40003 = c(-1.236255251, 51.41055079, -64.835266, 40.11996692, -15.38699386, -27.75675706, 10.85281402),
x40004 = c(-22.57620744, -23.9335527, -54.81442323, -40.68955362, -16.03903931, -29.77486848, 11.20157967),
x40005 = c(11.37958342, -28.67856606, -0.122297418, 7.471062821, -9.766445734, 44.58486322, 73.74395206),
Place = structure(c(1L, 2L, 3L, 2L, 2L, 3L, 4L), .Label = c("Place1", "Place2", "Place3", "Place4"), class = "factor"),
Date = c(200305L, 191121L, 191210L, 200130L, 200229L, 191006L, 191216L),
Time = c(1245L, 1324L, 1711L, 2037L, 1046L, 2231L, 1926L),
Note = structure(c(1L, 7L, 5L, 4L, 6L, 3L, 2L), .Label = c("fdhs", "hfds", "jnbf", "jnje", "kjhs", "njks", "uekd"), class = "factor")),
class = "data.frame",
row.names = c("Sample1", "Sample2", "Sample3", "Sample4", "Sample5", "Sample6", "Sample7"))
level <- levels(sampledata$Place)
for(i in level)
{assign(paste0("Class", i), dplyr::filter(sampledata, Place == i))
temp_SIMCA <- simca(dplyr::filter(sampledata, Place == i)[ , !(names(dplyr::filter(.data, Place == i)) %in% drops)])}