Skip to content

save objects from function (PR#9365)

2 messages · dragan.sestovic at ubs.com, Peter Dalgaard

#
Full_Name: Dragan Sestovic
Version: 2.3.0
OS: Windows XP
Submission from: (NULL) (139.149.1.194)


I can not save R objects from function using "save". The simple example is
below:
I do not understand why function funSave.1 fails. Also, why does function
funSave.2 work?
+ {
+   save(a, file="a.1.dat")
+ }
+ {
+   b <- a
+   save(a, file="a.2.dat")
+ }
[1]  1  2  3  4  5  6  7  8  9 10
[1]  1  2  3  4  5  6  7  8  9 10
Error: recursive default argument reference
[1]  1  2  3  4  5  6  7  8  9 10
#
dragan.sestovic at ubs.com writes:
.........
I cannot reproduce this in a current(!) R:
+ {
+   save(a, file="a.1.dat")
+ }
+ {
+   b <- a
+   save(a, file="a.2.dat")
+ }
[1]  1  2  3  4  5  6  7  8  9 10
[1]  1  2  3  4  5  6  7  8  9 10
[1]  1  2  3  4  5  6  7  8  9 10
Error in funSave.2(b) : object "b" not found
Error in readChar(con, 5) : cannot open the connection
In addition: Warning message:
cannot open compressed file 'a.2.dat'
[1]  1  2  3  4  5  6  7  8  9 10
[1]  1  2  3  4  5  6  7  8  9 10