Error in x[...] <- m : NAs are not allowed in subscripted assignments

Hello,
I'm having a problem with prediction when trying randomForest.
The model is working but the rest isn't and i can't figure out why.
Here's what i did at my last try:

Missing Values into NAs

table(Loan_Data$Self_Employed)
Loan_Data$Self_Employed[Loan_Data$Self_Employed==""] = NA
Loan_Data$Self_Employed = droplevels(Loan_Data$Self_Employed)

table(Loan_Data$Married)
Loan_Data$Married[Loan_Data$Married==""] = NA
Loan_Data$Married = droplevels(Loan_Data$Married)

table(Loan_Data$Gender)
Loan_Data$Gender[Loan_Data$Gender==""] = NA
Loan_Data$Gender = droplevels(Loan_Data$Gender)

table(Loan_Data$Dependents)
Loan_Data$Dependents[Loan_Data$Dependents==""] = NA
Loan_Data$Dependents = droplevels(Loan_Data$Dependents)

Selecting relevant columns

Loan_Data = Loan_Data[,-1]

Creating FACTORS According to the Data

Loan_Data$Gender=as.factor(Loan_Data$Gender)
Loan_Data$Married=factor(Loan_Data$Married)
Loan_Data$Dependents=factor(Loan_Data$Dependents)
Loan_Data$Education=factor(Loan_Data$Education)
Loan_Data$Self_Employed=factor(Loan_Data$Self_Employed)
Loan_Data$Credit_History=factor(Loan_Data$Credit_History)
Loan_Data$Property_Area=factor(Loan_Data$Property_Area)

Creating NUMERICS According to the Data

Loan_Data$ApplicantIncome=as.numeric(Loan_Data$ApplicantIncome)
Loan_Data$CoapplicantIncome=as.numeric(Loan_Data$CoapplicantIncome)
Loan_Data$LoanAmount=as.numeric(Loan_Data$LoanAmount)
Loan_Data$Loan_Amount_Term=as.numeric(Loan_Data$Loan_Amount_Term)

Dismissing Missing Values

clean.Loan_Data = na.omit(Loan_Data)

Defining the Dependent Value as "y" for easy use

y=clean.Loan_Data$Loan_Status

floor(0.7*nrow(clean.Loan_Data))

Dividing Loan_Data into training.set and testing.set

train.index = sample(1:480,336,replace = F)
training.set = clean.Loan_Data[train.index,]
testing.set = clean.Loan_Data[-train.index,]

Model #2 - "RandomForest"

library(randomForest)

cLD2=randomForest(y ~ clean.Loan_Data $ Gender + clean.Loan_Data$Married+clean.Loan_Data$Dependents+clean.Loan_Data$Education+clean.Loan_Data$Self_Employed+clean.Loan_Data$ApplicantIncome+clean.Loan_Data$CoapplicantIncome+clean.Loan_Data$LoanAmount+clean.Loan_Data$Loan_Amount_Term+clean.Loan_Data$Credit_History+clean.Loan_Data$Property_Area,data=training.set,mtry=4)
pred2=predict(cLD2,newdata=testing.set,type = "class")
table(predicted=pred2,actual=testing.set$Loan_Status)

When i run the two last codes, that's what shows up:

pred2=predict(cLD2,newdata=testing.set,type = "class")
Error in x[...] <- m : NAs are not allowed in subscripted assignments
In addition: Warning message:
'newdata' had 144 rows but variables found have 480 rows
table(predicted=pred2,actual=testing.set$Loan_Status)
Error in table(predicted = pred2, actual = testing.set$Loan_Status) :
object 'pred2' not found

I get the last error but i don't know how to fix the one before it. I ran glm with the same data and it worked just fine.
I'm new at this so i'm probably missing something and i don't know what. I need to keep the code simple as it is without extras.
Could anyone please help me?

Forgot to mention that i have 12 variables. Only one of them is dependent and i also categorized it as factor.

Hi,

I know it might be tricky because you're all new t it, but could you provide us with a small dataset that generates the error. Here is how you can do that (and paste the result in here)


