[R] More elegant multiplication or division of a data frame with a vector

2008-03-22 Thread Tribo Laboy
Hello, I am importing some raw voltage multichannel measurements into an R data frame. I need to scale each column with the respective sensitivity for that channel. I figured how to do it, but I am curious if there isn't a more elegant way. Now I start with something like this: rawdata <- data.f

Re: [R] More elegant multiplication or division of a data frame with avector

2008-03-23 Thread Tribo Laboy
7;/' ) > > hope this helps, > > > > > From: [EMAIL PROTECTED] on behalf of Tribo Laboy > Sent: Sat 3/22/2008 8:21 AM > To: r-help@r-project.org > Subject: [R] More elegant multiplication or division of a data frame with > avector > > > > > > Hel

[R] How to assign multiple return values

2008-03-24 Thread Tribo Laboy
Hi, I am moving from MATLAB, where one can easily assign a number of output values from a function like this: [x,y] = myfun(a,b) Then variables x and y can be directly used in the caller workspace. I understand that R functions return a single argument, which could be a list. This in a way make

[R] Combining several mappings in ggplot2

2008-03-25 Thread Tribo Laboy
Hello, I want to be able to make a plot that has several series with different color and linetype. Online documentation suggest that this is possible, but I haven't found how: "We can also create redundant mappings, mapping the same variable to multiple aesthetics. This is most useful when produc

Re: [R] Combining several mappings in ggplot2

2008-03-26 Thread Tribo Laboy
ale_linetype_manual(value = c(1:5)) Error in unit(values, units, data = data) : 'x' and 'units' must have length > 0 What am I doing wrong? Regards, TL On Wed, Mar 26, 2008 at 2:08 AM, hadley wickham <[EMAIL PROTECTED]> wrote: > On Tue, Mar 25, 2008 at 11:4

[R] Moving data between R and Matlab back and forth?

2008-03-26 Thread Tribo Laboy
Hi to the list, I am trying to find a way to painlessly move structured data back and forth between R and Matlab (also Octave). For this purpose I found the R.matlab package great help. I wish to use a Matlab -v6 MAT file as an intermediary format, because it is well read by both Matlab and Octave

Re: [R] Combining several mappings in ggplot2

2008-03-26 Thread Tribo Laboy
n asking him to perform a post-mortem examination: he may be able to > say what the experiment died of. > ~ Sir Ronald Aylmer Fisher > > The plural of anecdote is not data. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not &g

Re: [R] Moving data between R and Matlab back and forth?

2008-03-26 Thread Tribo Laboy
eric,6 #RAM Numeric,6 Now, how do I convert the result held in labpcimport back to a data frame? Thanks in advance, TL On Thu, Mar 27, 2008 at 1:27 AM, Tribo Laboy <[EMAIL PROTECTED]> wrote: > Hi to the list, > > I am trying to find a way to painlessly move structured data back

Re: [R] Combining several mappings in ggplot2

2008-03-26 Thread Tribo Laboy
26, 2008 at 6:01 AM, Tribo Laboy <[EMAIL PROTECTED]> wrote: > > Apologies! I though that the Orange dataset comes with R, but it is in > > fact in the package "datasets". > > > > So here's another "Orange2" dataset for the example: > &

[R] Rule for accessing attributes?

2008-03-26 Thread Tribo Laboy
Hi ! I am a new user and quite confused by R-indexing. Make a list and get the attributes lst <- list(x = 1:3, y = 4:6, z = 7:9) attributes(lst) This returns: $names [1] "x" "y" "z" I can easily do: nm <-names(lst) or nm <-attr(lst,"names") which both return the assigned names of the named

Re: [R] Rule for accessing attributes?

2008-03-26 Thread Tribo Laboy
; > > -----Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Tribo Laboy > > Sent: Thursday, March 27, 2008 12:16 AM > > To: r-help@r-project.org > > Subject: [R] Rule for accessing attributes? > > > >

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Tribo Laboy
ristos Hatzis wrote: > > > You need to use the '@' operator to directly access attributes (not > > elements) of objects: > > > >> [EMAIL PROTECTED] > > [1] "x" "y" "z" > > > > See ?'@' for more detail

Re: [R] Moving data between R and Matlab back and forth?

