Hi again! I just wanted to say that during typing my message before I mistyped certain of characters and I was just afraid that it might spoil the understanding of my message. So I corrected the characters and now I'm sending you this corrected letter again. Terribly sorry for my mistake.
Thank you again, Laszlo. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Hello there, I don't know if I'm addressing my question to the right e-mail address, I hope I do. Actually I have a little problem concerning writing a code in R. I try to briefly sum up my problem. As you can see below, I created the functions "Equation1" and "Equation2" with some conditions. Equation1 <-function(x){ if (x<=0.25) y <-1-4*x if (x>0.25) y <-0 y } Equation2 <-function(x){ if (x<=0.25) y <-4*x if (x>0.25 & x<=0.5) y <-2-4*x if (x>0.5) y <-0 y } And then I generated a sequence of numbers from 0 to 1 using the following code: x <-seq(0,1,0.05) What I intended to do was to create 3 columns like below. In the first column you can find all the x values I created just before using the seq procedure and in the next 2 columns you can see all the calculated values of functions Equation1 and Equation2 respectively. x Equation1 Equation2 0.00 1.00 0.00 0.05 0.80 0.20 0.10 0.60 0.40 0.15 0.40 0.60 0.20 0.20 0.80 0.25 0.00 1.00 0.30 0.00 0.80 0.35 0.00 0.60 0.40 0.00 0.40 0.45 0.00 0.20 0.50 0.00 0.00 0.55 0.00 0.00 0.60 0.00 0.00 0.65 0.00 0.00 0.70 0.00 0.00 0.75 0.00 0.00 0.80 0.00 0.00 0.85 0.00 0.00 0.90 0.00 0.00 0.95 0.00 0.00 1.00 0.00 0.00 Unfortunately I didn't know how to create these columns. Whenever I tried to send the following codes into R: "Equation1(x)" or "Equation2(x)" (remember x representing the values from 0 to 1) ...I instantaneously got a warning message saying: [1] 1.0 0.8 0.6 0.4 0.2 0.0 -0.2 -0.4 -0.6 -0.8 -1.0 -1.2 -1.4 -1.6 -1.8 -2.0 -2.2 -2.4 -2.6 -2.8 -3.0 Warning messages: 1: In if (x <= 0.25) y <- 1 - 4 * x : the condition has length > 1 and only the first element will be used 2: In if (x > 0.25) y <- 0 : the condition has length > 1 and only the first element will be used Could somebody please help me with this? I would greatly appreciate if somebody would reply. Thank you very much and have a pleasant day! Best regards, Laszlo ____________________________________________________________________________________________________ Ez az e-mail és az összes hozzá tartozó csatolt melléklet titkos és/vagy jogilag, szakmailag vagy más módon védett információt tartalmazhat. Amennyiben nem Ãn a levél cÃmzettje akkor a levél tartalmának közlése, reprodukálása, másolása, vagy egyéb más úton történÅ terjesztése, felhasználása szigorúan tilos. Amennyiben tévedésbÅl kapta meg ezt az üzenetet kérjük azonnal értesÃtse az üzenet küldÅjét. Az Erste Bank Hungary Zrt. (EBH) nem vállal felelÅsséget az információ teljes és pontos - cÃmzett(ek)hez történÅ - eljuttatásáért, valamint semmilyen késésért, kapcsolat megszakadásból eredÅ hibáért, vagy az információ felhasználásából vagy annak megbÃzhatatlanságából eredÅ kárért. Az üzenetek EBH-n kÃvüli küldÅje vagy cÃmzettje tudomásul veszi és hozzájárul, hogy az üzenetekhez más banki alkalmazott is hozzáférhet az EBH folytonos munkamenetének biztosÃtása érdekében. This e-mail and any attached files are confidential and/...{{dropped:19}}
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.