# If you don't have done it already, You have to install datapasta first with
# install.packages("datapasta")
datapasta::df_paste(clean.Loan_Data[1:10,]) #get the first 10 samples, change to add more or fewer

Also, an easier way to write out your formula for machine learning if your data frame has one variable that is the outcome and all the rest is independent is the following:

cLD2=randomForest(y ~., data=training.set,mtry=4)

And one more trick: to apply the same function to several columns at once:

myFactors = c("Gender", "Married", "Dependents") #complete list...
myNumeric = c("ApplicantIncome", "CoapplicantIncome")

Loan_Data[,myFactors] = sapply(Loan_Data[,myFactors], as.factor)
Loan_Data[,myNumeric] = sapply(Loan_Data[,myNumeric], as.numeric)

Thanks,
PJ

Hello, thank you for repalying!
The original dataset has 614 rows. After omitting NA's, it goes down to 480.
Here's a dataset before omitting NA's:

library(datapasta)
datapasta::df_paste(Loan_Data[1:125,])
data.frame(
ApplicantIncome = c(5849, 4583, 3000, 2583, 6000, 5417, 2333, 3036, 4006,
12841, 3200, 2500, 3073, 1853, 1299, 4950, 3596, 3510,
4887, 2600, 7660, 5955, 2600, 3365, 3717, 9560, 2799,
4226, 1442, 3750, 4166, 3167, 4692, 3500, 12500, 2275,
1828, 3667, 4166, 3748, 3600, 1800, 2400, 3941, 4695,
3410, 5649, 5821, 2645, 4000, 1928, 3086, 4230, 4616, 11500,
2708, 2132, 3366, 8080, 3357, 2500, 3029, 2609, 4945,
4166, 5726, 3200, 10750, 7100, 4300, 3208, 1875, 3500,
4755, 5266, 3750, 3750, 1000, 3167, 3333, 3846, 2395,
1378, 6000, 3988, 2366, 3333, 2500, 8566, 5695, 2958, 6250,
3273, 4133, 3620, 6782, 2484, 1977, 4188, 1759, 4288,
4843, 13650, 4652, 3816, 3052, 11417, 7333, 3800, 2071,
5316, 2929, 3572, 7451, 5050, 14583, 3167, 2214, 5568,
10408, 5667, 4166, 2137, 2957, 4300),
CoapplicantIncome = c(0, 1508, 0, 2358, 0, 4196, 1516, 2504, 1526, 10968,
700, 1840, 8106, 2840, 1086, 0, 0, 0, 0, 3500, 0,
5625, 1911, 1917, 2925, 0, 2253, 1040, 0, 2083, 3369, 0, 0,
1667, 3000, 2067, 1330, 1459, 7210, 1668, 0, 1213, 0,
2336, 0, 0, 0, 0, 3440, 2275, 1644, 0, 0, 0, 0, 1167,
1591, 2200, 2250, 2859, 3796, 0, 3449, 0, 0, 4595, 2254, 0,
0, 0, 3066, 1875, 0, 0, 1774, 0, 4750, 3022, 4000, 2166,
0, 0, 1881, 2250, 0, 2531, 2000, 2118, 0, 4167, 2900,
5654, 1820, 0, 0, 0, 2302, 997, 0, 3541, 3263, 3806, 0,
3583, 754, 1030, 1126, 0, 3600, 754, 0, 2333, 4114, 0, 0,
0, 2283, 1398, 2142, 0, 2667, 0, 8980, 0, 2014),
LoanAmount = c(NA, 128, 66, 120, 141, 267, 95, 158, 168, 349, 70,
109, 200, 114, 17, 125, 100, 76, 133, 115, 104, 315,
116, 112, 151, 191, 122, 110, 35, 120, 201, 74, 106, 114,
320, NA, 100, 144, 184, 110, 80, 47, 75, 134, 96, 88,
44, 144, 120, 144, 100, 120, 112, 134, 286, 97, 96, 135,
180, 144, 120, 99, 165, NA, 116, 258, 126, 312, 125,
136, 172, 97, 81, 95, 187, 113, 176, 110, 180, 130, 111,
NA, 167, 265, 50, 136, 99, 104, 210, 175, 131, 188, 81,
122, 25, NA, 137, 50, 115, 131, 133, 151, NA, NA, 160,
100, 225, 120, 216, 94, 136, 139, 152, NA, 118, 185, 154,
85, 175, 259, 180, 44, 137, 81, 194),
Loan_Amount_Term = c(360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 360, 360, 120, 360, 240, 360, 360, NA, 360, 360,
360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 360, 360, NA, 360, 360, 360, 360, 360, 360, 360, NA,
NA, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 360, 360, 360, 360, 360, 180, 360, 360, 360, 180,
360, 60, 360, 360, 360, 300, NA, 360, 480, 360, 360, 300,
360, 360, 360, 360, 360, 240, 360, 360, 360, 360, 360,
360, 180, 360, 360, 120, 360, 360, 360, 180, 360, 180,
360, 360, 360, 360, 360, 360, 360, 360, 480, 360, 360, NA,
360, 360, 180, 360, 360, 360, 360, 360, 360, 360, 360,
360),
Gender = as.factor(c("Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male", "Male",
"Male", "Female", "Male", "Male", "Male",
"Male", "Male", NA, "Male", "Male", "Male", "Male",
"Male", "Female", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Female", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Female", "Male", "Male", "Female",
"Female", "Female", "Female", "Female", "Male",
"Female", "Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Female",
"Male", "Male", "Male", "Male", "Female", "Male",
"Male", "Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Female", "Male",
"Female", "Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Female", "Male", "Male",
"Male", "Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Female", "Male", "Female", "Male", "Male",
"Female", "Male", "Male", "Female", "Male",
"Female", "Female", "Male", "Male")),
Married = as.factor(c("No", "Yes", "Yes", "Yes", "No", "Yes",
"Yes", "Yes", "Yes", "Yes", "Yes", "Yes",
"Yes", "No", "Yes", "No", "No", "No", "Yes",
"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes",
"Yes", "Yes", "No", "No", "Yes", "No", "No",
"Yes", "No", "Yes", "Yes", "Yes", "No", "No",
"No", "No", "Yes", "Yes", "Yes", "No", "Yes",
"Yes", "Yes", "No", "Yes", "No", "No", "Yes",
"Yes", "Yes", "Yes", "Yes", "Yes", "Yes",
"Yes", "Yes", "Yes", "Yes", "No", "Yes", "No",
"Yes", "Yes", "No", "Yes", "Yes", "No", "Yes",
"Yes", "No", "No", "Yes", "Yes", "Yes", "No",
"Yes", "Yes", "Yes", "Yes", "No", "Yes", "Yes",
"No", "Yes", "Yes", "Yes", "Yes", "No", "No",
"No", "Yes", "Yes", "Yes", "Yes", "Yes", "No",
"Yes", "Yes", NA, "Yes", "Yes", "No", "Yes",
"Yes", "No", "Yes", "Yes", "No", "No", "Yes",
"Yes", "Yes", "Yes", "No", "Yes", "No", "No",
"Yes", "Yes")),
Dependents = as.factor(c("0", "1", "0", "0", "0", "2", "0", "3+",
"2", "1", "2", "2", "2", "0", "2", "0", "1",
"0", "0", "0", "0", "1", "0", "2", "1", "0",
"0", "2", "0", "2", "1", "0", "1", "0", "3+",
"0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "1", "0", "0", "0", "0", "0", "0",
"2", "1", "2", "0", "0", "1", "2", "0", "3+",
"0", "1", "0", "0", "0", "1", "3+", "0", "0",
"2", "0", "3+", "3+", "0", "0", "1", "3+", "3+",
"0", "1", "2", "0", "1", "0", "2", "0", "0",
"0", "0", "2", "2", "0", "0", "0", "0", "0",
"0", "0", "2", "0", NA, "0", NA, "1", "2", "0",
"2", "3+", "0", "0", "0", "1", "0", "1", "0",
"1", "0", "0", NA, "0", "0", "2", "0")),
Education = as.factor(c("Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Not Graduate",
"Graduate", "Not Graduate", "Graduate",
"Not Graduate", "Graduate", "Not Graduate",
"Not Graduate", "Graduate", "Graduate", "Graduate",
"Not Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Not Graduate", "Graduate",
"Graduate", "Not Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Not Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Not Graduate")),
Self_Employed = as.factor(c("No", "No", "Yes", "No", "No", "Yes", "No",
"No", "No", "No", "No", NA, "No", "No",
"No", "No", "No", "No", "No", NA, "No", "No",
"No", "No", NA, "Yes", "No", "No", "No", NA, NA,
"No", "Yes", "No", "No", "No", "No", "No",
"No", "No", "No", "No", "No", "No", "Yes", "No",
"No", "No", "No", "No", "No", "No", "No", "No",
"Yes", "No", "No", "No", "No", "No", "No",
"No", "Yes", "No", "No", "No", "No", "No",
"Yes", "No", "No", "Yes", "No", "No", "Yes", "No",
"No", "Yes", "No", "Yes", "No", "Yes", "No",
"No", "No", "No", "No", "No", "No", "No", "No",
"No", "No", "No", "No", NA, "No", "No", "No",
"No", "No", "No", "No", "No", "No", "No",
"No", NA, "No", "No", "No", NA, "No", "Yes", NA,
"No", "No", "No", "No", "No", "No", "No",
"No", "No", "No")),
Credit_History = as.factor(c("1", "1", "1", "1", "1", "1", "1", "0", "1",
"1", "1", "1", "1", "1", "1", "1", NA, "0",
"1", "1", "0", "1", "0", "0", NA, "1", "1",
"1", "1", "1", NA, "1", "1", "1", "1", "1", "0",
"1", "1", "1", "1", "1", NA, "1", "1", "1",
"1", "1", "0", "1", "1", "1", "1", "1", "0",
"1", "1", "1", "1", "1", "1", "1", "0", "0",
"0", "1", "0", "1", "1", "0", "1", "1", "1", "0",
"1", "1", "1", "1", "0", NA, "1", "1", "1",
NA, "1", "1", NA, "1", "1", "1", "1", "1", "1",
"1", "1", NA, "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "0", "1", "1",
"1", "0", "1", "1", "1", "1", NA, "1", "1", "1",
"1", "0", "1", "1")),
Property_Area = as.factor(c("Urban", "Rural", "Urban", "Urban", "Urban",
"Urban", "Urban", "Semiurban", "Urban",
"Semiurban", "Urban", "Urban", "Urban", "Rural",
"Urban", "Urban", "Urban", "Urban", "Rural",
"Urban", "Urban", "Urban", "Semiurban", "Rural",
"Semiurban", "Semiurban", "Semiurban",
"Urban", "Urban", "Semiurban", "Urban", "Urban",
"Rural", "Semiurban", "Rural", "Urban", "Urban",
"Semiurban", "Urban", "Semiurban", "Urban",
"Urban", "Urban", "Semiurban", "Urban", "Urban",
"Urban", "Urban", "Urban", "Semiurban",
"Semiurban", "Semiurban", "Semiurban", "Urban",
"Urban", "Semiurban", "Semiurban", "Rural",
"Urban", "Urban", "Urban", "Urban", "Rural",
"Rural", "Semiurban", "Semiurban", "Urban", "Urban",
"Urban", "Semiurban", "Urban", "Semiurban",
"Semiurban", "Semiurban", "Semiurban", "Urban",
"Urban", "Urban", "Semiurban", "Semiurban",
"Semiurban", "Semiurban", "Urban", "Semiurban",
"Urban", "Semiurban", "Semiurban",
"Semiurban", "Urban", "Semiurban", "Semiurban",
"Semiurban", "Urban", "Semiurban", "Semiurban",
"Urban", "Semiurban", "Semiurban", "Semiurban",
"Semiurban", "Urban", "Semiurban", "Urban",
"Semiurban", "Urban", "Urban", "Urban", "Rural",
"Urban", "Semiurban", "Urban", "Semiurban",
"Rural", "Semiurban", "Semiurban", "Rural",
"Semiurban", "Urban", "Rural", "Urban", "Rural",
"Semiurban", "Semiurban", "Semiurban", "Rural")),
Loan_Status = as.factor(c("Y", "N", "Y", "Y", "Y", "Y", "Y", "N", "Y",
"N", "Y", "Y", "Y", "N", "Y", "Y", "Y", "N",
"N", "Y", "N", "Y", "N", "N", "N", "Y", "Y",
"Y", "N", "Y", "N", "N", "N", "Y", "N", "Y",
"N", "Y", "Y", "Y", "N", "Y", "Y", "Y", "Y",
"Y", "Y", "Y", "N", "Y", "Y", "Y", "N", "N",
"N", "Y", "Y", "N", "Y", "Y", "Y", "Y", "N", "N",
"N", "N", "N", "Y", "Y", "N", "Y", "Y", "Y",
"N", "Y", "N", "N", "N", "N", "Y", "Y", "Y",
"N", "N", "Y", "Y", "Y", "Y", "Y", "Y", "Y",
"Y", "Y", "Y", "Y", "N", "Y", "Y", "Y", "Y",
"Y", "Y", "Y", "Y", "Y", "Y", "Y", "N", "N", "Y",
"Y", "Y", "N", "Y", "Y", "Y", "Y", "Y", "N",
"Y", "Y", "Y", "Y", "Y", "Y"))
)