2008-03-27 Thread Tribo Laboy
bpc[[k]]) == "list") { labpc[[k]]<- as.factor(do.call("rbind", labpc[[k]])) } } labpcdata <- as.data.frame(labpc) ---Code end Regards, TL On Thu, Mar 27, 2008 at 4:08 PM, Prof Brian Ripley <[EMAIL PRO

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Tribo Laboy
quot; "y" "z" I can access the list elements by name directly: lst$x; lst$y; lst$z, But I want to do for (k in 1:3) { lst$nm[k] } But this doesn't work, basically because lst$nm[1] returns a NULL. So what do I do? Thanks for helping, TL On Thu, Mar 27, 2008

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Tribo Laboy
Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > Use [[ ]]. > > It seems it is time for you to study a good introduction to R. > > > > > On Thu, 27 Mar 2008, Tribo Laboy wrote: > > > Now, how is it that I can access the contents of a named list by > >

Re: [R] Moving data between R and Matlab back and forth?

2008-03-27 Thread Tribo Laboy
I have packaged the above posted code as a function and I am posting it here in case someonw would find it useful in the future. --function begin - readMat2df <- function(readfiledata, datastr){ tmpdata <- readfiledata[[datastr]] # use the string contained

Re: [R] Thinking about using two y-scales on your plot?

2008-04-03 Thread Tribo Laboy
Hi It always nice to follow these discussions. There's always so much to learn. I can't disagree with most of the article that Hadley pointed us to, but still I can see value in double y-axis plots. I even remember using one a few years ago. What was said about the temperature in Celsius and in F

Re: [R] Combining several mappings in ggplot2

2008-04-04 Thread Tribo Laboy
a. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of > data. > ~ John Tukey > > -Oorspronkelijk bericht- > Van: Tribo Laboy [mailto:[EMAIL P

Re: [R] ps or pdf

2008-04-04 Thread Tribo Laboy
> The graphics devices are very similar (they share a lot of code). One > small difference is that PostScript has an arc primitive, and PDF does > not. > Sorry for interjecting, but I have a burning question. It is a bit off topic, so I apologize in advance. What is the stance of the R Develo

[R] Loosing attributes while binding data frames ...

2008-04-04 Thread Tribo Laboy
Hello I want to keep track of my units in the data frame. I have been advised in the past on this list to create a new "units" attribute of the data frame and keep the units strings there. It works fine as long as I don't manipulate the data frame. Here's an example: -CODE BEGIN

[R] How to access the attributes of a ggplot?

2008-04-04 Thread Tribo Laboy
Hi, I am having some hard time figuring how to access (and modify) the properties of an object created by ggplot. I found 'ggopts', but it only returns some of the properties. Say I want to get the x- and y-axis limits, the tickmark locations, legend current position, the legend box and backgrou

[R] How to pack my stuff into a package (library, collection)?

2008-04-06 Thread Tribo Laboy
Hello, I am new useR, I have written some functions, which I currently use by "source"-ing them from the files. That's OK, but when I my functions start counting in the tens and hundreds I'd be glad to be able to type "help.search("my_obscure_fun")" and get a sensible reply. I also want to be able

Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-07 Thread Tribo Laboy
is what I get: > library(mypkg) Error in library(mypkg) : 'mypkg' is not a valid package -- installed < 2.0.0? What am I missing? Regards, TL On Mon, Apr 7, 2008 at 3:49 PM, Simon Blomberg <[EMAIL PROTECTED]> wrote: > > On Mon, 2008-04-07 at 15:13 +0900, Tribo Lab

Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-07 Thread Tribo Laboy
On Mon, Apr 7, 2008 at 8:02 PM, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > Tribo Laboy wrote: > > > Hi Simon, > > > > I did the example given in package.skeleton > > > > f <- function(x,y) x+y > > g <- function(x,y) x-y > > d <- dat

Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-07 Thread Tribo Laboy
On Mon, Apr 7, 2008 at 11:09 PM, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 4/7/2008 9:33 AM, Tribo Laboy wrote: > ... > > > > Hi Duncan, > > > > > > Thanks for your reply. I checked the Rtools and the other relevant > > tools. I will

Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-08 Thread Tribo Laboy
Hi Duncan and list I hope it is clear from my previous mails, but to make it sure again, I am talking about R on Windows. So here's what I did. I installed the Rtools on my home machine last night, then copied the files and moved them to my work machine today. I set up the PATH environment variabl

Re: [R] How to access the attributes of a ggplot?

2008-04-08 Thread Tribo Laboy
Hi Hadley, Thanks for replying. I know that I can directly modify some of the properties of the plot object, but I was more interested in querying the current plot properties, something like: xlimits <- getggopts(pobj, "x_scale_limits") Is there anything like this implemented? I tried to drill

Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-08 Thread Tribo Laboy
ing and then combine them in a single .Rd file when you're finished? Yours still confused, TL On Mon, Apr 7, 2008 at 3:13 PM, Tribo Laboy <[EMAIL PROTECTED]> wrote: > Hello, > > I am new useR, I have written some functions, which I currently use by > "source"-ing t

Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-08 Thread Tribo Laboy
okey-dokey, one more problem resolved. Keeping one documentation .Rd file for each R source file. Thanks! TL __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/post

[R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread Tribo Laboy
Hello, I am sure this must have been asked before, but my nabble search did not turn anything useful. Just pointer where to look will also be nice. So, I have the following data: x_test1 <- c(1:10) y_test1<-rnorm(10) x_test2 <- c(1:15) y_test2<-rnorm(15) x_test3 <- c(1:20) y_test3<-rno

[R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread Tribo Laboy
Hello, I am sure this must have been asked before, but my nabble search did not turn anything useful. Just pointer where to look will also be nice. So, I have the following data: x_test1 <- c(1:10) y_test1<-rnorm(10) x_test2 <- c(1:15) y_test2<-rnorm(15) x_test3 <- c(1:20) y_test3<-rnorm(20) Th

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread Tribo Laboy
until you have carefully > considered what they do not say. ~William W. Watt > A statistical analysis, properly conducted, is a delicate dissection of > uncertainties, a surgery of suppositions. ~M.J.Moroney > > -Oorspronkelijk bericht- > Van: [EMAIL PROTECTED

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread Tribo Laboy
Hi Hadley, Thanks for ggplot. Great piece of work. Very intuitive. The legend always seems to be the most difficult part to implement in any plotting package. gnuplot and RLplot come to mind. Good luck! On Fri, Feb 1, 2008 at 10:17 PM, hadley wickham <[EMAIL PROTECTED]> wrote: > > just the pat

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-01 Thread Tribo Laboy
For some reason I get the following error: "Error: could not find function "scale_colour_manual" so I couldn't make the plots. Otherwise I completely agree that color is good way to summarize in the key several different models and operations performed on the same data (it is always a trick to f

Re: [R] Reformatting data into data frame and plotting it in ggplot2

2008-02-03 Thread Tribo Laboy
ey do not say. ~William W. Watt > A statistical analysis, properly conducted, is a delicate dissection of > uncertainties, a surgery of suppositions. ~M.J.Moroney > > -Oorspronkelijk bericht- > Van: Tribo Laboy [mailto:[EMAIL PROTECTED] > Verzonden: vrijdag 1

[R] How to split a factor (unique identifier) into several others?

2008-02-06 Thread Tribo Laboy
Hello, I have a data frame with a factor column, which uniquely identifies the observations in the data frame and it looks like this: sample1_condition1_place1 sample2_condition1_place1 sample3_condition1_place1 . . . sample3_condition3_place3 I want to turn it into three separate factor columns

Re: [R] How to split a factor (unique identifier) into several others?

2008-02-07 Thread Tribo Laboy
("rbind", vals)) > > > I hope it helps. > > Best, > Dimitris > > > Dimitris Rizopoulos > Ph.D. Student > Biostatistical Centre > School of Public Health > Catholic University of Leuven > > Address: Kapucijnenvoer 35, Leuven, B

[R] Measurement units inside a data frame

2008-02-07 Thread Tribo Laboy
Hello, I was wondering if there was an easy way to put information about the measurement units used for each column of a data frame ... Thanks for any pointers, TL __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

[R] Bode plots in ggplot2

2008-02-07 Thread Tribo Laboy
Hello, I am trying to figure out how to make a bode plot (a.k.a. bode diagram) in ggplot2. An example of such a diagram can be found here: http://meweb.ecn.purdue.edu/~me475/ctm/freq/bode2.GIF The example above shows the gain and phase characteristic of a linear system. In my case, I would like

Re: [R] Measurement units inside a data frame

2008-02-07 Thread Tribo Laboy
719.8 > > #2. add a "units" attribute to each column > > > attr(BOD$Time, "units") <- "days" > > attr(BOD$demand, "units") <- "mg/l" > > attr(BOD$Time, "units") > [1] "days&

Re: [R] Measurement units inside a data frame

2008-02-07 Thread Tribo Laboy
On Thu, Feb 7, 2008 at 7:57 PM, Gavin Simpson <[EMAIL PROTECTED]> wrote: > > On Thu, 2008-02-07 at 19:32 +0900, Tribo Laboy wrote: > > Hello, > > > > I was wondering if there was an easy way to put information about the > > measurement units

Re: [R] How to split a factor (unique identifier) into severalothers?

2008-02-08 Thread Tribo Laboy
(Greg) L. Snow Ph.D. > Statistical Data Center > Intermountain Healthcare > [EMAIL PROTECTED] > (801) 408-8111 > > > > > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Tribo Lab

Re: [R] Bode plots in ggplot2

2008-02-08 Thread Tribo Laboy
Hi Hadley and Thiery Thanks for the responses. I worked through the code provided by Thiery and at the end I realized that the scales for the phase and the gain are the same, which in practice is not the case. Then I read Hadley's comment and worked with it a bit too. It is already quite late he

[R] Plotting series marked with a symbol on every nth data point, preferably in ggplot...

2008-02-24 Thread Tribo Laboy
Hello! I am working with signals and a plot of several signals on the same axes can get quite messy. With lines that are very fractured, distinction by only the linestyle is not very clear. If I add symbols to the plot however, there are so many symbols, that they overplot and the whole plot is un

Re: [R] Plotting series marked with a symbol on every nth data point, preferably in ggplot...

2008-02-24 Thread Tribo Laboy
"Test 1", "Test 2", "Test 3"), inset=0.05, bg='white') #--END CODE SNIPPET--- On Mon, Feb 25, 2008 at 2:05 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try this: > > pch <- c(&

Re: [R] Plotting series marked with a symbol on every nth data point, preferably in ggplot...

2008-02-25 Thread Tribo Laboy
On 2/26/08, hadley wickham <[EMAIL PROTECTED]> wrote: > > Maybe someone can help with the ggplot version of this thing? > > Your best bet is just to wait a couple of weeks until the next version > of gglot2 comes out :) > > Hadley > > > -- > http://had.co.nz/ > I'm certainly looking forward to it!