Как преодолеть эту ошибку, чтобы разрешить этот код в R?
Я пытался решить эту проблему с помощью Manova в R. Но когда я запускаю этот код, я получаю ту же ошибку. Я не знаю, что я хочу решить эту проблему.
Error in `[<-`(`*tmp*`, 1, i, value = min(which(frame[, groupvar] == levels(frame[, :
subscript out of bounds
In addition: Warning message:
In min(which(frame[, groupvar] == levels(frame[, groupvar])[i])) :
no non-missing arguments to min; returning Inf
Пожалуйста, дайте несколько советов, чтобы исправить эту ошибку.
весь код здесь
#reading the csv file
df <- read.csv("total1.csv",stringsAsFactors=FALSE)
df <- subset(df, select = -c(X) )
#Unique values in the df$Campaign.ID
unique(df$Campaign.ID)
#condition for seprating unique values
as.data.frame(table(unique(df)$Campaign.ID))
df1=subset(df, Campaign.ID == 931111376)
df2=subset(df, Campaign.ID == 653435194)
df3=subset(df, Campaign.ID == 1602767694)
df4=subset(df, Campaign.ID == 1603425983)
df5=subset(df, Campaign.ID == 1452468365)
df6=subset(df, Campaign.ID == 970129153)
df7=subset(df, Campaign.ID == 970129150)
df8=subset(df, Campaign.ID == 931111373)
df9=subset(df, Campaign.ID == 653266450)
dt1 <- df1[df$Search.keyword %in% names(table(df1$Search.keyword))[table(df1$Search.keyword) >= 2],]
mv <- nonpartest(dt1$total_clicks | dt1$total_cost | dt1$total_cpc | dt1$total_ctr | dt1$total_conversion ~suppressWarnings((as.numeric(Search.keyword))), data = dt1,permtest = TRUE, permreps = 1000)
frq=as.data.frame(table(dt1$Search.keyword))
frq1 = frq[Freq>0,]
mv_res<-as.data.frame(cbind(frq1,mv$releffects))
Это те данные, по которым мы сейчас работаем
Search keyword Campaign ID total_ctr total_cpc total_conversion total_rate total_clicks total_impression total_avg_position total_cost
+2 bhk +for +sale +in +whitefield 970129153 0 0 0 0 0 2 12 0
+2 bhk +for +sale +in +whitefield 970129153 0 0 0 0 0 2 10 0
+2 bhk +for +sale +in +whitefield 970129153 0 0 0 0 0 3 8 0
+2 bhk +for +sale +in +whitefield 970129153 0 0 0 0 0 2 1.5 0
+2 bhk +for +sale +in +whitefield 970129153 0 0 0 0 0 1 4 0
+2 bhk +for +sale +in +whitefield 970129153 33.33 37.22 0 0 1 3 3.33 37.22
+2 bhk +for +sale +in +whitefield 970129153 33.33 53.4 0 0 1 3 3.33 53.4
+2 bhk +for +sale +in +whitefield 970129153 33.33 64.02 0 0 1 3 4.33 64.02
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 2 7 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 1 5 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 3 6.67 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 1 2 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 1 3 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 1 3 0 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 3 11 0
+3 Bhk +apartments +for +sale in +Bangalore 931111376 0 0 0 0 0 2 4.5 0
+3bhk +whitefield 970129153 100 70.96 0 0 1 2 7 70.96
+3bhk +whitefield 970129153 0 0 0 0 0 1 1 0
+3bhk +whitefield 970129153 0 0 0 0 0 2 6 0
+3bhk +whitefield 970129153 200 129.38 0 0 2 2 7 129.38
+3bhk +whitefield 970129153 0 0 0 0 0 3 9.5 0
+3bhk +whitefield 970129153 0 0 0 0 0 4 10.5 0