A user wants to pass in the value inside the lapply function but it fails to retain the value.How to fix that?
lapply(names(RFEresults), function(x)
{
feats <- extractFeatures(RFEresults[[x]]) featurestat[which(featurestat[, 1]==x),rownames(feats)] <- feats$time.choosen print(featurestat[1, ])
})
print(featurestat[1, ])
This issue is caused because we did not apply the result of the loop to an object. We can do that by following
result=lapply(names(RFEresults), function(x)
{
feats <- extractFeatures(RFEresults[[x]]) featurestat[which(featurestat[, 1]==x),rownames(feats)] <- feats$time.choosen featurestat
})
Now we can access the result by using
print(result[[1]])
print(result[[2]])