Re: [R] random section of samples based on group membership

2006-07-24 Thread Sebastian Luque
On Mon, 24 Jul 2006 11:18:10 -0400, Wade Wall [EMAIL PROTECTED] wrote: Hi all, I have a matrix of 474 rows (samples) with 565 columns (variables). each of the 474 samples belong to one of 120 groups, with the groupings as a column in the above matrix. For example, the group column would be:

Re: [R] dotplot (lattice) with panel.segments and groups

2006-07-08 Thread Sebastian Luque
Gabor Grothendieck [EMAIL PROTECTED] wrote: On 7/7/06, Deepayan Sarkar [EMAIL PROTECTED] wrote: On 7/7/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Could you explain what panel.groups= does and what the difference is between panel.groups= and panel= ? In ?xyplot it just says:

[R] dotplot (lattice) with panel.segments and groups

2006-07-07 Thread Sebastian Luque
Hi, The following produces almost exactly what I needed. The problems are that the 'panel.dotplot' call (commented) generates the error 'Error in NextMethod([) : argument subscripts is missing, with no default'. The other problem is that the colors alternate between the levels of the 'site'

[R] randomization test for a two-way ANOVA

2006-07-03 Thread Sebastian Luque
Hi, I've looked into ways of implementing this procedure, i.e. repeating the two-way ANOVA many times, scrambling the order of cases across the treatments, to produce a distribution of F ratios for each effect. This seemed a job for the 'boot' package. However, I'm not sure I'm doing an actual

Re: [R] cumulative time durations of specified periods (chron)

2006-06-13 Thread Sebastian Luque
, June 2004., downloadable from www.r-project.org - Documentation: Newsletter as well as the zoo vignette (see http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67006.html;)? hope this helps. Spencer Graves Sebastian Luque wrote: Hi, Say we have two chron vectors representing

Re: [R] cumulative time durations of specified periods (chron)

2006-06-13 Thread Sebastian Luque
[sorry for my previous empty follow-up -- my fingers got messed up.] Spencer Graves [EMAIL PROTECTED] wrote: Did you try the following: xto-xfrom Time in days: [1] 1.50 1.75 2.00 2.25 I wanted to find the total amount of time between a series of date/time's corresponding to particular

[R] cumulative time durations of specified periods (chron)

2006-06-11 Thread Sebastian Luque
Hi, Say we have two chron vectors representing start and end date/times of an event, respectively: R (xfrom - chron(seq(1.25, 11, 3.25))) [1] (01/02/70 06:00:00) (01/05/70 12:00:00) (01/08/70 18:00:00) [4] (01/12/70 00:00:00) R (xto - chron(as.numeric(xfrom) + seq(1.5, 2.25, 0.25))) [1]

Re: [R] Help with adding minutes to time

2006-05-30 Thread Sebastian Luque
Jean-Louis Abitbol [EMAIL PROTECTED] wrote: Dear R Helpers, I need to read time from a .csv file which is formated as chartime (09:12:00) below. I need to add one minute (cf chartime2). Then I need to output the value just as 09:13 without the seconds for writing a csv file and input in

Re: [R] Basic vector operations was: Function to approximate complex integral

2006-04-19 Thread Sebastian Luque
Doran, Harold [EMAIL PROTECTED] wrote: [...] a - c(2,3) b - c(4,5,6) (2*4) + (2*5) + (2*6) + (3*4) + (3*5) +(3*6) But I do not know of a built in function that would do this. Any suggestions? How about: sum(a %o% b) ?%o% Cheers, -- Seb __

[R] concatenating factor from list

2006-03-15 Thread Sebastian Luque
Hi, I've run into a ridiculous problem I can't find any solutions for in the archives or help pages: data(barley) cutYield - with(barley, by(yield, variety, cut, breaks = c(0, 30, 60, 90))) As in this example, I'm using 'by' to return a factor for each level of another factor. The problem is

Re: [R] concatenating factor from list

2006-03-15 Thread Sebastian Luque
Gabor Grothendieck [EMAIL PROTECTED] wrote: Is this ok or is it what you are trying to avoid: factor(unlist(lapply(cutYield, as.character))) Thank you Gabor. The problem with that is what if some levels do not appear in any member of cutYield? In that case, the factor created above would

Re: [R] concatenating factor from list

2006-03-15 Thread Sebastian Luque
Sebastian Luque [EMAIL PROTECTED] wrote: Gabor Grothendieck [EMAIL PROTECTED] wrote: Is this ok or is it what you are trying to avoid: factor(unlist(lapply(cutYield, as.character))) Thank you Gabor. The problem with that is what if some levels do not appear in any member of cutYield

