I have a list of categories and I can get the number of apps for each category in this list. I'd like to find the 10 categories that have the most apps. I wrote this code which does not work right now, I'm getting this error:
Error in if (for (topCategoryNb in top10Nb) { :
argument is of length zero
So I'm assuming this is because a for loop cannot be put as an argument in an if statement. Is there a better way to do what I'm trying to do? If not how can I fix my code?
Here is the code:
top10 <- list()
top10Nb <- list()
for(category in allCategories){
currentNb<- numberAppPerCategories(category,0)
print(category)
print(currentNb)
if(
for(topCategoryNb in top10Nb){topCategoryNb<currentNb}
){
top10 <- c(top10, category)
}
allCategories[- category]
}
Aucun commentaire:
Enregistrer un commentaire