Spectra Object Not Found

I'm very new to R with no coding experience, but I'm using it for undergraduate research to conduct PCA. I keep receiving this error:
Error in .chkArgs(mode = 11L) :
Argument 'spectra' was not found or not a Spectra object
I plotted my spectra object to make sure I hadn't created it wrong, but it returns this error every time. Am I doing something wrong in my coding? Any help would be appreciated.

Can you provide a reproducible example? Code, not screenshots.

Sorry this took a while, finals took over for a bit. I tried but with the spectra data we're using, I wasn't sure what counted as minimal and I hope I did this right.
data.frame(
stringsAsFactors = FALSE,
check.names = FALSE,
floral source = c("AC", "BB", "CL", "M"),
Sample Number NMR Spec Number = c(1, 1, 3, 1),
9.96035 = c(-0.01, 0.01, -0.01, 0.01),
9.8802299999999992 = c(0, 0, -0.02, 0.01),
9.8001100000000001 = c(0.02, 0.01, -0.04, 0),
9.7199899999999992 = c(0.02, 0.03, 0.02, 0.02),
9.6398700000000002 = c(0.02, 0.01, -0.01, 0),
9.5597499999999993 = c(-0.01, 0.02, -0.01, 0.01),
9.4796300000000002 = c(0.01, 0, 0.02, 0.01),
9.3995099999999994 = c(0.01, 0.01, -0.02, 0),
9.3193900000000003 = c(0.02, -0.01, -0.02, 0),
9.2392699999999994 = c(-0.02, 0, -0.04, 0),
9.1591500000000003 = c(0, 0.01, 0, 0.01),
9.0790299999999995 = c(-0.01, 0.01, 0.02, 0),
8.9989100000000004 = c(0, 0, 0, 0),
8.9187899999999996 = c(0.02, 0, 0.02, 0),
8.8386700000000005 = c(0.01, 0, -0.02, 0.01),
8.7585499999999996 = c(0.01, 0, -0.01, -0.01),
8.6784300000000005 = c(0.01, -0.01, -0.03, 0),
8.5983099999999997 = c(0.02, -0.01, -0.02, 0),
8.5182000000000002 = c(0.01, 0, -0.02, 0),
8.4380799999999994 = c(-0.01, -0.01, 0, 0.01),
8.3579600000000003 = c(0, 0, 0.02, 0),
8.2778399999999994 = c(0, -0.01, -0.03, 0),
8.1977200000000003 = c(0.01, 0, -0.02, 0),
8.1175999999999995 = c(-0.02, 0, -0.02, 0),
8.0374800000000004 = c(-0.02, -0.01, -0.01, -0.02),
7.9573600000000004 = c(-0.03, 0, 0.04, 0.04),
7.8772399999999996 = c(0.02, -0.05, 0.01, 0),
7.7971199999999996 = c(-0.02, -0.02, 0.03, 0),
7.7169999999999996 = c(0, 0, 0.05, 0),
7.6368799999999997 = c(0.01, 0.07, 0, 0.05),
7.5567599999999997 = c(0.08, 0.03, 0.06, -0.03),
7.4766399999999997 = c(0.02, 0.08, -0.01, 0.03),
7.3965199999999998 = c(0, 0, 0.02, -0.05),
7.0760399999999999 = c(0, 0.02, 0, 0.23),
6.9959199999999999 = c(0.01, 0, -0.01, 0.04),
6.9157999999999999 = c(0.06, 0.01, 0.08, 0.02),
6.83568 = c(0, 0.07, 0, 0.09),
6.75556 = c(0, 0.01, 0.01, 0.07),
6.67544 = c(-0.01, 0, 0, -0.01),
6.5953200000000001 = c(-0.01, 0, -0.01, -0.01),
6.5152000000000001 = c(0, 0.02, -0.01, 0),
6.4350800000000001 = c(0.01, 0.03, -0.01, 0.02),
6.3549600000000002 = c(0, 0, -0.01, 0),
6.2748400000000002 = c(0.01, 0, 0.02, 0.01),
6.1947200000000002 = c(-0.01, 0, -0.01, 0),
6.1146000000000003 = c(0, -0.01, 0.01, -0.01),
6.0344800000000003 = c(0.01, 0.01, 0.02, 0.01),
5.9543699999999999 = c(0, 0, 0.01, 0.03),
5.87425 = c(-0.01, -0.01, -0.02, 0.06),
5.79413 = c(-0.01, 0, -0.01, 0.04),
5.71401 = c(0.02, 0, 0.01, -0.01),
5.6338900000000001 = c(0.01, 0, -0.01, -0.01),
5.5537700000000001 = c(0, 0, -0.02, -0.01),
5.4736500000000001 = c(-0.01, 0, -0.02, 0.01),
5.3935300000000002 = c(0, -0.01, -0.03, 0),
5.3134100000000002 = c(0.03, 0.23, 0.07, 0.14),
5.2332900000000002 = c(0.02, 0.17, 0.04, 0.15),
5.1531700000000003 = c(0.03, 0, 0.04, -0.01),
5.0730500000000003 = c(-0.02, 0.03, 0, 0.01),
4.9929300000000003 = c(-0.01, -0.01, 0, -0.01),
4.9128100000000003 = c(0, -0.01, -0.02, 0.01),
4.8326900000000004 = c(0.01, 0.02, -0.01, 0.01),
4.7525700000000004 = c(0, -0.03, 0.03, -0.01),
4.6724500000000004 = c(0.02, 0.02, 0, 0.05),
4.5923299999999996 = c(0.01, 0.03, 0.01, 0.08),
4.5122099999999996 = c(0, 0.02, 0.01, 0.02),
4.4320899999999996 = c(0.04, 0.01, -0.01, 0.07),
4.3519699999999997 = c(0.04, 0, -0.04, 0.06),
4.2718499999999997 = c(0.01, 0.06, -0.01, 0.12),
4.1917299999999997 = c(-0.02, 0.05, -0.01, 0.16),
4.1116099999999998 = c(-0.04, 0.11, -0.09, 0.19),
4.0314899999999998 = c(0.12, 0.1, 0.35, 0.15),
3.9513699999999998 = c(-0.02, 0.29, 0.09, 0.27),
3.8712499999999999 = c(-0.05, 0.05, 0.03, 1.17),
3.7911299999999999 = c(-0.02, -0.02, 0.01, 0.41),
3.7110099999999999 = c(0.11, 0.07, 0.01, 0.38),
3.63089 = c(-0.02, 0, -0.02, 0.19),
3.55077 = c(0.04, 0, 0, 0.15),
3.47065 = c(0.04, 0.05, 0.04, 0.13),
3.3905400000000001 = c(0.01, 0.05, 0, 0.11),
3.3104200000000001 = c(0, 0.04, 0, 0.06),
3.2303000000000002 = c(0.02, 0.01, -0.02, 0.02),
3.1501800000000002 = c(0.02, 0, 0.02, 0.05),
3.0700599999999998 = c(0.01, 0, 0.01, 0.06),
2.9899399999999998 = c(0, 0.01, -0.01, 0),
2.9098199999999999 = c(-0.01, 0.01, 0.01, 0.01),
2.8296999999999999 = c(0, 0.01, 0.01, -0.04),
2.7495799999999999 = c(0, 0.09, 0, 0),
2.6694599999999999 = c(-0.01, 0.03, 0, 0.02),
2.58934 = c(-0.01, 0.01, 0.02, 0.02),
2.50922 = c(0, 0.08, 0.01, 0.03),
2.4291 = c(0.03, 0.04, 0.1, 0.03),
2.3489800000000001 = c(0.37, 0.24, 0.63, 0.2),
2.2688600000000001 = c(0.42, 0.72, 0.57, 0.54),
2.1887400000000001 = c(28.77, 0.58, 0.63, 0.42),
2.1086200000000002 = c(2.81, 0.12, 0.18, 0),
2.0285000000000002 = c(0.14, 0.19, 0.09, 0.09),
1.94838 = c(0.35, 0.75, 0.22, 0.52),
1.86826 = c(0.44, 0.33, 0.5, 0.2),
1.7881400000000001 = c(0.67, 0.51, 0.63, 0.37),
1.7080200000000001 = c(1.38, 1.25, 1.17, 1.51),
1.6278999999999999 = c(19.97, 10.4, 16.67, 6.2),
1.5477799999999999 = c(28.73, 11.45, 17.16, 6.41),
1.46766 = c(1.57, 2.36, 1.69, 2.29),
1.38754 = c(0.83, 1.32, 1.66, 0.86),
1.30742 = c(2.42, 2.45, 6.44, 0.65),
1.2273000000000001 = c(8.01, 19.15, 32.11, 12.55),
1.1471800000000001 = c(0.55, 29.23, 4.45, 36.22),
1.0670599999999999 = c(0.33, 3.08, 2.65, 5.74),
0.98694000000000004 = c(0.13, 1.91, 1.05, 3.61),
0.90683000000000002 = c(0.48, 1.12, 2.76, 1.71),
0.82670999999999994 = c(0.99, 6.03, 5.61, 6.34),
0.74658999999999998 = c(0.03, 3.34, 1.68, 5.17),
0.66647000000000001 = c(0, 1.38, 0.81, 2.67),
0.58635000000000004 = c(0.02, 0.24, 0.07, 0.85)
reprex::reprex({library(spectrolab) example <- as_spectra(All_Honey_Data_2, name_idx = 1, meta_idxs = 2) library(chemospec) c_pcaSpectra(example, choice = "autoscale", cent = TRUE)})

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.