Re: [R] indexing within panels in xyplot

2006-02-21 Thread Sebastian Luque
Deepayan Sarkar [EMAIL PROTECTED] wrote: [...] Well, there are exceptions to this rule, but generally x and y, when they are passed on to the panel function, are _already_ subsetted, so x[subscripts] makes absolutely no sense. Note how your panel function calls panel.xyplot(x, y, ...)

[R] indexing within panels in xyplot

2006-02-20 Thread Sebastian Luque
Dear R-helpers, I need to show a linear fit through a subset of the data within each combination of levels of two factors. So I prepared an xyplot with different panels for each level of one of the factors, and different symbols within each panel for the levels of the second factor. My problem

[R] analysis of residual sum of squares in R

2006-02-14 Thread Sebastian Luque
, respectively. The 'p' and 'i' subscripts denote the pooled or each individual curve, respectively. If this procedure has already been implemented in a package, I'd be happy to hear about it. A search of the archives and other sources didn't help. Cheers, -- Sebastian Luque

Re: [R] Tranferring R results to word prosessors

2006-02-09 Thread Sebastian Luque
Tom Backer Johnsen [EMAIL PROTECTED] wrote: [...] However, one of the things I have not found in the documentation is some way of preparing output from R for convenient formatting into something like MS Word. In case you're not talking about table-like output exclusively, reading ?Devices

[R] pdf plotting of splom

