0
在R下,我一直在尝试生成颜色组合,之后我想导入预先使用的组合,请删除所有可能的组合,最后导出可用组合组合。我一直很难删除这些预先使用的。谢谢你的帮助! 一切顺利, - 卡洛斯创建组合列表并删除预先使用的组合
rm(list=ls());ls()
library("gtools")
# Generate all colors combinations
colors<-c("RED","GREEN","BLUE","BLACK","PINK")
size.of.combinations<-4
all.possible.combinations<-permutations(length(colors),size.of.combinations,colors,repeats.allowed=T)
# Import used data
used.comb<- read.table(file = "used.txt", header = TRUE);
used.comb<-as.matrix(used.comb)
# Removed pre-used combinations
comb.available<-all.possible.combinations-used.comb #here is the problem
my.data<-data.frame(comb.available)
write.table(my.data, file = "data.csv", sep = ",", col.names = NA, qmethod = "double")
非常感谢!它完美的工作! –