[R] Defining and running a simple function

Thomas L Jones DrJones at alum.MIT.edu
Thu Feb 2 07:56:52 CET 2006


I am trying, with extremely limited success, to get the R software to 
do some simple computations. Specifically, I defined a test function 
as follows:

fn <- function () {

hw <- "hello world"

hw

s <- seq (0, 0.98, 0.02)

s

}

The output should just be the words "hello world," followed by a 
sequence going from 0 to 0.98.

However, when I call the little test function:

fn ()

the words "hello world" get lost and do not come out. Instead, the 
output begins with

[1] 0.00 0.02, etc

However, when I write a test function for just the words "hello 
world," the words come out just fine.

Here is the setup:

R-2.2.0 using the English language and the console
Windows XP Home Edition Service Pack 2
AVG Antivirus Free Version
Windows built-in firewall
The R buffered output is disabled.
Mozilla Firefox 1.5
Administrator privileges are enabled.

Your advice?

Tom Jones




More information about the R-help mailing list