2005-10-03 Thread Sebastian Luque
Hi, The following code produces a plot on X11: splom(~iris[1:4], groups = Species, data = iris, panel = panel.superpose, key = list(title = Three Varieties of Iris, columns = 3, points = list(pch = super.sym$pch[1:3], col = super.sym$col[1:3]), text

Re: [R] pdf plotting of splom

2005-10-03 Thread Sebastian Luque
Sebastian Luque [EMAIL PROTECTED] wrote: [...] pdf(splom-test.pdf, family = Times, bg = white) [...] Silly me, it occurred to me to check more carefully that bg argument, which does something different in xyplot (namely, give a background to the figure region, not the plot region as it seems

Re: [R] annotating an axis in bwplot (lattice)

2005-09-22 Thread Sebastian Luque
Hi Deepayan, Deepayan Sarkar [EMAIL PROTECTED] wrote: [...] If you really want the frequencies for the whole (subsetted) data, you might as well use something like: dd - data.frame(age, sex, grp) with(subset(dd, age 20), bwplot(grp ~ age | sex, aspect = 0.5, box.ratio = 2,

[R] annotating an axis in bwplot (lattice)

2005-09-20 Thread Sebastian Luque
Hi, I'd like to add, say, the sample size for every group in a bwplot as a parenthetical annotation to the axis. Here's a sketch: --8---cut here---start-8--- require(Hmisc) age - sample(1:100, 1000, replace = TRUE) sex - gl(2, 8, 1000, c(Male, Female)) grp -

Re: [R] data manipulation

2005-09-08 Thread Sebastian Luque
Marc Bernard [EMAIL PROTECTED] wrote: Dear All, I would be grateful if you can help me. My problem is the following: I have a data set like: ID time X1 X2 11 x111 x211 12 x112 x212 21 x121 x221 22 x122

[R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Sebastian Luque
Hello, I've encountered the need to cut some chron objects of the form: R mychron - chron(sort(runif(10, 0, 10))) R mychron [1] (01/01/70 16:36:20) (01/02/70 00:08:46) (01/03/70 16:54:49) [4] (01/04/70 06:45:00) (01/07/70 06:21:24) (01/07/70 18:28:44) [7] (01/08/70 00:47:05) (01/08/70

Re: [R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Sebastian Luque
Gabor Grothendieck [EMAIL PROTECTED] wrote: Assuming, as in your post: set.seed(123) mychron - chron(sort(runif(10, 0, 10))) breaks - quantile(mychron) # is one of these adequate? cut(mychron, breaks) cut(unclass(mychron), unclass(breaks), lab = FALSE) Thank you Gabor, that showed me I

Re: [R] cut.Date functionality for chron date/time objects

2005-08-02 Thread Sebastian Luque
Spencer Graves [EMAIL PROTECTED] wrote: How about the following: set.seed(123) mychron - chron(sort(runif(10, 0, 10))) (breaks - chron(pretty(quantile(mychron [1] 01/01/70 01/03/70 01/05/70 01/07/70 01/09/70 01/11/70 I was looking for a way to cut it into specified units of time, rather

Re: [R] Obtaining argument name within a function

2005-07-18 Thread Sebastian Luque
Francisco J. Zagmutt [EMAIL PROTECTED] wrote: Dear all How can I obtain the name of the argument passed in a function? Here is a simplistic example of what I would like to obtain: myfunction= function(name) { print(paste(The parameter name was,unknownFunction(name)) }

Re: [R] interactive plot showing label

2005-07-12 Thread Sebastian Luque
mark salsburg [EMAIL PROTECTED] wrote: [...] Mainly one that shows all the points, but when a point is clicked on it shows what gene_name it is I think ?identify will help you. -- Sebastian P. Luque __ R-help@stat.math.ethz.ch mailing list

Re: [R] Isolating string containing only file name from complete path

2005-07-11 Thread Sebastian Luque
Ken Termiso [EMAIL PROTECTED] wrote: Hi all, What I'd like to do is to is to be able to extract a string corresponding to only the file name from a string containing the complete path, i.e. from the following path string: /Users/ken/Desktop/test/runs/file1 I would like to end up with:

Re: [R] classes with chron slots

2005-06-23 Thread Sebastian Luque
Thanks a lot Martin and Gabor! On Thu, 23 Jun 2005 08:20:44 -0400, Gabor Grothendieck [EMAIL PROTECTED] wrote: [...] Also if you are referring to the chron package then the names of the chron classes are 'dates' and 'times' -- not 'chron'. However, when the object has both dates and times,

Re: [R] classes with chron slots

2005-06-23 Thread Sebastian Luque
On Thu, 23 Jun 2005 10:13:31 -0400, Gabor Grothendieck [EMAIL PROTECTED] wrote: [...] Just to be clear, the point is that you need to be sure that your chron objects really have class chron since one often speaks of chron objects that are of class dates or times but not chron. That's right,

[R] classes with chron slots

2005-06-22 Thread Sebastian Luque
I'd like to define a class with a chron slot, but: R require(chron) R setClass(myclass, representation(datetime = chron)) [1] myclass Warning message: undefined slot classes in definition of myclass: datetime(class chron) in: .completeClassSlots(ClassDef, where) How should such a class be

Re: [R] intervals and data frames

2005-06-06 Thread Sebastian Luque
Hi, I thought this would be close to what you wanted: x - seq(-1,1,.1) y - sample(x, 3) r1 - vector(mode = numeric, length = length(x)) sapply(y, function(k) { y1 - max(k - 0.1, -1) y2 - min(k + 0.1, 1) r1[x = y1 x = y2] - 1 r1 }) but found that it's not replacing 3 elements of r1

Re: [R] locator() via tcltk

2005-06-05 Thread Sebastian Luque
Dear List members, Thank you so much for your insights. On Sat, 4 Jun 2005 09:39:33 +0100 (BST), Prof Brian Ripley [EMAIL PROTECTED] wrote: [...] I think it is more likely you want to wait for the Tk interaction and then return the results, that is use a `modal' widget. If so, take a look

[R] locator() via tcltk

2005-06-03 Thread Sebastian Luque
Hello, I'm trying to write a function using tcltk to interactively modify a plot and gather locator() data. I've read Peter's articles in Rnews, the help pages in tcltk, http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/, plus a post in R-help sometime ago, but haven't found a solution. The

[R] Re: locator() via tcltk

2005-06-03 Thread Sebastian Luque
That's very interesting, thanks a lot Duncan. I should re-read the R Language manual in more detail. Sebastian On 6/3/05, Duncan Murdoch [EMAIL PROTECTED] wrote: Sebastian Luque wrote: Hello, I'm trying to write a function using tcltk to interactively modify a plot and gather locator

[R] tick marks in opposite axis xyplot

2005-06-01 Thread Sebastian Luque
Hello, I cannot find how to avoid drawing tick marks on the opposite side of axes in xyplot (lattice package). Say you have a simple plot: x - y - rnorm(10) xyplot(y ~ x) There are tick marks on the top and right axes. Is it possible to turn off drawing of those tick marks, or even turn off

[R] cumsum on chron objects

2005-05-17 Thread Sebastian Luque
Hi, Is there some alternative to cumsum for chron objects? I have data frames that contain some chron objects that look like this: DateTime 13/10/03 12:30:35 NA NA NA 15/10/03 16:30:05 NA NA ... and I've been trying to replace the NA's so that a date/time sequence is created starting with the

Re: [R] cumsum on chron objects

2005-05-17 Thread Sebastian Luque
Hello Gabor, Thanks for your reply. na.locf would replace the NA's with the most recent non-NA, so it wouldn't create a sequence of chron dates/times (via as.vector, as in your example). To expand my original example: On 5/17/05, Sebastian Luque [EMAIL PROTECTED] wrote: [...] DateTime 13

[R] subset arg lmList

2005-04-08 Thread Sebastian Luque
I'm having trouble understanding how functions in the subset argument for lmList search for the objects they need. This trivial example produces Error in rownames(fakedf) : Object fakedf not found: library(nlme) fitbyID - function() { fakedf - data.frame(ID = gl(5, 10, 50),

[R] newline in lattice axis label

2005-04-06 Thread Sebastian Luque
Hi, I have a 3 panel xyplot with different variables in the y axis. I'm trying to insert a newline after Width (cm), in the ylab argument as in the example below. My goal is to have the y axis label broken into two lines, split after the string just mentioned. plotfun - function() { fakedf -

Re: [R] newline in lattice axis label

2005-04-06 Thread Sebastian Luque
Sebastian Luque [EMAIL PROTECTED] wrote: I have a 3 panel xyplot with different variables in the y axis. I'm trying to insert a newline after Width (cm), Sorry, that should be VarC (cm), in the hypothetical example below! -- Sebastian P. Luque

[R] programming conventions

2005-03-31 Thread Sebastian Luque
I'm trying to make my R scripts more readable by others, so I searched for some R programming conventions and found the following two: - http://www.ci.tuwien.ac.at/Conferences/useR-2004/Keynotes/Maechler.pdf - http://www.maths.lth.se/help/R/RCC the latter being quite extensive. Are there some

Re: [R] alternative to 'groups' for lattice bwplot()

2005-03-23 Thread Sebastian Luque
Mulholland, Tom [EMAIL PROTECTED] wrote: I'm afraid you have lost me. What is it that you want that reordering the formula does not achieve. bwplot(yield ~ year | site, data = barley) has sites next to each other. Yes, they are next to each other, but in different panels, as expected when

[R] alternative to 'groups' for lattice bwplot()

2005-03-22 Thread Sebastian Luque
Hi, Is there some alternative to the 'groups' argument in lattice's bwplot function for boxplots? Say in the example below: bwplot(yield ~ site | year, data = barley) you want to have two side by side boxplots per site, corresponding to each year in the barley data frame. Ideally, the space

Re: [R] help w/ xyplot and panel.lmline

2005-03-15 Thread Sebastian Luque
for other days here} }) works for you? I've used something similar with 'panel.groups' as the main panel function, but have never done it as above, so beware :-) -- Sebastian Luque __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman

[R] rodbc or unixodbc error

2005-02-21 Thread Sebastian Luque
might do this in a ~/.odbc.ini (i.e. the user's config file) file. Best wishes, -- Sebastian Luque __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting

Re: [R] rodbc or unixodbc error

2005-02-21 Thread Sebastian Luque
template to include the rest of my databases further down. Can the latter go in ~/.odbc.ini as I said before? I hope so, as this would allow for much easier maintenance. Thanks again for the helpful reply. -- Sebastian Luque __ R-help@stat.math.ethz.ch

Re: [R] rodbc or unixodbc error

2005-02-21 Thread Sebastian Luque
Sebastian Luque [EMAIL PROTECTED] wrote: [...] Can the latter go in ~/.odbc.ini as I said before? I hope so, as this would allow for much easier maintenance. Yes, I just found ODBCConfig, a tool that is supplied with unixodbc for this sort of manipulations. Cheers, -- Sebastian Luque

Re: [R] Installing packages on Debian linux

2004-10-24 Thread Sebastian Luque
Gorjanc Gregor wrote: same/similiar packaging system (dependencies, ...) as Debian. Is it wise to mix all three methods? Mixing R CMD and install.packages() doesn't pose any problems, AFAIK, but mixing any of them with apt-get does. The problem is that apt-get doesn't know what you're doing

[R] par() defaults in Rprofile

2004-10-20 Thread Sebastian Luque
Dear List, I've tried to set default par() in .Rprofile by putting the following in the .First function:   setHook(packageEvent(graphics, onLoad),   function(...) {graphics::par(cex.axis=1.5, cex.lab=2, las=1)}   ) My goal was to set par() defaults without opening a device

[R] Coefficients and standard errors in lme

2004-03-23 Thread Sebastian Luque
Hello, I have been searching for ways to obtain these for combinations of fixed factors and levels other than the 'baseline' group (contrasts coded all 0's) from a mixed-effects model in lme. I've modelled the continuous variable y as a function of a continuous covariate x, and fixed factors

[R] nested loop

2004-02-21 Thread Sebastian Luque
Hi all, Does anybody know whether one can nest an 'if' statement in a 'for' loop. According to the results of my code, the for loop is performed first, but I'm not sure I got something else wrong with my code. I'm trying to perform the if statement for each step of the for loop. Thanks in