# NOT RUN {
## save Italian ultra- frequency spectru to external text file
fname <- tempfile(fileext=".spc")
write.spc(ItaUltra.spc, fname)
## now <fname> is a TAB-delimited text file with columns m and Vm
## we ready it back in
New.spc <- read.spc(fname)
## same spectrum as ItaUltra.spc, compare:
summary(New.spc)
summary(ItaUltra.spc)
stopifnot(isTRUE(all.equal(New.spc, ItaUltra.spc))) # should be identical
# }
# NOT RUN {
## DON'T do the following, incomplete spectrum will not be restored properly !!!
zm <- lnre("zm", ItaUltra.spc) # estimate model
zm.spc <- lnre.spc(zm,N(zm)) # incomplete spectrum from model
write.spc(zm.spc, fname) # WARNINGS
bad.spc <- read.spc(fname) # but this function cannot know something is wrong
summary(zm.spc)
summary(bad.spc) # note that N and V are completely wrong !!!
# }
Run the code above in your browser using DataLab