[R] Programs stopped working--.print (newbie question)

Marc Schwartz MSchwartz at medanalytics.com
Sat Jul 26 01:10:45 CEST 2003


On Fri, 2003-07-25 at 17:28, Peter Muhlberger wrote:
> On 7/25/03 5:53 PM, "Spencer Graves" <spencer.graves at PDF.COM> wrote:
> 
> > I see a period "." before 'print' in your function definition.  Might
> > this be the problem?
> > 
> > spencer graves
> 
> The code I paste in has no "." in front of 'print' .  But when the code
> displays after I put it in, R puts a "." in front of it.  I don't know why.
> 
> Thx,
> 
> Peter


Peter,

This may be a long shot, but I noted that there are four spaces before
the word 'print' in your initial code. Those four spaces are replaced by
the period after pasting. Four spaces would be a default TAB indentation
setting for many editors.

You don't indicate the particular OS environment you are using (or R
version), but I am presuming a *nix-alike, since I do not see typical
Windows based e-mail headers on your post. 

The period ('.') that appears could be an indication of a TAB character
being pasted into the console, which could cause the problems you are
seeing.

When I paste from an editor (using TAB characters to indent) into the R
console under RH 9, I get:

> test<-function()
+ {
+ print("hello")
+ }

Note that the indentation of 'print("hello")' goes away.

You indicated in your initial post that you can paste into a "fresh
environment" without problem.  What is the fresh environment?  A new R
console? A new machine?

It is possible that something in your existing open terminal/console
application within which R is running, has been altered (ie. change in
character encoding) which in turn is causing the TAB character to be
interpreted/replaced by the period.

As I said, a long shot...but possible.

HTH,

Marc Schwartz




More information about the R-help mailing list