[R] Help with Cluster Tutorial Error

David L Carlson dc@r|@on @end|ng |rom t@mu@edu
Fri Feb 15 16:05:44 CET 2019


I'm not getting any error on that line in Windows 10. I did not try running anything past that line.

Have you tried restarting R and clearing your environment?

----------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Bill Poling
Sent: Friday, February 15, 2019 7:37 AM
To: r-help (r-help using r-project.org) <r-help using r-project.org>
Subject: [R] Help with Cluster Tutorial Error

sessionInfo()
#R version 3.5.2 (2018-12-20)
#Platform: x86_64-w64-mingw32/x64 (64-bit)
#Running under: Windows >= 8 x64 (build 9200)

Hello I am working through this tutorial https://www.r-bloggers.com/10-tips-for-choosing-the-optimal-number-of-clusters/
And I run into an error almost immediately at the point below like this:

 mammals <- raw_mammals %>% select(-name) # set rownames
#Error in select(., -name) : object 'p_links' not found

I have googled the error " R object 'p_links' not found"
https://stats.stackexchange.com/questions/113907/error-object-descr-not-found
However, the links I have found seem to be specific to an object that has been declared by the Op, and in my case I do not know where this object is supposed to be coming from?

I think this stems from the use of the dplyr Pkg?

https://dplyr.tidyverse.org/reference/select.html

Here is what I have so far:

#Data Set
# I will be using a lesser known data set from the cluster package: all.mammals.milk.1956, one which I haven't looked at before.
#
# This small dataset contains a list of 25 mammals and the constituents of their milk (water, protein, fat, lactose, ash percentages) from John Hartigan, Clustering Algorithms, Wiley, 1975.
#
# First let's load the required packages. Some of these are already in my library, those that are not were installed

library(tidyverse)
library(magrittr)
library(cluster)
install.packages("cluster.datasets")
install.packages("NbClust")
install.packages("clValid")
install.packages("ggfortify")
install.packages("clustree")
install.packages("ggiraphExtra")
library(cowplot)
library(cluster.datasets)
library(NbClust)
library(clValid)
library(ggfortify)
library(clustree)
library(ggiraphExtra)
library(dendextend)
library(factoextra)
library(FactoMineR)
library(corrplot)
library(GGally)
library(knitr)
library(kableExtra)


data("all.mammals.milk.1956")
raw_mammals <- all.mammals.milk.1956
str(raw_mammals)  #----------------------KNOW THY DATA

# 'data.frame':25 obs. of  6 variables:
# $ name   : chr  "Horse" "Orangutan" "Monkey" "Donkey" ...
# $ water  : num  90.1 88.5 88.4 90.3 90.4 87.7 86.9 82.1 81.9 81.6 ...
# $ protein: num  2.6 1.4 2.2 1.7 0.6 3.5 4.8 5.9 7.4 10.1 ...
# $ fat    : num  1 3.5 2.7 1.4 4.5 3.4 1.7 7.9 7.2 6.3 ...
# $ lactose: num  6.9 6 6.4 6.2 4.4 4.8 5.7 4.7 2.7 4.4 ...
# $ ash    : num  0.35 0.24 0.18 0.4 0.1 0.71 0.9 0.78 0.85 0.75 ...

#raw_mammals <- fread("Animal Milk Constituent Percentages.csv",header=TRUE, stringsAsFactors=TRUE)

# subset dataset
mammals <- raw_mammals %>% select(-name) # set rownames
#Error in select(., -name) : object 'p_links' not found  <--The Error

I hope this is enough information to help answer my question.

Thank you

WHP




Confidentiality Notice This message is sent from Zelis. ...{{dropped:9}}



More information about the R-help mailing list