Re: [R] How to plot graph with different scale (y axis) on same graph?

2012-04-26 Thread ghostwheel
You ask two questions. First, how to put points with a different y-axis on the plot. One possibility s like this: > plot(1:10) > plot.window(xlim=c(1,10),ylim=c(1,100)) > points( seq(1,10,length=100), 100:1, col=2 ) > axis(4,col.axis=2,col=2) The command plot.window is the one that changes th

Re: [R] Intercept between two lines

2012-04-26 Thread ghostwheel
You could also use polyroot. Do x0=Re( polyroot( c(100,-0.5) - c(150,-1) ) ) In your code. -- View this message in context: http://r.789695.n4.nabble.com/Intercept-between-two-lines-tp4587343p4589349.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] How to delete rows from dataframe that sum to zero

2012-04-26 Thread ghostwheel
Here's an example a=data.frame( sample(0:1,20,rep=T), sample(0:1,20,rep=T) ) # make 2 random columns of length 20. a.no0 = a[ rowSums(a)!=0, ] -- View this message in context: http://r.789695.n4.nabble.com/How-to-delete-rows-from-dataframe-that-sum-to-zero-tp4589289p4589308.html Sent from the R

[R] redefining [ (subset) for array

2012-04-26 Thread ghostwheel
Hi, I'm having a hard time redefining the subset operation for arrays. The aim is to be able to call a[dim2=1:5] instead of having to write a[,1:5,,,] (assuming dimnames(a)[2]=-"dim2"). I already wrote a function that does this (see bottom). But I just can't figure out how to redefine "[.array". I