Here are two ways:
f <- function(x) print(2*x)
g <- function(x) cat("the value of twice x is", 2*x, "\n")
---
Date: Tue, 17 Feb 2004 20:41:39 -0800
From: Jonathan Greenberg <[EMAIL PROTECTED]>
To: R-help <[EMAIL PROTECTED]>
Subject: [R] Printing values within a function
This is probably a really stupid question, but how do I print the value of a
variable within a function? Of course in normal command-line mode I just
type the name of the variable, but how do I have this value exported within
a function?
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html