Need help looping a packaged function (stratification) on segmented data (segmented using (split) but open to other functions to be more efficient)

I didn't use a regular loop because it is a package and the segments are not going to be "numeric" I want to run this package separately on each segment of the data. Example code of me trying and getting "NULL". The real issue is that I am automating this process and this single case is just an example.

frame<-read.delim('F:/SonoT/2019/Sampling_Frame.txt', header=T, sep="\t")
attach(frame)
names(frame)
datapre<-split(frame$Billing.Amount,frame$CustomerName)
**data<-as.double(frame$Billing.Amount)**
n_min=6
n_max=11
Ls_max=2
lapply(datapre,function(x){for (n in n_min:n_max){res<-strata.LH(**data**, n, CV = NULL, Ls, certain = NULL,
          		alloc = list(q1 = 0.5, q2 = 0, q3 = 0.5), takenone = 1, 
         		bias.penalty = 1, takeall = 1, rh = rep(1, Ls), 
          		model = c("none"), 
          		model.control = list(), initbh = NULL, 
          		algo = c("Kozak"), algo.control = list())}})

In Bold is where I believe the most fundamental problems are. I split the data so as.double isn't going to work so simply and I'm trying to iterate and automate so singular processes aren't super handy. I'm in search of the right solution to help me segment the data then perform this packaged function on all segments of the original frame. Thanks!!!

(Note Sampling_Frame is just 3 columns of code, one Identifier, the second used to segment, the third is numeric which will be used to stratify)
Below is an the data from the txt file "Sampling_Frame" for a minimal working example

     JOB	CustomerName	Billing Amount
18-1938	LMT	844874.4
19-1376	PJR	537137.73
19-1352	PJR	488824.38
19-1021	PJR	470939.12
19-1798	PJR	457664.7
19-2088	PJR	297236
19-1677	PJR	289618.08
19-1375	PJR	247639.19
19-1365	PJR	219043.63
18-1823	PJR	209307.34
19-1818	PJR	200998.77
19-1817	PJR	190823.68
19-1276	PJR	181501.92
19-1815	PJR	176378.26
19-1032	LMT	148820.26
19-1084	LMT	138196.34
19-1067	LMT	136659.39
19-1741	LMT	124441.03
19-1083	LMT	123765.9
19-1831	LMT	123562.68
19-2051	LMT	123165.17
19-1514	LMT	118154.4
19-1358	PJR	116789.4
19-1489	PJR	110486.26
19-1535	LMT	107360.87
19-1495	LMT	106515.48
19-1498	LMT	106515.48
19-1497	LMT	106515.48
19-1214	LMT	105693.57
19-1380	LMT	102042.72
19-1724	LMT	99093.09
19-1392	LMT	95834.17
19-1491	RNF	95309.95
19-1626	RNF	92679.44
19-1311	RNF	92531.28
19-1541	RNF	91908
19-1023	RNF	91560.24
19-1132	RNF	90712.05
19-1476	RNF	87297.18
19-1478	RNF	87297.18
19-1341	RNF	86788.79
19-1007	RNF	85865.83
19-1043	RNF	85664.88
19-1044	RNF	85664.88
19-1182	PJR	85664.88
19-1099	PJR	83723.56
19-1085	PJR	83518.56
19-1597	PJR	79901.25
19-1183	PJR	79827.21
19-1299	RNF	79098.81
19-1371	RNF	75446.28
18-1893	RNF	75364.76
18-1938	LMT	535420.2907
19-1376	PJR	665971.1543
19-1352	PJR	113937.3254
19-1021	PJR	901412.9552
19-1798	PJR	180870.6582
19-2088	PJR	459256.6056
19-1677	PJR	786567.9076
19-1375	PJR	107233.7503
19-1365	PJR	529049.9652
18-1823	PJR	93935.11101
19-1818	PJR	781140.9755
19-1817	PJR	626540.2303
19-1276	PJR	994367.0361
19-1815	PJR	248037.5789
19-1032	LMT	591415.5152
19-1084	LMT	955234.6192
19-1067	LMT	985639.924
19-1741	LMT	41756.03667
19-1083	LMT	422216.9353
19-1831	LMT	514984.3071
19-2051	LMT	921309.5568
19-1514	LMT	836335.2603
19-1358	PJR	606062.0096
19-1489	PJR	490173.5946
19-1535	LMT	980659.3195
19-1495	LMT	302602.6893
19-1498	LMT	669464.3852
19-1497	LMT	354799.0461
19-1214	LMT	589567.4014
19-1380	LMT	210924.1892
19-1724	LMT	76164.3439
19-1392	LMT	208655.3566
19-1491	RNF	509698.2722
19-1626	RNF	622272.0624
19-1311	RNF	259806.3957
19-1541	RNF	839041.7736
19-1023	RNF	796422.9877
19-1132	RNF	106002.6997
19-1476	RNF	551992.2614
19-1478	RNF	735833.4733
19-1341	RNF	110942.0706
19-1007	RNF	586964.3845
19-1043	RNF	39630.9694
19-1044	RNF	121490.1144
19-1182	PJR	134848.2189
19-1099	PJR	869101.0679
19-1085	PJR	486720.2974
19-1597	PJR	319308.3749
19-1183	PJR	747375.1898
19-1299	RNF	408166.5797
19-1371	RNF	989657.9436
18-1893	RNF	621918.6124

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