[R] problem with Erlang function

alen tarhouni_wael at hotmail.fr
Mon Nov 12 14:49:33 CET 2012


I'm beginner with R language

My goal is to write a function that takes an input Erlang entering your

· Name

· Name

· Date of birth.

The program will calculate age and display output

first
I do know the system date (month, day, year)

I find with Sys.Date ()


I found a function. net to calculate the age



Protected Sub calcul_age()
    Dim datetimenow = DateTime.Now
    Dim datedenaissance = CDate(TbDn.Text)
    Dim age As Integer
    age = CInt(Now.Year - datedenaissance.Year)
    If (datedenaissance.Month > Now.Month) Then
    age = age - 1
    End If
    If ((datedenaissance.Month = Now.Month) And (datedenaissance.Day >
Now.Day)) Then
    age = age - 1
    End If
    Me.Label3.Text = " Age : " & age & " ans"
    End Sub




So I need to find the equivalent of this function with R language


so I think that I will start by :

affichage<-function()
{

print( "enter the first name" )
firstname <-  scan(nmax=1)
print( "enter the last name" )
 lastname <-  scan(nmax=1)
print( "enter the date of birth" )
dateofbirth <-  ........  here start the problem

........
............


}



--
View this message in context: http://r.789695.n4.nabble.com/problem-with-Erlang-function-tp4649303.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list