Re: Nested R-expressions in r..eal

Nicos Angelopoulos (Univ of York) <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <20131002101909.5973602b@komos>
Dear Wouter, 

On Tue, 1 Oct 2013 16:32:31 +0200
Wouter Beek <[email protected]> wrote:

> Hi all,
> 
> I have a question regarding the r..eal package for R-integration in
> SWI-Prolog. Is it possible (and if so how) to nest R expressions in R
> expressions.
> 
> In [1] I would like to specify the margin parameter so that the label of
> the Y-axis does not interfere with the value labels of that axis.
> ~~~
> [1]   <- barplot(Bars, par(mar=[5,5,1,1]), ylab=+Y_Axis)
> [2]   <-barplot(Bars, "par(mai=c(1,1,1,1))", ylab=+Y_Axis)
> ~~~
> 
> The problem that I experience is that [2] works, but [1] does not. Any
> ideas on this?
> 
	version [2] seemingly works, but it probably does not do what you expect

	real can use debug library to show what is passed to R
	turn this on via ?- debug(real).
	in [2] above "par..." is passed as a vector of integer values 
	which is intepreted as parameter 'width' by barplot()
        that is the codes of your string are paseed not the intended c(1,1,1,1)

	i think there is something problematic with the underlying R statement 
	in your example

	the following is typed in R  (3.0.1) 

> barplot( c(1,2,3), par(mai=c(1,1,1,1) ) )
Error in width/2 : non-numeric argument to binary operator
In addition: Warning message:
In mean.default(width) : argument is not numeric or logical: returning NA
>

Could you provide a working R statement ?

Hope it helps,

Nicos Angelopoulos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.