Re: [R] Apply pmax to dataframe with different args based on dataframe factor

2012-02-10 Thread Idris Raja
ers > > On Thu, Feb 9, 2012 at 3:56 PM, Idris Raja wrote: > > # I have a dataframe in the following form: > > > > track <- c(rep('A', 3), rep('B', 4), rep('C', 4)) > > value <- c(0.15, 0.25, 0.35, 0.05, 0.99, 0.32, 0.13, 0.

[R] Apply pmax to dataframe with different args based on dataframe factor

2012-02-09 Thread Idris Raja
# I have a dataframe in the following form: track <- c(rep('A', 3), rep('B', 4), rep('C', 4)) value <- c(0.15, 0.25, 0.35, 0.05, 0.99, 0.32, 0.13, 0.80, 0.75, 0.60, 0.44) df <- data.frame(track=factor(track), value=value) #> print(df) #track value #1 A 0.15 #2 A 0.25 #3 A 0.3

[R] plot(m, which = 1), where m is a lm linear model. What is 'which' doing?

2011-09-15 Thread Idris Raja
Sample code from *R CookBook* (awesome book btw) *11.12: Finding the Best Power Transformation (Box-Cox) Procedure* require(MASS) x <- 10:100 eps <- rnorm(length(x), sd = 5) y <- (x + eps)^(-1 / 1.5) m <- lm(y ~ x) # * What does the *which* in this line do???

Re: [R] ddply to count frequency of combinations

2011-06-22 Thread Idris Raja
=length(y) d1<-ddply(d, .(x, y), summarize, freq=length(x)) d2<-ddply(d, .(x, y), summarize, freq=length(y)) Also, what is the significance of the periods before the second argument in ".(x, y)" ? Thanks for the help. On Tue, Jun 21, 2011 at 12:54 PM, Brian Diggs wrote: >

[R] ddply to count frequency of combinations

2011-06-21 Thread Idris Raja
I have a dataframe df with two columns x and y. I want to count the number of times a unique x, y combination occurs. For example x<- c(1,2,3,4,5,1,2,3,4) y<- c(1,2,3,4,5,1,2,4,1) df<-as.data.frame(cbind(x, y)) #what is the correct way to use ddply for this example? ddply(df, c('x','y', summari

[R] Tell R where to look locally for library?

2011-06-20 Thread Idris Raja
I have R library's installed in several places on my windows machine. They are in: 1) C:\Program Files\R\R-2.12.2\library 2) C:\Users\MyUser\Documents\R\win-library\2.12 I can access a library from either location with RStudio, but I can't access a library from 2) when using R from the command l

Re: [R] Vim-R-Plugin issue : Python interface must be enabled to run Vim-R-Plugin

2011-06-20 Thread Idris Raja
As a follow up to my own question, the problem was with my version of vim. I needed vim 7.3, was using 7.2. I updated and it works as expected. Just make sure your version of python matches the version of pywin you install if on windows. On Fri, Jun 17, 2011 at 6:51 PM, Idris Raja wrote: >

[R] Vim-R-Plugin issue : Python interface must be enabled to run Vim-R-Plugin

2011-06-17 Thread Idris Raja
I am trying to get the Vim-R-Plugin to work with gvim and R on Windows 7. When I open a .R file in VIM, it complains and says ""Python interface must be enabled to run Vim-R-Plugin." I have installed pywin32 for python 2.7, and added the follo

Re: [R] Heatmap in R and/or ggplot2

2011-06-15 Thread idris
Thanks for the tip on the limit attribute on scale_fill_gradientn. I'll check out mencoder and let you know if I use your code for the movie. Cheers -- View this message in context: http://r.789695.n4.nabble.com/Heatmap-in-R-and-or-ggplot2-tp3594590p3600034.html Sent from the R help mailing li

Re: [R] Heatmap in R and/or ggplot2

2011-06-14 Thread idris
Thanks for your help! Follow up question: My data contains x, y, height, and day. I want to create the heatmap for each day, keeping the color coding consistent. I've created an example with 2 days, and you can see the charts below. Notice that the legend changes from day 1 to day 2. How can I

[R] Heatmap in R and/or ggplot2

2011-06-13 Thread idris
I have a dataframe df with columns x, y, and height. I want to create a heatmap-like plot that creates a grid of x by y, and then color codes the grid depending on the value of height. Is there a ggplot2 object to do this? I'm able to easily do this in Excel with pivot tables and conditional forma

[R] Get RStudio to show line number of error

2011-06-07 Thread idris
Using RStudio 0.93.89 on Windows 7. When I do "Run Lines" on a segment of code in the Workspace and get an error message displayed in the Console, I want to know what line number the error is on. Is this possible in RStudio or can you suggest another workflow where I can actually know what line my