[R] Return invisible list

S Ellison
2011-07-08T13:46:59Z

> -----Original Message-----
> [mailto:r-help-bounces at r-project.org] On Behalf Of francisco.ahued
> Subject: [R] Return invisible list
>
> x=read.table("data.txt",header=T)
> goa=(x[,3])
> meplot(goa)
>
> I can see the plot, but I would like to see the values of the
> x and y axis.
>

Something returned as invisible is returned but not printed.
You just need to catch it in a suitable variable. That's what you do with
any other function where you want to keep the value:

 x=read.table("data.txt",header=T)
 goa=(x[,3])
mplist <-  meplot(goa) #assigns the output to a variable called mplist

mplist  #calls the default print method for that object.

If you don't need to keep the values for re-use, putting something in
parentheses evaluates the expression and returns the result, effectively
removing the invisibility cloak without explicit assignment.

Example

z<-rnorm(100)
hist( z ) #returns invisible list

but

( hist( z ) ) #additionally displays the output.

S Ellison*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}