Re: [R] Help me please to code....

2012-10-22 Thread Rlotus
thank you so much for helping! Now i got how to do it ;) -- View this message in context: http://r.789695.n4.nabble.com/Help-me-please-to-code-tp4646932p4647050.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mai

Re: [R] Help me please to code....

2012-10-21 Thread arun
HI, Try this: fun1<-function(X){  Y<-ifelse(X==0,5/2,7)  return(Y)}  fun1(5) #[1] 7  fun1(0) #[1] 2.5  fun1(2) #[1] 7 A.K. - Original Message - From: Rlotus To: r-help@r-project.org Cc: Sent: Sunday, October 21, 2012 3:03 PM Subject: [R] Help me please to code User has t

Re: [R] Help me please to code....

2012-10-21 Thread Rui Barradas
Hello, First of all, you should _really_ try to read An Introduction to R, file R-intro.pdf that comes with every installation of R. The answer to your question is in chapter 9 Grouping, loops and conditional execution. It's the very first example: "9.2.1 Conditional execution: if statements

[R] Help me please to code....

2012-10-21 Thread Rlotus
User has to type (input) x. After inputcode has to check X with statement if There is a statement IF. If X=0 then Y=5/2 else =7; How to code it please. I tried but my code does not work ;( I wanna see how it looks like( thank u in advance( -- View this message in context: http://r.7896