Re: [R] barplot with lines instead of bars

2009-09-08 Thread rafamoral
How can I draw thin bars in a barplot? Rafael hadley wrote: > > What's the difference between a line and a thin bar? > Hadley > > On Tue, Sep 8, 2009 at 12:17 PM, rafamoral > wrote: >> >> I'm sorry, but I think I was misunderstood. What I need is som

Re: [R] barplot with lines instead of bars

2009-09-08 Thread rafamoral
I'm sorry, but I think I was misunderstood. What I need is something like this: http://img525.imageshack.us/img525/2818/imagemyu.jpg Lines instead of bars Thanks! Rafael. ONKELINX, Thierry wrote: > > Here is a solutions using ggplot2 and reshape > > library(reshape) > library(ggplot2) > d

Re: [R] R solve equation

2009-02-08 Thread rafamoral
If you are looking for a solution to a polynomial equation with imaginary solutions you could use polyroot(). Example: To solve the equation: 1 + x + x^3 + 2*x^4 = 0 you create a vector with the coefficients of x and use polyroot: z <- matrix(c(1,1,0,1,2), ncol=1) polyroot(z) Also try ?polyroot

[R] Logical function to turn missing values to 0's

2009-01-14 Thread rafamoral
I have a dataset which contains some missing values, and I need to replace them with zeros. I tried using the following: x <- matrix(data=rep(c(1,2,3,NA),6), ncol=6, nrow=6) y <- matrix(data=0, ncol=ncol(x), nrow=nrow(x)) for(i in 1:nrow(x)) { for(j in 1:ncol(x)) { y[i,j] <- ifelse(x[i,j]==NA

[R] Help with storage of each matrix generated in a loop

2009-01-12 Thread rafamoral
I need to store each matrix generated in a loop. I've been working with the CUSUM algorithm and I've been trying to implement it in R. What I need to do with my dataset is to create 1000 randomized datasets and cumulative sum them all and store all of those randomized CUSUMed datasets for further