[R] ?? hmm ??
Emmanuel Paradis
paradis at isem.univ-montp2.fr
Tue Sep 11 17:12:31 CEST 2001
At 16:17 10/09/01 +0100, you wrote:
>Hello again!
>thanks to all who helped with overlay plots - v. easy in the end.
>
>Anyway, another new(ba)bee type question - the gurus will cringe I'm sure!
>
>Q. simple R function
>mm <- function (u) {
> x <- u$GDP
> x
> m <- mean(x)
> m
>}
>
>When the function is called the vector "x" does not get printed from within
>the function, but the mean value "m" does, why?
>I think it's probably to do with scoping but don't really know.
>The vector "x" can of course be printed with the print function so there no
>problem seeing it for program debugging etc.
>
>Thanks in advance.
>
>Gerard Keogh
If you want to have the results just printed, you can modify your function
by adding print(x):
mm <- function (u) {
x <- u$GDP
print(x)
m <- mean(x)
m
}
Emmanuel Paradis
Laboratoire de Paléontologie
Institut des Sciences de l'Évolution
Université Montpellier II
F-34095 Montpellier cédex 05
France
phone: +33 4 67 14 39 64
fax: +33 4 67 14 36 10
mailto:paradis at isem.univ-montp2.fr
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list