精华内容
下载资源
问答
  • R语言柱状图

    万次阅读 2016-11-29 10:15:16
    R语言柱状图 转自:http://www.phperz.com/article/16/0102/180120.html 条形图代表在与条成比例的变量的值的长度矩形条数据。R使用函数barplot()来创建柱状图。R能够绘制柱状图垂直和水平条。在柱状图中每...

    R语言做柱状图

    转自:http://www.phperz.com/article/16/0102/180120.html

    条形图代表在与条成比例的变量的值的长度矩形条数据。R使用函数barplot()来创建柱状图。R能够绘制柱状图垂直和水平条。在柱状图中每个条都可以显示不同的颜色。

    语法

    创建一个条形图在R中的基本语法是:

    barplot(H,xlab,ylab,main, names.arg,col)
    

    以下是所使用的参数的说明:

    • H - 是包含在柱状图中使用数值的矢量或矩阵。
    • xlab - 是标签为X轴。
    • ylab - 是标签为Y轴。
    • main - 是柱状图的标题名称
    • names.arg - 是出现在每个条的向量名称。
    • col - 用于给出在图中的条状的颜色。

    示例

    只用输入向量和每个栏的名称创建一个简单的柱状图。

    下面的脚本将创建并保存柱状图到R的当前工作目录。

    # Create the data for the chart.
    H <- c(7,12,28,3,41)
    
    # Give the chart file a name.
    png(file = "barchart.png")
    
    # Plot the bar chart.
    barplot(H)
    
    # Save the file.
    dev.off()
    

    当我们上面的代码执行时,它产生以下结果:

    柱状图标签,标题和颜色

    柱状图的特征可以通过添加更多的参数进行扩展。 The main参数用于添加标题。col参数用于颜色添加到柱状图。args.name 是具有值作为输入矢量的相同数量,用来描述每个条的含义。

    示例

    下面的脚本将创建并保存柱状图到R的当前工作目录。

    # Create the data for the chart.
    H <- c(7,12,28,3,41)
    M <- c("Mar","Apr","May","Jun","Jul")
    
    # Give the chart file a name.
    png(file = "barchart_months_revenue.png")
    
    # Plot the bar chart.
    barplot(H,names.arg=M,xlab="Month",ylab="Revenue",col="blue",
    main="Revenue chart",border="red")
    
    # Save the file.
    dev.off()
    

    当我们上面的代码执行时,它产生以下结果:

    组柱状图和堆叠条形图

    我们可以用一个矩阵的输入值来创建条形图的条和叠层中的每个条组。

    两个以上的变量表示为它用于创建组柱状图和堆积条形图的矩阵。

    # Create the input vectors.
    colors <- c("green","orange","brown")
    months <- c("Mar","Apr","May","Jun","Jul")
    regions <- c("East","West","North")
    
    # Create the matrix of the values.
    Values <- matrix(c(2,9,3,11,9,4,8,7,3,12,5,2,8,10,11),nrow=3,ncol=5,byrow=TRUE)
    
    # Give the chart file a name.
    png(file = "barchart_stacked.png")
    
    # Create the bar chart.
    barplot(Values,main="total revenue",names.arg=months,xlab="month",ylab="revenue",col=colors)
    
    # Add the legend to the chart.
    legend("topleft", regions, cex=1.3, fill=colors)
    
    # Save the file.
    dev.off()
    

    当我们上面的代码执行时,它产生以下结果:

    展开全文
  • 运用R做树状图

    千次阅读 2016-07-18 09:27:04
    利用R作树状图
    R中的原地址为
    

    http://rstudio-pubs-static.s3.amazonaws.com/1876_df0bf890dd54461f98719b461d987c3d.html

    考虑到原地址可能失效,这里做简单的翻译和备份,有关聚类的R包可以参考cluster包和ape包


    以下是正文:


    The most basic dendrogram

    Let's start with the most basic type of dendrogram. For that purpose we'll use themtcars dataset and we'll calculate a hierarchical clustering with the functionhclust (with the default options).

    让我们从最基本聚类树状图开始。为此目的,我们将使用mtcars数据集和我们计算的层次聚类hclust函数(与默认选项

    # prepare hierarchical cluster 生成层次聚类
    hc = hclust(dist(mtcars))
    # very simple dendrogram     默认画法
    plot(hc)


    We can put the labels of the leafs at the same level like this

    我们可以将样本定义在同一水平 (实在不明白help一下plot函数)

    A less basic dendrogram

    In order to add more format to the dendrograms, we need to tweek the right parameters. For instance, we could get the following graphic (just for illustration purposes!)

    一个基本的树状图

    为了增加更多格式的图,我们需要修改正确的参数。例如我们可以得到下面的图形(仅作说明用途

    par(op)

    ##这里强调一下,par()是对图进行自动调整,貌似功能还挺强大的。新浪有位哥们儿总结得特别好,附赠地址:

    http://blog.sina.com.cn/s/blog_8f5b2a2e0102v0tf.html

    貌似可以靠par()函数调整图的坐标轴什么的,我没试过哦~~

    Alternative dendrograms

    An alternative way to produce dendrograms is to specifically convert hclust objects intodendrograms objects

    另类聚类图

    将hclude生成的对象转换为另类的聚类图

    # using dendrogram objects
    hcd = as.dendrogram(hc)
    # alternative way to get a dendrogram
    plot(hcd)

    Having an object of class dendrogram, we can also plot the branches in a triangular form

    画完这个画三角形的

    Zooming-in on dendrograms

    Another very useful option is the ability to inspect selected parts of a given tree. For instance, if we wanted to examine the top partitions of the dendrogram, we could cut it at a height of 75

    放大在树状图

    另一个非常有用的功能是选择树的一部分。例如如果我们要研究的树状图的分区我们可以把它在一个高度75

    # plot dendrogram with some cuts
    op = par(mfrow = c(2, 1))
    plot(cut(hcd, h = 75)$upper, main = "Upper tree of cut at h=75")
    plot(cut(hcd, h = 75)$lower[[2]], main = "Second branch of lower tree with cut at h=75")

    par(op)

    Customized dendrograms

    In order to get more customized graphics we need a little bit of more code. A very useful resource is the functiondendrapply that can be used to apply a function to all nodes of a dendrgoram. This comes very handy if we want to add some color to the labels.

    为了获得更多的定制的图形,我们需要更多的代码。一个非常有用的功能dendrapply可以应用一个函数的一dendrgoram所有节点。如果我们要添加一些色彩的标签这是非常方便的


    # vector of colors labelColors = c('red', 'blue', 'darkgreen', 'darkgrey',
    # 'purple')
    labelColors = c("#CDB380", "#036564", "#EB6841", "#EDC951")
    # cut dendrogram in 4 clusters
    clusMember = cutree(hc, 4)
    # function to get color labels
    colLab <- function(n) {
        if (is.leaf(n)) {
            a <- attributes(n)
            labCol <- labelColors[clusMember[which(names(clusMember) == a$label)]]
            attr(n, "nodePar") <- c(a$nodePar, lab.col = labCol)
        }
        n
    }
    # using dendrapply
    clusDendro = dendrapply(hcd, colLab)
    # make plot
    plot(clusDendro, main = "Cool Dendrogram", type = "triangle")
    

    Phylogenetic trees

    A very nice tool for displaying more appealing trees is provided by the R packageape. In this case, what we need is to convert thehclust objects intophylo pbjects with the funtions as.phylo

    系统进化树

    由R包ape提供更具吸引力的树非常好的工具我们利用as.phylo功能将hclust objects转换成phylo对象

    # load package ape; remember to install it: install.packages('ape')
    library(ape)
    # plot basic tree
    plot(as.phylo(hc), cex = 0.9, label.offset = 1)


    The plot.phylo function has four more different types for plotting a dendrogram. Here they are:

    plot.phylo函数的4种不同类型的聚类树形图

    # cladogram
    plot(as.phylo(hc), type = "cladogram", cex = 0.9, label.offset = 1)

    # unrooted
    plot(as.phylo(hc), type = "unrooted")

    下面是我最喜欢的圆形树形图

    # fan   
    plot(as.phylo(hc), type = "fan")

    # radial
    plot(as.phylo(hc), type = "radial")

    Customizing phylogenetic trees

    What I really like about the ape package is that we have more control on the appearance of the dendrograms, being able to customize them in different ways. For example:

    自定义的系统进化树

    ape 包对树的性状有着很多控制,能够定制他们以不同的方式。例如

    # add colors randomly
    plot(as.phylo(hc), type = "fan", tip.color = hsv(runif(15, 0.65, 
        0.95), 1, 1, 0.7), edge.color = hsv(runif(10, 0.65, 0.75), 1, 1, 0.7), edge.width = runif(20, 
        0.5, 3), use.edge.length = TRUE, col = "gray80")
    


    Again, we can tweek some parameters according to our needs

    我们可以根据需求修改一些参数

    # vector of colors
    mypal = c("#556270", "#4ECDC4", "#1B676B", "#FF6B6B", "#C44D58")
    # cutting dendrogram in 5 clusters
    clus5 = cutree(hc, 5)
    # plot
    op = par(bg = "#E8DDCB")
    # Size reflects miles per gallon
    plot(as.phylo(hc), type = "fan", tip.color = mypal[clus5], label.offset = 1, 
        cex = log(mtcars$mpg, 10), col = "red")
    

    par(op)
    

    Color in leaves

    彩色叶子节点

    The R package sparcl provides the ColorDendrogram function that allows to add some color. For example, we can add color to the leaves

    R包还提供ColorDendrogram功能来让我们给聚类树点颜色看看。比如我们可以给叶子节点来点颜色

    # install.packages('sparcl')
    library(sparcl)
    # colors the leaves of a dendrogram
    y = cutree(hc, 3)
    ColorDendrogram(hc, y = y, labels = names(y), main = "My Simulated Data", 
        branchlength = 80)
    

    ggdendro

    For reasons that are unknown to me, the The R package ggplot2 have no functions to plot dendrograms. However, the ad-hoc packageggdendro offers a decent solution. You would expect to have more customization options, but so far they are rather limited. Anyway, for those of us who are ggploters this is another tool in our toolkit.

    R包ggplot2没有功能绘制树状图的原因我不知道。然而,包ggdendro提供一个像样的解决方案。你希望有更多的自定义选项,但到目前为止他们相当有限。不管怎样对于我们这些谁是ggploters这是我们工具的另一个工具


    # install.packages('ggdendro')
    library(ggdendro)
    # basic option
    ggdendrogram(hc)
    

    # another option
    ggdendrogram(hc, rotate = TRUE, size = 4, theme_dendro = FALSE, color = "tomato")

    # Triangular lines
    ddata <- dendro_data(as.dendrogram(hc), type = "triangle")
    ggplot(segment(ddata)) + geom_segment(aes(x = x, y = y, xend = xend,
        yend = yend)) + ylim(-10, 150) + geom_text(data = label(ddata), aes(x = x,
        y = y, label = label), angle = 90, lineheight = 0)


    Colored dendrogram

    Last but not least, there's one more resource available from Romain Francois'saddicted to Rgraph gallery which I find really interesting. The code in R for generating colored dendrograms, which you can download and modify if wanted so, is availablehere

    最后,你可以到罗曼弗朗索瓦的图形库里面进一步学习~~~

    你甚至可以修改他的代码

    地址是:

    http://gallery.r-enthusiasts.com/RGraphGallery.php?graph=79 (貌似要翻墙)

    http://addictedtor.free.fr/packages/A2R/lastVersion/R/code.R

    # load code of A2R function
    source("http://addictedtor.free.fr/packages/A2R/lastVersion/R/code.R")
    # colored dendrogram
    op = par(bg = "#EFEFEF")
    A2Rplot(hc, k = 3, boxes = FALSE, col.up = "gray50", col.down = c("#FF6B6B", 
        "#4ECDC4", "#556270"))
    

    par(op)

    # another colored dendrogram
    op = par(bg = "gray15")
    cols = hsv(c(0.2, 0.57, 0.95), 1, 1, 0.8)
    A2Rplot(hc, k = 3, boxes = FALSE, col.up = "gray50", col.down = cols)


    par(op)

    展开全文
  • R做圈图

    千次阅读 2017-08-08 20:39:13
    http://www.cnblogs.com/1zhk/p/4762061.html
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    library(GenomicRanges)
     
    set.seed(1)
    N <- 100
     
    gr <- GRanges(seqnames = sample(c("chr1""chr2""chr3"), size = N, replace = TRUE),
    IRanges(start = sample(1:300, size = N, replace = TRUE), width = sample(70:75,size = N, replace = TRUE)),
    strand = sample(c("+""-""*"),size = N,replace = TRUE),
    value = rnorm(N, 10, 3), score = rnorm(N, 100, 30),sample = sample(c("Normal""Tumor"),
    size = N, replace = TRUE), pair = sample(letters,size = N, replace = TRUE))
     
    library(ggbio)
    seqlengths(gr) <- c(400, 500, 700)
    values(gr)$to.gr <- gr[sample(1:length(gr), size = length(gr))]
    idx <- sample(1:length(gr), size = 50)
    gr <- gr[idx]
     
    ggplot()
    layout_circle(gr, geom = "ideo", fill = "gray70", radius = 7, trackWidth = 3)
    +layout_circle(gr, geom = "bar", radius = 10, trackWidth = 4,aes(fill = score, y = score))
    +layout_circle(gr, geom = "point", color = "red", radius = 14,trackWidth = 3, grid = TRUEaes(y = score))
    +layout_circle(gr, geom = "link", linked.to = "to.gr", radius = 6, trackWidth= 1)


    展开全文
  • R做词云分析

    千次阅读 2015-09-18 08:52:12
    对[文章]1的时候遇到Wordle,根据文章...我知道是一个强大的工具,必然能够词云生成,与以”r wordle”和”R 词云”等关键字组合搜索相关资料,最终我将注意力先集中到英文的词云方法,对于中文的词云,要采用特别的

    对[文章]1的时候遇到Wordle,根据文章中提示的网址信息,显示为网址打不开。顺藤摸瓜在网上找资料,仍然找不到关于Wordle的online tools,但知道了一本[书]2,其中的一个章节讲解Wordle,指向同样一个网站。我知道是一个强大的工具,必然能够做词云生成,与以”r wordle”和”R 词云”等关键字组合搜索相关资料,最终我将注意力先集中到英文的词云方法,对于中文的词云,要采用特别的处理 (这就想写LATEX那样,只要你写英文的文章,一切好办,而一牵涉到中文,所做的配置和努力要复杂的多。),最终找到了对我有用的一篇《R做文本挖掘:词云分析》。下面代码主要基于该文,并加上了我自己的感受,因为原文是干巴巴的代码。

    在R中画词云图,需要package wordcloud,但是要画出来最终的结果,你需要预先对文档进行必要的分析处理才行,此时需要package tm。再你加载这两包后,系统会自动加载RcolorBrewer和NLP包。在没深入探索之前,我们肯定能猜测出tm就text mining包,而NLP就是自然语言处理包,由此可见R语言功能的强大。

    R本身没有默认安装包wordcloud和tm,采用下面代码安装及加载它们:

    > install.packages("wordcloud")
    > install.packages("tm")
    > library(wordcloud)
    > library(tm)

    有了上面的铺垫工作后,采用下面代码话词云图:

    1 采用tm包中的crude数据集画词云图

    > data(crude)
    > crude <- tm_map(crude,removePunctuation)
    > crude <- tm_map(crude,function(x)removeWords(x,stopwords()))
    > tdm <- TermDocumentMatrix(crude)
    > m <- as.matrix(tdm)
    > v <- sort(rowSums(m),decreasing=TRUE)
    > d <- data.frame(word=names(v),freq=v)
    > wordcloud(d$word,d$freq,random.order=FALSE,colors=brewer.pal(8,"Dark2"))
    

    上面需要一定的R语言语法知识。在此我通俗地讲解一下。先加载数据集crude,对该数据集去标点,去stopwords等后,将其转变成一个矩阵,行为term,列为documents。接下来就好理解了。

    最终画好的图如下:
    这里写图片描述

    2 采用自定义数据集画词云图

    tm包本身已经很强大,能够处理多个文档,当然是对多个文档的所有词来画云图。当然也能处理一个文档,此时termDocument矩阵就变成了一个列向量。现在的问题是你怎么定义自己的数据集?使用tm包中自带的数据集仅仅起到了demo的作用。

    首先在如下图所示的路径中建立2个txt文件:
    这里写图片描述
    上面C:/Program Files/R/R-3.13/library/tm是R系统tm包的路径。可知,我使用的R版本是3.1.3。接下来,我们就可以画图了。这两个文档的内容分别为:

    1. text1.txt

      Most classical search engines choose and rank advertisements (ads) based on their click-through rates (CTRs). To predict an ad’s CTR, historical click information is frequently concerned. To accurately predict the CTR of the new ads is challenging and critical for real world applications, since we do not have plentiful historical data about these ads. Adopting Bayesian network (BN) as the effective framework for representing and inferring dependencies and uncertainties among variables, in this paper, we establish a BN-based model to predict the CTRs of new ads. First, we built a Bayesian network of the keywords that are used to describe the ads in a certain domain, called keyword BN and abbreviated as KBN. Second, we proposed an algorithm for approximate inferences of the KBN to find similar keywords with those that describe the new ads. Finally based on the similar keywords, we obtain the similar ads and then calculate the CTR of the new ad by using the CTRs of the ads that are similar with the new ad. Experimental results show the efficiency and accuracy of our method.

    2. text2.txt

      Predicting CTRs for new ads is extremely important and very challenging in the field of computational advertising. In this paper, we proposed an approach for predicting the CTRs of new ads by using the other ads with known CTRs and the inherent similarity of their keywords. The similarity of the ad keywords establishes the similarity of the semantics or functionality of the ads. Adopting BN as the framework for representing and inferring the association and uncertainty, we mainly proposed the methods for constructing and inferring the keyword Bayesian network. Theoretical and experimental results verify the feasibility of our methods.
      To make our methods applicable in realistic situations, we will incorporate the data-intensive computing techniques to improve the efficiency of the aggregation query processing when constructing KBN from the large scale test dataset. Meanwhile, we will also improve the performance of KBN inferences and the corresponding CTR prediction. In this paper, we assume that all the new ad’s keywords are included in the KBN, which is the basis for exploring the method for the situation if not all the keywords are not included (i.e., some keywords of the new ads are missing). Moreover, we can also further explore the accurate user targeting and CTR prediction based on the ideas given in this paper. These are exactly our future work.

    画图命令如下:

    txt <- system.file("texts","mytxt",package="tm")
    #导入动态coporus
    myData <- Corpus(DirSource(txt),readerControl=list(language="en"))
    myData <- tm_map(myData,removePunctuation)
    myData <- tm_map(myData,function(x)removeWords(x,stopwords()))
    tdm <- TermDocumentMatrix(myData)
    m <- as.matrix(tdm)
    v <- sort(rowSums(m),decreasing=TRUE)
    d <- data.frame(word=names(v),freq=v)
    wordcloud(d$word,d$freq,random.order=FALSE,color=brewer.pal(8,"Dark2"))
    

    画出的云图的结果为:
    这里写图片描述

    关于system.file的更详细的用法及动态coporus的概念,请参见相关的帮助文档。


    1. Jane Cleland-Huang. Mining Domain Knowledge. IEEE software, 32(3), 2015.
    2. Beautiful Visualization Looking at Data Through the Eyes of Experts. Edited by Julie Steele and Noah Iliinsky. O’Reilly, 2010.
    展开全文
  • R语言线性回归

    万次阅读 多人点赞 2019-07-04 22:00:17
    R平方项(0.991)表明模型可以解释体重99.1%的方差,它也是实际和预测值之间的相关系数(R^2=r^2) 残差的标准误(1.53lbs)则可认为模型用身高预测体重的平均误差 F统计量检验所有的预测变量预测响应变量是否...
  • R和tableau结合出错

    2018-05-31 01:42:32
    我现在要把R和tableau结合,计算字段如下: SCRIPT_REAL("fit (data.frame(.arg1,.arg2,.arg3,.arg4),centers=3); fit$cluster", SUM([Discount]),SUM([Profit]),SUM([Quantity]),SUM([Sales])) _在执行过程中...
  • R语言多元线性回归

    万次阅读 多人点赞 2018-04-21 16:06:36
    R小白几天的摸索红色为输入,蓝色为输出输入数据先把数据用excel保存为csv格式放在”我的文档”文件夹打开R软件,不用新建,直接写回归计算求三个平方和置信区间(95%)散点图(最显著的因变量)拟合图一元线性回归...
  • R语言岭回归

    万次阅读 2017-09-05 13:42:27
    ridge regression可以用来处理下面两类问题:一是数据点少于变量个数;二是变量间存在共线性。 ...当变量间存在共线性的时候,最小二乘回归得到的系数不...在R语言中,MASS包中的函数lm.ridge()可以很方便的完成
  • 基于R做相关分析

    千次阅读 2015-09-04 22:32:13
    R 中,cor.test ()提供了三种检验方法:Pearson相关性检验(R默认);Spearman秩检验;Kendall检验。调用格式为: cor.test ( x, y, alternative=c("two.side" , "less" , " greater"),  method=c("Pearson" , " ...
  • R语言面板VAR例子

    千次阅读 2019-01-24 16:45:59
    (1)对各变量平稳性检验(IPS、PP、ADF、LLC等方法检验) 是逐个变量检验??还是一起检验?? (2)面板数据的最优滞后阶数确定(AIC和SIC方法) (3)在PVAR系统中进行Wald-Granger检验 (4)面板VAR...
  • R做Tukey检验

    千次阅读 2013-04-12 11:50:36
    mydata a #a b=factor(c(rep(1,2),rep(2,2),rep(3,2),rep(4,2))) c fit1 summary(fit1) TukeyHSD(fit1)
  • R的randomForestSRC包生存分析用randomForestSRC生存分析导入randomForestSRC包准备生存分析的数据构建模型,进行生存分析绘图 用randomForestSRC生存分析 导入randomForestSRC包 在R中的实现如如下图所示 ...
  • R语言相关性分析

    千次阅读 2016-03-14 20:15:00
    衡量随机变量相关性的方法主要有三种:pearson相关系数,spearman相关系数,kendall相关系数: ...R语言中求两个随机变量pearson相关系数的函数: 1//赋予a,b向量值 2a<-c(1,2,3) 3b<-c(11,12,14) 4 5...
  • R语言:如何回归分析

    千次阅读 2020-02-20 11:02:15
    在实际的数据处理过程中,我们经常需要一些回归分析,其中有线性回归、逻辑回归、多项式回归等等,我们这里主要是结合R语言进行简单的线性回归分析。 首先,我们需要弄清楚因变量和自变量,一般自变量为x,因变量...
  • R语言滚动garch模型rollgarchmodel

    千次阅读 2020-01-18 21:53:14
    R语言滚动garch模型 roll-garch model 前几天帮人了一个滚动garch模型,刚开始那个人没搞清楚,走了很多弯路,最后终于搞好了,主要就是没有有效的沟通好。 接下来就是分析我写roll-garch的思路。 其实roll-...
  • 利用R做Bootstrap统计分析

    千次阅读 2015-10-24 14:38:28
    介绍一个Bootstrap好用的R 函数,inference。 先看看不用inference时的代码,假定取100个bootstrap样本 boot_means = rep(NA, 100) for(i in 1:100){ boot_sample = sample(gained_clean, n, replace = TRUE) ...
  • R怎样词云

    2018-08-07 21:55:27
    #稀疏矩阵是为了下次贝叶斯判断准备,记住洗漱矩阵不是矩阵,不能直接用它词云 se_dtm (corpus_x11) se_dtm (se_dtm) #了稀疏矩阵后可以用以下算法词云 #转换成矩阵,转换成矩阵后每行的名字每个特征...
  • R做相关系数图

    千次阅读 2017-11-02 16:16:48
    Function Package Description plotcorr ellipse 以椭圆代表相关系数。 plotcov pcaPP 用于两个相关系数矩阵的比较。 corrplot corrplot ...可被ggcorr
  • R语言回归分析

    万次阅读 2017-08-16 12:34:09
    他曾对亲子间的身高研究,发现父母的身高虽然会遗传给子女,但子女的身高却有逐渐“回归到中等(即人的平均值)”的现象。不过当时的回归和现在的回归在意义上已不尽相同。 回归分类: 简单线性回归 复...
  • 使用R语言极大似然估计

    万次阅读 2017-12-20 22:34:36
    统计的同学问到了R语言的Maxlik库,直接调用其接口。实现步骤 1st、 先确定要估计的参数,并对其命名 2nd、将似然函数表示成关于待估计参数的表达式 3rd、给待估计参数赋初值 4th、直接调用max
  • 基于R做聚类分析

    千次阅读 2015-10-24 08:53:04
    K-中心点算法在R中的软件包为Cluster主要函数为pam (). install.packages( "cluster" ) library(cluster) kc=pam(Iris[,- 5 ], 3 ) #去掉标签 print (kc) kc=pam(Iris[,- 1 ], 3 ,cluster.only= TRUE ) #...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 37,273
精华内容 14,909
关键字:

做r