[R] ODD and EVEN numbers

2010-03-31 Thread tj
Hi, anyone here who knows how to determine if an integer is odd or even in R? Thanks. tj -- View this message in context: http://n4.nabble.com/ODD-and-EVEN-numbers-tp1747032p1747032.html Sent from the R help mailing list archive at Nabble.com

Re: [R] ODD and EVEN numbers

2010-03-31 Thread tj
Thank you guys for responding to my question. Have a great day!:-) -- View this message in context: http://n4.nabble.com/ODD-and-EVEN-numbers-tp1747032p1747411.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] Create blocks or observations

2010-03-25 Thread tj
warnings (use warnings() to see them) g[1] [1] 2.4 g[2] [1] 2.2 ## g[1] should show 2.4 2.4 2.4 ## g[2] should show 2.2 2.1 1.5 ##g[16] should show 3.4 3.0 2.9 Can you please tell me how I should correct my program? Thank you. ~tj -- View this message in context: http://n4

[R] If else statements

2010-03-23 Thread tj
Hi everyone! May I request again for your help? I need to make some codes using if else statements... Can I do an if-else statement inside an if-else statement? Is this the correct form of writing it? Thank you.=) Example: for (v in 1:6) { for (i in 2:200) { if (v==1) (if max(x*v-y*v)1

Re: [R] If else statements

2010-03-23 Thread tj
Thanks Matthew... I will read your suggested articles/files. I hope, i will be able to figure out what should be done with this. =) ~tj -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1679073.html Sent from the R help mailing list archive at Nabble.com

Re: [R] If else statements

2010-03-23 Thread tj
Thanks Sam for the short but very helpful answer. That's what I only want to know. Thanks.=) ~tj -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1679187.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML

[R] Create NA

2010-03-22 Thread tj
Hi, How can I create an NA? for example, i have this program but it has errors x=scan() 1: 1 2 3 4 5 6: Read 5 items na*x Error in na * x : non-numeric argument to binary operator what should I multiply x so that I will get an NA? And I really need to multiply that with my x vector. I

[R] Summing with NA

2010-03-22 Thread tj
Hi all, May I request for your help if you have time and if you have an idea on how to do this. I want to add three vectors... And my goal is to obtain the sum of the vectors, ignoring the vector of na... Here is what i did in R.. I'm adding the three vectors, e,z,k, and my objective is to get

[R] R code for normal mixture EM algorithm

2010-03-20 Thread tj
how many times AIC has the minimum value at component=2. I will also do this for BIC. Thank you! ~tj -- View this message in context: http://n4.nabble.com/R-code-for-normal-mixture-EM-algorithm-tp1630181p1630181.html Sent from the R help mailing list archive at Nabble.com

[R] OUTPUT the row

2010-03-20 Thread tj
, the minimum age is 18, so I want to create a code that will give me the answer which is 4. Thanks! ~tj -- View this message in context: http://n4.nabble.com/OUTPUT-the-row-tp1644200p1644200.html Sent from the R help mailing list archive at Nabble.com. __ R

Re: [R] OUTPUT the row

2010-03-20 Thread tj
Thank you very much for the big help! From: GlenB [via R] ml-node+1655832-860423762-194...@n4.nabble.com Sent: Sat, March 20, 2010 1:23:50 AM Subject: Re: OUTPUT the row a-read.table(stdin(),header=TRUE) 0: id kAgeHeight 1: 23 2

[R] How to count the number of occurence?

2010-03-20 Thread tj
Hi, may I ask for your help... What is the R code if I want to count the number of times that 2 appeared in the following R output k [1] 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 3 2 1 1 4 1 1 1 1 1 5 1 1 Thank you for your help. :-) -- View this message in context:

[R] EM algorithm in R

2010-03-20 Thread tj
Please help me in writing the R code for this problem. I've been solving this for 4 days. It was hard for me to solve it. It's a simulation problem in R. The problem is My true model is a normal mixture which is given as 0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components. I will get

Re: [R] How to count the number of occurence?

2010-03-20 Thread tj
Thanks everyone for your help! All your suggestions work. I appreciate it. Have a great day! -- View this message in context: http://n4.nabble.com/How-to-count-the-number-of-occurence-tp1661733p1675997.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] EM algorithm in R

2010-03-20 Thread tj
program. After doing two different programs, I just felt frustrated of getting errors all the time that's why I asked someone's help. Thank you.:working: ~tj -- View this message in context: http://n4.nabble.com/EM-algorithm-in-R-tp1663020p1675979.html Sent from the R help mailing list archive

Re: [R] EM algorithm in R

2010-03-20 Thread tj
here is my program... Im trying to fit 1 component to 6 components in each of the 300 generated samples. Each sample has size=200. For each of the 300 generated samples and for each modeled component (v=1,2,3,4,5,6), I will get estimates of the parameters that will maximize the likelihood, AND