[Traminer-users] loop for plotting quality statistics from wcKMedRange
thomas collas
thomas.collas at gmail.com
Wed Oct 19 10:07:02 CEST 2016
Hi Jeremy,
I am sorry to read that you are still stuck and I am sorry to answer so
late but I have just received your message (probably because of its size).
Loops can be tricky.
If you want to print in the first two loops, you should ask R to do so with
the print() function. If you want to handle the results, it can be more
convenient to create a list to which you add a component at each iteration.
In the second loop, you should build a character vector instead of a list
of numbers and you can put the "$stats" part after the bracket, since you
ask R to get an object which is within another object, the problem comes
from the "$" which is an operator, not a part of the object name. Something
like that should work :
indels2 <- c("1.0", "1.5", "2.0")
for (i in indels2){
print(round(get(paste0("pamclust",i))$stats[,c("ASW", "HC", "R2", "PBC",
"HG")],3))
}
Regarding the third loop, there are two different problems. First, you do
not ask R to print several plots, with the layout() function, or the mfrow
argument in the par() function or simply by saving a new pdf or jpg file at
each iteration. Second, you ask R to name each plot by a matrix, what it
does by converting it into a character string. You can create a character
vector to index the indels3 list and to name each plot. But be sure first
that the objects in your list are named, which is not the case here.
Hope that still helps.
best,
thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/traminer-users/attachments/20161019/9a92ba73/attachment.html>
More information about the Traminer-users
mailing list