# After omitting NA's:

datapasta::df_paste(clean.Loan_Data[1:100,])
data.frame(
ApplicantIncome = c(4583, 3000, 2583, 6000, 5417, 2333, 3036, 4006, 12841,
3200, 3073, 1853, 1299, 4950, 3510, 4887, 7660, 5955,
2600, 9560, 2799, 4226, 1442, 3167, 4692, 3500, 12500,
3667, 4166, 3748, 3600, 1800, 3941, 5649, 5821, 2645,
4000, 1928, 3086, 4230, 4616, 11500, 2708, 2132, 3366,
8080, 3357, 2500, 3029, 2609, 4166, 5726, 3200, 10750, 7100,
4300, 3208, 1875, 3500, 5266, 3750, 3750, 1000, 3167,
3846, 1378, 3988, 2366, 2500, 8566, 5695, 2958, 6250,
3273, 4133, 3620, 2484, 1977, 4188, 1759, 4288, 4843, 3052,
11417, 3800, 2071, 5316, 14583, 3167, 5568, 10408,
4166, 2137, 2957, 4300, 10513, 2014, 2718, 3459, 4895),
CoapplicantIncome = c(1508, 0, 2358, 0, 4196, 1516, 2504, 1526, 10968, 700,
8106, 2840, 1086, 0, 0, 0, 0, 5625, 1911, 0, 2253,
1040, 0, 0, 0, 1667, 3000, 1459, 7210, 1668, 0, 1213, 2336,
0, 0, 3440, 2275, 1644, 0, 0, 0, 0, 1167, 1591, 2200,
2250, 2859, 3796, 0, 3449, 0, 4595, 2254, 0, 0, 0, 3066,
1875, 0, 1774, 0, 4750, 3022, 4000, 0, 1881, 0, 2531,
2118, 0, 4167, 2900, 5654, 1820, 0, 0, 2302, 997, 0, 3541,
3263, 3806, 1030, 1126, 3600, 754, 0, 0, 2283, 2142, 0,
0, 8980, 0, 2014, 3850, 1929, 0, 0, 0),
LoanAmount = c(128, 66, 120, 141, 267, 95, 158, 168, 349, 70, 200,
114, 17, 125, 76, 133, 104, 315, 116, 191, 122, 110,
35, 74, 106, 114, 320, 144, 184, 110, 80, 47, 134, 44,
144, 120, 144, 100, 120, 112, 134, 286, 97, 96, 135, 180,
144, 120, 99, 165, 116, 258, 126, 312, 125, 136, 172,
97, 81, 187, 113, 176, 110, 180, 111, 167, 50, 136, 104,
210, 175, 131, 188, 81, 122, 25, 137, 50, 115, 131, 133,
151, 100, 225, 216, 94, 136, 185, 154, 175, 259, 44,
137, 81, 194, 160, 74, 70, 25, 102),
Loan_Amount_Term = c(360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 120, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
360, 360, 360, 360, 360, 180, 360, 360, 180, 360, 60,
360, 360, 360, 300, 360, 480, 360, 360, 300, 360, 360, 240,
360, 360, 360, 360, 360, 180, 360, 360, 120, 360, 360,
180, 360, 180, 360, 360, 360, 360, 480, 360, 180, 360,
360, 360, 360, 360, 360, 360, 180, 360, 360, 120, 360),
Gender = as.factor(c("Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Female", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male", "Male",
"Female", "Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Female", "Female", "Female",
"Female", "Female", "Male", "Female", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Female", "Male", "Male", "Male",
"Male", "Female", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male", "Female",
"Female", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male", "Male",
"Female", "Male", "Male", "Male", "Male", "Male",
"Male", "Male", "Male", "Male", "Male",
"Male", "Female", "Male", "Female", "Female",
"Female", "Male", "Male", "Male", "Male", "Male",
"Male", "Male")),
Married = as.factor(c("Yes", "Yes", "Yes", "No", "Yes", "Yes",
"Yes", "Yes", "Yes", "Yes", "Yes", "No",
"Yes", "No", "No", "Yes", "Yes", "Yes", "Yes",
"Yes", "Yes", "Yes", "No", "No", "No", "Yes",
"No", "Yes", "No", "No", "No", "No", "Yes",
"Yes", "Yes", "Yes", "No", "Yes", "No", "No",
"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes",
"Yes", "Yes", "Yes", "No", "Yes", "No", "Yes",
"Yes", "No", "Yes", "Yes", "No", "Yes", "No",
"No", "Yes", "Yes", "No", "Yes", "Yes", "No",
"Yes", "No", "Yes", "Yes", "Yes", "Yes", "No",
"No", "Yes", "Yes", "Yes", "Yes", "Yes",
"No", "Yes", "Yes", "Yes", "Yes", "No", "Yes",
"Yes", "Yes", "No", "No", "No", "Yes", "Yes",
"Yes", "No", "No", "Yes", "No")),
Dependents = as.factor(c("1", "0", "0", "0", "2", "0", "3+", "2",
"1", "2", "2", "0", "2", "0", "0", "0", "0",
"1", "0", "0", "0", "2", "0", "0", "1", "0",
"3+", "0", "0", "0", "0", "0", "0", "1", "0",
"0", "0", "0", "0", "0", "2", "1", "2", "0",
"0", "1", "2", "0", "3+", "0", "0", "0", "0",
"1", "3+", "0", "0", "2", "0", "3+", "0", "0",
"1", "3+", "0", "2", "1", "0", "0", "0", "0",
"0", "2", "2", "0", "0", "0", "0", "0", "0",
"2", "0", "1", "2", "2", "3+", "0", "1", "0",
"0", "0", "0", "0", "2", "0", "1", "0", "0",
"0", "0")),
Education = as.factor(c("Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Not Graduate", "Not Graduate",
"Graduate", "Not Graduate", "Graduate",
"Graduate", "Not Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Not Graduate", "Graduate",
"Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Not Graduate",
"Graduate", "Not Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Not Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Not Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Graduate", "Graduate",
"Graduate", "Graduate", "Not Graduate", "Graduate",
"Graduate", "Graduate", "Graduate",
"Graduate")),
Self_Employed = as.factor(c("No", "Yes", "No", "No", "Yes", "No", "No",
"No", "No", "No", "No", "No", "No", "No",
"No", "No", "No", "No", "No", "Yes", "No", "No",
"No", "No", "Yes", "No", "No", "No", "No",
"No", "No", "No", "No", "No", "No", "No", "No",
"No", "No", "No", "No", "Yes", "No", "No",
"No", "No", "No", "No", "No", "Yes", "No", "No",
"No", "No", "Yes", "No", "No", "Yes", "No",
"Yes", "No", "No", "Yes", "No", "No", "No",
"No", "No", "No", "No", "No", "No", "No", "No",
"No", "No", "No", "No", "No", "No", "No", "No",
"No", "No", "No", "No", "No", "No", "No",
"No", "No", "No", "No", "No", "No", "Yes", "No",
"No", "Yes", "No")),
Credit_History = as.factor(c("1", "1", "1", "1", "1", "1", "0", "1", "1",
"1", "1", "1", "1", "1", "0", "1", "0", "1",
"0", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "0",
"1", "1", "1", "1", "1", "0", "1", "1", "1",
"1", "1", "1", "1", "0", "0", "1", "0", "1",
"1", "0", "1", "1", "1", "1", "1", "1", "1", "0",
"1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "0", "1", "1", "1", "1", "1", "1",
"1", "0", "1", "1", "0", "1", "1", "1", "1")),
Property_Area = as.factor(c("Rural", "Urban", "Urban", "Urban", "Urban",
"Urban", "Semiurban", "Urban", "Semiurban",
"Urban", "Urban", "Rural", "Urban", "Urban",
"Urban", "Rural", "Urban", "Urban",
"Semiurban", "Semiurban", "Semiurban", "Urban", "Urban",
"Urban", "Rural", "Semiurban", "Rural",
"Semiurban", "Urban", "Semiurban", "Urban", "Urban",
"Semiurban", "Urban", "Urban", "Urban",
"Semiurban", "Semiurban", "Semiurban", "Semiurban",
"Urban", "Urban", "Semiurban", "Semiurban",
"Rural", "Urban", "Urban", "Urban", "Urban",
"Rural", "Semiurban", "Semiurban", "Urban",
"Urban", "Urban", "Semiurban", "Urban",
"Semiurban", "Semiurban", "Semiurban", "Urban", "Urban",
"Urban", "Semiurban", "Semiurban", "Urban",
"Urban", "Semiurban", "Semiurban", "Urban",
"Semiurban", "Semiurban", "Semiurban", "Urban",
"Semiurban", "Semiurban", "Semiurban",
"Semiurban", "Semiurban", "Semiurban", "Urban",
"Semiurban", "Urban", "Urban", "Urban", "Semiurban",
"Urban", "Rural", "Semiurban", "Rural",
"Urban", "Semiurban", "Semiurban", "Semiurban",
"Rural", "Urban", "Urban", "Semiurban",
"Semiurban", "Semiurban")),
Loan_Status = as.factor(c("N", "Y", "Y", "Y", "Y", "Y", "N", "Y", "N",
"Y", "Y", "N", "Y", "Y", "N", "N", "N", "Y",
"N", "Y", "Y", "Y", "N", "N", "N", "Y", "N",
"Y", "Y", "Y", "N", "Y", "Y", "Y", "Y", "N",
"Y", "Y", "Y", "N", "N", "N", "Y", "Y", "N",
"Y", "Y", "Y", "Y", "N", "N", "N", "N", "Y",
"Y", "N", "Y", "Y", "Y", "Y", "N", "N", "N", "N",
"Y", "N", "Y", "Y", "Y", "Y", "Y", "Y", "Y",
"Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y",
"Y", "Y", "N", "Y", "Y", "Y", "Y", "N", "Y",
"Y", "Y", "Y", "Y", "N", "Y", "Y", "Y", "Y"))
)

Hi,

Thanks for sharing, but was your question solved by my previous post, or are you still experiencing issues?

PJ

I'm sorry.
Unfortunately, it is not solved. The same error appears again.

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