[R] I modify my question in "textconnection output"

From: Michael S <michael_shen_at_hotmail.com>
Date: Tue 22 Mar 2005 - 14:50:30 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Mar 22 14:53:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:52 EST