[R] Re: Writting R Function

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Mon Apr 15 11:33:05 CEST 2002


Hi,

I think I found the problem.  It lies in my Fortran program.  Is there a
way, after a DO loop, to make sure it does NOT return anything?

Cheers,

Kevin

On Mon, 15 Apr 2002, Ko-Kang Kevin Wang wrote:

> Date: Mon, 15 Apr 2002 17:27:20 +1200 (NZST)
> From: Ko-Kang Kevin Wang <kwan022 at stat1.stat.auckland.ac.nz>
> To: R Help <r-help at stat.math.ethz.ch>
> Subject: Writting R Function
> 
> Hi,
> 
> Suppose I have a function as below:
>   Fibonacci <- function(n, all = T) {
>       .Fortran("fibonacci",
>                ans = as.double(n),
>                as.character(all))$ans
>   }
> which produces:
>   Fibonacci(10)
>    1
>    1
>    2
>    3
>    5
>    8
>    13
>    21
>    34
>    55
>    [1] 10
> this is fine but I'd like to a) display in a vector format, i.e.:
>   [1] 1  1  2  3  5
>   [6] 8 13 21 34 55
> and b) do not display the last line in the above output ([1] 55).
> 
> Is there anyway to achieve this?
> 
> Cheers,
> 
> Kevin
> 
> ------------------------------------------------------------------------------
> Ko-Kang Kevin Wang
> Postgraduate PGDipSci Student
> Department of Statistics
> University of Auckland
> New Zealand
> 
> Homepage: http://www.stat.auckland.ac.nz/~kwan022
> 
> E-mail: kwan022 at stat.auckland.ac.nz
> 
> 

Cheers,

Kevin

------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand

Homepage: http://www.stat.auckland.ac.nz/~kwan022

E-mail: kwan022 at stat.auckland.ac.nz

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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