Message-ID: <BAY1-F15E295A6D3367075A8B221E74E0@phx.gbl>
Date: 2005-03-22T03:50:30Z
From: Michael S
Subject: I modify my question in "textconnection output"
dear ALL-R-helper:
I modify my question in "textconnection output":
I wrote one function in Rgui:
output <- function(y){
x <- textConnection("foo","w")
sink(x)
a <-5
b <-6
z <-a*b
z
e <-"spss"
h <-c(1,2,3)
ls()
r<-c("s","p","s","s")
p<-list(1:10)
p
y <- foo
sink()
close(x)
return(y)
}
I want to get resulte is :
>y
[1] "[1] 30"
[2] " [1] \"a\" \"b\" \"c\" \"d\" \"e\" \"f\"
\"foo\" \"g\" \"g.p\" \"h\" \"interp\" \"m\"
\"mytest\""
[3] "[14] \"output\" \"p\" \"r\" \"var1\" \"var2\" \"x\"
\"y\" \"z\" "
[4] "[[1]]"
[5] " [1] 1 2 3 4 5 6 7 8 9 10"
[6] ""
when I copy the command line within the function ,and paste to RGui,result
is ok .but when I use the output function ,">y" show value of y object.I got
result "character(0)"
seem to me : I didn't get value of y within function
thanks