[R] How to plot a table of numbers as an image using ggplot2?

2010-04-27 Thread arnaud chozo
Hi all, I'd want to plot a table of numbers such that the values are represented by gray level. Is there an easy way to do that using ggplot2? Thanks, Arnaud [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] ggplot2: how to specify x-axis limits to geom_abline() ?

2010-04-23 Thread arnaud chozo
Hi all, I'd want to plot a segment from a line specified by slope and intercept. I want to plot this line between two limits, x1 and x2, without imposing these limits to the hole plot as it is the case with scale_x_continuous(limits=c(x1,x2)) or with xlim and ylim. Any idea? Arnaud Chozo

[R] problem with FUN in Hmisc::summarize

2010-04-16 Thread arnaud chozo
Hi all, I'd like to use the Hmisc::summarize function, but it uses a function (FUN) of a single vector argument to create the statistical summaries. Consider an easy case: I'd like to compute the correlation between two variables in my dataframe, grouped according to other variables in the same

[R] Hmisc::summarize with a dataframe as input?

2010-04-13 Thread arnaud chozo
Hi all, I'm looking for a function with the same functionalities as Hmisc::summarize but accepting a dataframe as input (not just a vector or a matrix). I'd like to compute the correlation between two variables in my dataframe, grouped according to other variables in the same dataframe. For

[R] how to update R files included assource ?

2010-03-29 Thread arnaud chozo
Hi all, I have a main file main.R in which I include some other R files. For example, in main.R I have: source(functions.R). When I modify the file functions.R, I'd like R to take into account the changes and to reload the file functions.R when I run main.R Is it possible? Thanks, Arnaud

[R] regular expression

2010-03-26 Thread arnaud chozo
numeric characters ... I'd like to select the substring XXX which has variable length (from each filename). I saw regular expressions help but still I can't figure out how to do. Thanks, Arnaud Chozo [[alternative HTML version deleted]] __ R

[R] remove substring from each string vector component

2010-03-16 Thread arnaud chozo
to apply this function to each component and I tried the following: myfun = function(x, i) { substring2(x[i], \t) = } lapply(x, myfun) which gives x= I know that I'm wrong somewhere using lapply, but I can't fix it. Thanks in advance, Arnaud Chozo [[alternative HTML version deleted

[R] problem in reading trajectory file

2010-03-15 Thread arnaud chozo
Hi, I'm trying to read some trajectory files (text files) which have the form: # trial n # t X Y 0 1 2 0.2 1 3 0.41.2 4 ... # trial n+1 # t X Y 0 1 2 0.2 1.3 3.3 0.4 1.5 5 ... ... where the symbol # means that the

[R] nested subset for a dataframe

2010-03-10 Thread arnaud chozo
Hi, I've a beginner question. I'm trying to extract data in my dataframe according to some nested rules. I have something like the dataframe test.df: test.df = data.frame(V1=c(rep(A,10), rep(B,10), rep(C,5)), V2=c(rep(1,5), rep(2,5), rep(1,5), rep(2,5), rep(1,5))) V1 V2 1 A 1 2 A 1 3