2

R の多くの関数は、ある種のコンソール出力 (NbClust() など) を提供します。出力を見ずに、出力の一部 (たとえば、特定の整数値) を取得する方法はありますか? コンソールから読み取る方法はありますか?

出力は、パッケージ マニュアルで提供されているサンプル コードからの次の出力のようになると想像してください。

[1] "Frey index : No clustering structure in this data set"
*** : The Hubert index is a graphical method of determining the number of clusters.
                In the plot of Hubert index, we seek a significant knee that corresponds to a 
                significant increase of the value of the measure i.e the significant peak in Hubert
                index second differences plot. 

*** : The D index is a graphical method of determining the number of clusters. 
                In the plot of D index, we seek a significant knee (the significant peak in Dindex
                second differences plot) that corresponds to a significant increase of the value of
                the measure. 

******************************************************************* 
* Among all indices:                                                
* 1 proposed 2 as the best number of clusters 
* 2 proposed 4 as the best number of clusters 
* 2 proposed 6 as the best number of clusters 
* 1 proposed 7 as the best number of clusters 

                   ***** Conclusion *****                            

* According to the majority rule, the best number of clusters is  4 


*******************************************************************

上記の出力の最後の行から値4を取得するにはどうすればよいですか?

4

2 に答える 2