[R] How to denote a line on the graph

2010-09-17 Thread aegea
Please give me some help, many thanks. I graphed a expected CDF line of a binomial distribution on a graph, And I have some observed points (observed CDF) from 4 groups fall on the smooth CDF line. I cannot really get the legend I want legend ('topleft', c('a, 'b', 'c', 'd', 'expected CDF'),

[R] how to calculate the product of every two elements in two vectors

2010-07-23 Thread aegea
Thanks in advance! A=c(1, 2,3) B=c (9, 10, 11, 12) I want to get C=c(1*9, 1*10, 1*11, 1*12, ., 3*9, 3*10, 3*11, 3*12)? C is still a vector with 12 elements Is there a way to do that? -- View this message in context:

[R] Can R make an usual dotplot

2010-02-17 Thread aegea
Dear R experts, Can R make an usual dotplot just like Minitab and other softwares? I have the following data, and can use dotchart to graph a dotplot: y=c(2.873438152e-01, -8.732895642e-01, 4.579001889e-01, 1.047395204e+00, 8.491182299e-02 , -1.938007105e+00, -1.273708343e+00,

[R] how to generate data set with different length and calculate the mean?

2010-02-01 Thread aegea
Hello, This may be a rare question. I am struggling to solve it. I really appreciate any help or suggestions. Thanks a lot in advance! I put my questions between the code to make it clear. The problem I have is: I generated 10 data sets with 8 data for each set. Now I want to change the number

Re: [R] Odp: how to generate data set with different length and calculate the mean?

2010-02-01 Thread aegea
Petr, Thanks for your suggestions. It makes sense, since I don't know how to make a matrix with different length of rows. I have a concern for this problem. I actually deal with a much bigger dataset e.g. 1000, and each dataset needs to change the number of data in it according a vector which

[R] how to draw abline correctly?

2010-01-03 Thread aegea
Hello, I am frastruated with this graph, just cannot get what I need. Thank you for any suggestions or help. I really appreciate it. I wrote the following code, but there are 3 problems 1, the red line is added on the graph but without any marker on the y-axis. I want to display the number

Re: [R] how to calculate covariance matrix in R? why cov doesn't work

2009-12-04 Thread aegea
# [3,] 5 1 cov(cbind(a, b)) # a b # a 9.333 -0.667 # b -0.667 2.333 HTH, Jorge On Thu, Dec 3, 2009 at 11:29 PM, aegea wrote: Hello, Sorry. It may be a stupid question. I have two vectors a-c(9,3,5) b-c(3,4,1) How can I get

Re: [R] how to seperate a matrix

2009-12-04 Thread aegea
Thanks a lot, Jorge. It works well! On Fri, Dec 4, 2009 at 12:00 AM, Jorge Ivan Velez [via R] ml-node+948277-873392...@n4.nabble.comml-node%2b948277-873392...@n4.nabble.com wrote: Hi aegea, Here is one: m - structure(c(6, 5, 20, 7, 8, 25, 14, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6

[R] how to seperate a matrix

2009-12-03 Thread aegea
Hello, I am working on seperate the matrix to two matrices but got trouble on doing it. Please give me some suggestions on doing this. Thanks a lot! My original matrix m is as follows for example, [,1] [,2] [,3] [1,]681 [2,]592 [3,]20 103 [4,]

[R] how to calculate covariance matrix in R? why cov doesn't work

2009-12-03 Thread aegea
Hello, Sorry. It may be a stupid question. I have two vectors a-c(9,3,5) b-c(3,4,1) How can I get the variance-covariance matrix of these two vectors? I tried cov(a,b), I got a number not a matrix. I tried to transpose vector a and b as t(a) and t(b), it still cannot work. Any suggestions?

[R] calculation problem when export and import data

2009-12-02 Thread aegea
Hello, I have a question on export and import data. Thank you for any suggestions. data 'simul' is generated as follows: N - 20 n - N/2 nsets - 10 simul - matrix(0,nsets,N) th- c(0,1, 1) for(i in 1:nsets){ simul[i,] - rnorm(N,mean= rep(th[1:2],N/2),sd=th[3])