How to export/save an "mrpp" object?
Nikos:
I finally ran mrpp tests. I think all is fine but one very important issue: I have no idea how to export/save an "mrpp" object. Tried anything I know and searched the archives but found nothing.
David W:
And what happened when you tried what seems like the obvious:
save(mrpp_obj, file=)
# rm(list=ls() ) # Only uncomment if you are ready for your workspace
to clear
load("mrpp_store.Rdata")
Right, "clearing" did the trick.
Any ideas? Is really copy-pasting the mrpp results the only way?
Many of us have no idea what such an object is, since you have not described the packages and functions used to create it. If you want an ASCII version then dput or dump are also available.
Multiresponse Permuation Procedures (MRPP) is implemented in the "vegan"
package. The function mrpp() returns (an object of class "mrpp") something
like:
--%<---
# check class
class ( samples_bitemporal_modis.0001.mrpp )
[1] "mrpp"
# check structure
str ( samples_bitemporal_modis.0001.mrpp )
List of 12
$ call : language mrpp(dat = samples_bitemporal_modis.0001[, 1:5],
grouping = samples_bitemporal_modis.0001[["Class"]])
$ delta : num 0.126
$ E.delta : num 0.202
$ CS : logi NA
$ n : Named int [1:5] 335 307 183 188 27
..- attr(*, "names")= chr [1:5] "Urban" "Vegetation" "Bare ground" "Burned"
...
$ classdelta : Named num [1:5] 0.1255 0.1045 0.1837 0.0981 0.1743
..- attr(*, "names")= chr [1:5] "Urban" "Vegetation" "Bare ground" "Burned"
...
$ Pvalue : num 0.001
$ A : num 0.378
$ distance : chr "euclidean"
$ weight.type : num 1
$ boot.deltas : num [1:999] 0.202 0.202 0.202 0.203 0.202 ...
$ permutations: num 999
- attr(*, "class")= chr "mrpp"
-->%---
Now I've tried the following:
--%<---
# 1. save(d) it
save ( samples_bitemporal_modis.0001.mrpp , file="exported.mrpp.R" )
# 2. loade(d) it in a new object...
loadedmrpp <- load ( "exported.mrpp.R")
# 3. (tried) to check it...
str ( "exported.mrpp.R")
chr "samples_bitemporal_modis.0001.mrpp"
# it did not cross my mind immediately to...
get(loadedmrpp)
Call:
mrpp(dat = samples_bitemporal_modis.0001[, 1:5], grouping =
samples_bitemporal_modis.0001[["Class"]])
Dissimilarity index: euclidean
Weights for groups: n
Class means and counts:
Urban Vegetation Bare ground Burned Water
delta 0.1255 0.1045 0.1837 0.0981 0.1743
n 335 307 183 188 27
Chance corrected within-group agreement A: 0.3778
Based on observed delta 0.1258 and expected delta 0.2022
Significance of delta: 0.001
Based on 999 permutations
# ...or to work on a clean workspace!
-->%---
Thank you David. Cheers, Nikos