Windstorm1981 Windstorm1981 - 8 months ago 53
R Question

Saving Agnes Object in R

Apologies if this is really basic - is there a way to save an Agnes object from the Cluster library in R to a file for use in another session? I've looked at the CRAN pdf and for a similar question here on Stackoverflow but don't see anything.

Thanks in advance.


As mentioned in the comments:


data(animals) <- agnes(animals, method = "gaverage")

saveRDS(,"") # Save it

rm( # Remove it so I can prove this works <- readRDS("") # Read it back in
Call:  agnes(x = animals, method = "gaverage")  Agglomerative coefficient:  0.8285911  Order of objects:  

[1] ant lob fly her liz sal bee cpl spi cat chi man cow lio rab duc eag ele wha fro Height (summary): Min. 1st Qu. Median Mean 3rd Qu. Max. 0.0000 0.0000 1.2050 0.9573 1.5890 2.6230

Available components: [1] "order"     "height"    "ac"        "merge"  "diss"      "call"      "method"    "order.lab" "data"