Re: [R] Bar Plot ggplot2 Filling bars with cross hatching

2009-01-19 Thread Greg Snow
I think the fact that the grid package does not support cross-hatching is a feature not a bug (or deficiency), and I hope that this is not "fixed". Tufte's book (The Visual Display of Quantitative Information) has a section on why cross-hatching should be avoided (unless of course your goal is

Re: [R] Bar Plot ggplot2 Filling bars with cross hatching

2009-01-20 Thread Greg Snow
t: Monday, January 19, 2009 5:37 PM > To: Greg Snow > Cc: hadley wickham; R-help > Subject: Re: [R] Bar Plot ggplot2 Filling bars with cross hatching > > what is your suggestion for distinguishing between many bars without > color? I have grown up in the time of standarized te

Re: [R] plotting points with two colors

2009-01-20 Thread Greg Snow
I don't know how efficient you would consider this, but here is one solution: library(TeachingDemos) ms.2circ <- function(r=1, adj=0, col1='blue', col2='red', npts=180) { tmp1 <- seq( 0, pi, length.out=npts+1) + adj tmp2 <- seq(pi, 2*pi, length.out=npts+1) + adj polygon(

Re: [R] plot: abline() - define line length

2009-01-22 Thread Greg Snow
Use either the 'clip' function from the graphics package, or the 'clipplot' function from the TeachingDemos package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-b

Re: [R] blowup portion of graph beside it

2009-01-22 Thread Greg Snow
Here is one way: tmpmat <- cbind( c(1,1), c(1,1), c(2,3) ) layout(tmpmat) with(iris, plot(Sepal.Width, Sepal.Length, col=c('red','green','blue')[Species])) with(iris, plot(Sepal.Width, Sepal.Length, col=c('red','green','blue')[Species], xlim=c(2.5,3), ylim=c(6,6.5))) with

Re: [R] quantile question

2009-01-22 Thread Greg Snow
Read the help page for the quantile function (the whole page, there is a lot of good detail in there), the 2nd reference on the page should also be a helpful read. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Origin

Re: [R] Loess fitting with bisquare

2009-01-22 Thread Greg Snow
The loess function in R uses the tricube weights that are described in my copy of Cleveland, so that may do what you want. If you really want to do the same general idea but with a different weight function, then it is not that hard to write your own function to do the estimating (but I doubt t

Re: [R] Unexpected behaviour of the as.Date (was: Error as.Date on Invalid Dates)

2009-01-22 Thread Greg Snow
I believe the original thread was about whether the function returns NA or stops with an error when given an invalid date (such as Feb 29 in a non-leap year). Your question was about how as.Date returned something different from what you expected. Related, but different enough that it probably

Re: [R] looping over a string

2009-01-22 Thread Greg Snow
I don't see right off why the one works and the other doesn't, but this looks like one of those cases that would be better done using a list rather than global variables. Instead of assigning the variables in the global workspace, create a list and assign them there. Then you can use lapply in

Re: [R] Unexpected behaviour of the as.Date (was: Error as.Date on Invalid Dates)

2009-01-22 Thread Greg Snow
Comments interspersed below From: Marie Sivertsen [mailto:mariesiv...@gmail.com] Sent: Thursday, January 22, 2009 1:17 PM To: Greg Snow Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Unexpected behaviour of the as.Date (was: Error as.Date on Invalid Dates) [snip] For your question, the help

Re: [R] looping over a string

2009-01-22 Thread Greg Snow
ps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r_lo...@web.de [mailto:r_lo...@web.de] > Sent: Thursday, January 22, 2009 1:27 PM > To: Greg Snow; r-help@R-project.org > Subject

Re: [R] Stat textbook recommendations?

2009-01-23 Thread Greg Snow
I like: Applied Linear Statistical Models by Neter, Kutner, Nachtsheim, and Wasserman (McGraw Hill) It is not specific to any stats package, but it gives a good mix of theory behind the routines and how to apply them and covers a good breadth of material. A must have for statistics and R is:

Re: [R] R stepping through multiplie interactions

2009-01-23 Thread Greg Snow
Z ~ (A+B+C+D)^3 means give all main effects and interactions up to the 3 way interactions, but not above (change ^3 to ^2 to limit to 2 way interactions). You can do a semi manual stepwise procedure using the add1 and drop1 commands or the addterm and dropterm commands in the MASS package. But

Re: [R] Problem with colormodel in pdf driver

2009-01-24 Thread Greg Snow
You may want to consider a dotchart instead of a barplot. Then you can distinguish between groups by using symbols, grouping, and labels rather than depending on colors/shades of grey. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.

Re: [R] Is abline misbehaving?

2009-01-24 Thread Greg Snow
This is a known issue, the documentation of clip talks about some plotting functions resetting the clipping region and some don't. abline is apparently one of those that plots first, then resets the clipping region (so the first time it doesn't acknowledge it, but does afterwards). The functio

Re: [R] Run Script at Start Up

2009-01-24 Thread Greg Snow
If you do ?Startup at the command line, you will get a help file that will give you several options for doing this. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.or

Re: [R] Timestamp

2009-01-27 Thread Greg Snow
Use cat instead of print, or better yet: winProgressBar tkProgressBar (tcltk package) txtProgressBar Also for simple date stamps you can just use the date() function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Origi

Re: [R] generic questions about probability and simulation -- not directly related to R

2009-01-27 Thread Greg Snow
If the time until change is exponentially distributed with a mean of 3, then the probability of changing in the first day is: > pexp(1,1/3) [1] 0.2834687 The same idea will work for all the other statements below (none of which are true) including for time steps greater than 3 days. Hope this

Re: [R] help with plot layout

2009-01-28 Thread Greg Snow
We don't have your data, so we cannot reproduce what you are doing and the plot was stripped off before we saw it (only certain types of attachments are allowed, and some e-mail programs don't give the correct information about attachments so even those types can be stripped if it is not clear w

Re: [R] Graphic device & graphics primitives

2009-01-29 Thread Greg Snow
Sigbert, The plot2script function in the TeachingDemos package does essentially what Duncan talks about for you. Create your plot then run the function giving it a filename to save the info into (or run without arguments and then past into a script window or text editor (only tested on windows

Re: [R] bootstrapping in regression

2009-01-29 Thread Greg Snow
What you are describing is actually a permutation test rather than a bootstrap (related concepts but with a subtle but important difference). The way to do a permutation test with multiple x's is to fit the reduced model (use all x's other than x1 if you want to test x1) on the original data and

Re: [R] bootstrapping in regression

2009-02-02 Thread Greg Snow
; From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Thomas Mang > Sent: Thursday, January 29, 2009 3:52 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] bootstrapping in regression > > Greg Snow wrote: > > What you are describing

Re: [R] How do I get my IT department to "bless" R?

2009-02-02 Thread Greg Snow
There has already been good discussion on this topic, but here are a couple of other things to think about: 1. is it your job to convince your IT department, or is it your job to convince your boss, and your boss's job to convince/dictate to the IT department (getting your boss on your side cou

Re: [R] Selectively Removing objects

2009-02-02 Thread Greg Snow
If you want to keep the functions, why not move them to a different environment so that they don't get deleted when you delete everything else (this will also work better if you want to use these same functions in other R sessions). The most comprehensive way to do this is to create a package wi

Re: [R] New to R

2009-02-02 Thread Greg Snow
If you are interested in rolling dice with R (as opposed to using this as a simple test case to start writing your own programs), then you may want to look at the "dice" function from the TeachingDemos package. The core line in this function is basically the same as Gabor's suggestion, but with

Re: [R] R: Trellis Graph

2009-02-02 Thread Greg Snow
?lattice::shingle Hope that helps, if not, give more detail/example. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On B

Re: [R] New to R

2009-02-02 Thread Greg Snow
It is not transposing (it just looks that way). The first result is a vector which is 1 dimensional, but is neither a row or a column. The printed version of it looks like a row, because that is a more compact representation. If you sample enough points you will see it wrap around and be repr

Re: [R] ThinkCell type waterfall charts in R?

2009-02-03 Thread Greg Snow
Without knowing how your data is formatted or how you intend to link the information together, all we can do is reconsctruct the plot from scratch. Here is one way to do that (change whatever values you want to tweek the look): plot( c(1,10), c(0,95), type='n', axes=F, xlab='', ylab='', xlim=c(

Re: [R] executing R batch files

2009-02-04 Thread Greg Snow
Let me guess, you are using MSwindows and using notpad as the editor. Notepad has this annoying "feature" that if you save a file as a text file then it automatically adds '.txt' to the end of the file name. So when you saved as a text file it actually named the file "Rbatch.bat.txt" and the co

Re: [R] cronbachs alpha - score.items(psych) vs reliability(Rcmdr)

2009-02-04 Thread Greg Snow
You can run a function from a package by doing something like: > Rcmdr::reliability(cov(DavisThin)) This will load the package in the background, but not run the gui and other things. So you can use the function(s) that you want without running everything like when you do library(Rcmdr). Hope

Re: [R] Passing data among multiple instances

2009-02-04 Thread Greg Snow
Look at the nws package, it has tools for passing data among multiple instances of R (and waiting for data to be ready). There are other packages that provide some of the same, but from what I remember, nws was fairly simple to set up on a single computer. Hope this helps, -- Gregory (Greg) L

Re: [R] R command to compare two vectors?

2009-02-04 Thread Greg Snow
Try: > b_tmp %in% a_tmp You may also want to use the all or any function with the above. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailt

Re: [R] Introduction to maps (of Denmark)?

2009-02-06 Thread Greg Snow
Googling for Denmark Shapefile leads to this website: http://www.vdstech.com/map_data.htm Where a few clicks lead to downloading a set of shapefiles (different levels of subdividing the country, hopefully you know more about what they correspond to than I do, about all I know about Denmark is fr

Re: [R] Choosing a random number between x and y

2009-02-09 Thread Greg Snow
The runif function meets the stated criteria, if that is not good enough, then give us more detail. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help

Re: [R] for loop help

2008-04-11 Thread Greg Snow
Tom, Bill Venables gave you references to important tools for dealing with for loops in R and they may be all the solution that you need. But here is a little more detail on what is going on in case you want/need more control in the future. Note that the R for loop is what some programers call

Re: [R] Legend position outside

2008-04-11 Thread Greg Snow
Yes, here is one way: > plot(1:10, pch=1:2) > par(xpd=NA) > tmp.u <- par('usr') > legend(tmp.u[1], tmp.u[4], xjust=0, yjust=0, c('a','b'), pch=1:2) > You will probably want to increase the margins for a real case. See ?par and the 'xpd' entry for details on the clipping and ?legend for more det

Re: [R] Legend position outside

2008-04-12 Thread Greg Snow
Type "?par" at the command line to bring up the help page, then scroll down and read the sections on xpd and usr. From: Edwin Sendjaja [mailto:[EMAIL PROTECTED] Sent: Fri 4/11/2008 9:56 PM To: Greg Snow; r-help@r-project.org Subject: Re: [R] Legen

Re: [R] two graphs in one figure?

2008-04-12 Thread Greg Snow
od enough? or do you need the bars to look much more like the barplot? From: Anne-Katrin Link [mailto:[EMAIL PROTECTED] Sent: Sat 4/12/2008 7:11 AM To: Greg Snow Cc: r-help@r-project.org Subject: RE: [R] two graphs in one figure? Dear Greg, dear all, thank yo

Re: [R] getGraphicsEvent plotting two graph

2008-04-14 Thread Greg Snow
I think that the problem is with the dev.off commands. The first time running b there are not a device 2 and device 3 so dev.off does nothing (or if they did exist then they are turned off). Then you set the graphics event callback which attaches to the current graph window (number 3 in general).

Re: [R] two graphs in one figure?

2008-04-14 Thread Greg Snow
same capability, or Prof. Ripley writes a better version to include in a core package). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 From: Anne-Katrin

Re: [R] how to add different type of lines (short dash, long dash) into current plot)

2008-04-14 Thread Greg Snow
The "type" argument to plotting functions determines the type of plot (plot lines or points or both or ...). To specify the type of line you need to use the "lty" argument. See the help page for "par" (?par) for details on the types of line you can use (also "lwd" is the width of the lines). B

Re: [R] read data into list of matrix

2008-04-14 Thread Greg Snow
Read the help page on '[', then read it again a couple more times (it can be subtle). I think you want to use fp[[1]] rather than fp[1], the first will return a single element from the list (a data frame in the case below), the second returns a list of length 1 (with that element being a data fram

Re: [R] Text-based graphics/plots

2008-04-15 Thread Greg Snow
When I first started using an early port of S, the main way to create graphs was with the "printer" graphics device which created plots like this (back then that was impressive). S-PLUS does still have the printer graphics device to do things like this, but I don't think that anyone has ever imple

Re: [R] heavy graphs

2008-04-15 Thread Greg Snow
Look at the hexbin package (bioconductor I think). -Original Message- From: "Georg Ehret" <[EMAIL PROTECTED]> To: "r-help" <[EMAIL PROTECTED]> Sent: 4/15/08 3:23 PM Subject: [R] heavy graphs Dear R community,I am creating large graphs with hundreds of thousands of datapoints. My u

Re: [R] Documentation General Comments

2008-04-22 Thread Greg Snow
This is a case of you can't please everyone. A while back there was some complaint that "Introduction to R" spent to much time on talking about the different types of variables, just the opposite complaint of yours. There are several other sources of documentation (look under the books link on th

Re: [R] Use of recordPlot

2008-04-22 Thread Greg Snow
You seem to be confusing several issues. First, being object oriented does not mean that it matches C++ syntax or that every object is guarenteed to have specific methods. What lead you to think that a recordedplot would have a metafile method? Nothing else has that method, and the only function

Re: [R] Density estimation

2008-04-23 Thread Greg Snow
Look at the logspline package. It has a different way of estimating densities that allows for limits to be specified (i.e. probability is 0 beyond the point(s) you specify). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801)

Re: [R] g(x,y) = f(x,y) - e(x)- e(y)?

2008-04-23 Thread Greg Snow
It is not clear exactly what you want to do by subtracting a vector from a matrix, but look at the "sweep" function, it may do what you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From

Re: [R] help needed: Plotting step by step.

2008-04-23 Thread Greg Snow
Can you show us the code you used for the 5 to 10 points? (either generate some random data, or use a sample dataset). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: [EMAIL PROTECTED] > [

Re: [R] pdf() and histogram() in function call

2008-04-23 Thread Greg Snow
Read FAQ 7.22 -- Gregory (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 qian z > Sent: Wednesday, April 23, 2008 10:49 AM > To: r-help@r-pr

Re: [R] R Newbie Question/Data Model

2008-04-24 Thread Greg Snow
First off there are multiple definitions of "best", you need to decide which "best" is best for you. Second, for reasonable definitions of "best", deciding between, linear, polynomial, and ... Requires backgroud knowledge and real thought. R can fit many different models and give you numerical an

Re: [R] matrix from list

2008-04-25 Thread Greg Snow
You may want to read the help page for '[' and '[[' a few more times (the differencese can be subtle). The '[[' only returns a single element from a data structure (but in the case of a list, that single element can be quite complex). So something like list[[1:2]] does not make sense because you

Re: [R] Sum of random values

2008-04-25 Thread Greg Snow
You might want to look at the distr package (and its relatives). It provides methods for calculating the distribution function of combinations (the sum is one) of other distributions. I'm not sure how you would convert your percentiles to a distribution function, but there may be a way in the doc

Re: [R] matrix from list

2008-04-26 Thread Greg Snow
So you want mylist[[1:2]] to return something (other than an error) when mylist is a list. What if mylist <- list( 1:10, 101:110 , some.other.things) so the first 2 elements are vectors of length 10. then mylist[1:2] makes sense as still being a list with the 2 vectors. What should mylist[[1:

Re: [R] Use of recordPlot

2008-04-30 Thread Greg Snow
, but I think it will work better for you at this point. From: Beck, Kenneth (STP) [mailto:[EMAIL PROTECTED] Sent: Mon 4/28/2008 8:53 AM To: Greg Snow; r-help@r-project.org Subject: RE: [R] Use of recordPlot Thanks for the clarification, this helps a lot

Re: [R] If(cond) statement

2008-05-01 Thread Greg Snow
This is for the same reason that: 3 +4 Does not give 7. R is optimized for interactive use, so if a statement can be considered complete, it evaluates it instead of waiting for more. In your case: if(mxx>mxy) mxy=mxx Is a complete statement and is evaluated without waiting to see if there is

Re: [R] How to plot wind direction and strength field

2008-05-01 Thread Greg Snow
Does the following do what you want (or at least move in that direction)? u <- array(NA,c(5,8)) t <- seq(from=0.5, to=0.11,length=15) t2 <- seq(from=(-0.7),to=(-0.1),length=25) u[1:15] <- t u[16:40] <- t2 v <- array(NA,c(5,8)) y <- seq(from=(-0.9), to=(-0.01),length=40) v[1:40] <- y library(Teac

Re: [R] How to stop buffering of "cat"

2008-05-01 Thread Greg Snow
In addition to what others have pointed to regaurding buffering and cat, there are also a couple of new functions in R 2.7.0 that help with showing the progress of computations. They are winProgressBar (windows only) and TkProgressBar (in the tcltk package). You can use these to create and update

Re: [R] Data manipulation for random intercept GLMM

2008-05-02 Thread Greg Snow
Is this what you are trying to do? > tt <- matrix( 5:10, ncol=2 ) > df <- as.data.frame.table(tt) > df2 <- df[ rep( 1:nrow(df), df$Freq ), ] And is that elegant enough? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -

Re: [R] points size in plots

2008-05-02 Thread Greg Snow
?symbols -- Gregory (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 Irene Mantzouni > Sent: Friday, May 02, 2008 7:52 AM > To: [EMAIL PROTEC

Re: [R] expand.grid using a repeated vector as a parameter

2008-05-02 Thread Greg Snow
Try: > tmp <- rep( list( 0:1 ), 5 ) > out <- do.call(expand.grid, tmp) Then change the 5 to whatever you want. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: [EMAIL PRO

Re: [R] categorical data analysis

2008-05-06 Thread Greg Snow
Fisher's exact test works with small cells. See ?fisher.test -- Gregory (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 raymond chiruka > Sent:

Re: [R] Print table data on to a plot

2008-05-06 Thread Greg Snow
Look at the addtable2plot function in the plotrix package. -- Gregory (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 Anh Tran > Sent: Tuesday,

Re: [R] categorical data analysis

2008-05-07 Thread Greg Snow
The last example in ?fisher.test is not a 2x2 table, in fact it uses levels with a natural ordering similar to the original question. Why would this not be applicable to the situation? From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of David Winsemiu

Re: [R] Random number generation

2008-05-12 Thread Greg Snow
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Esmail Bonakdarian > Sent: Sunday, May 11, 2008 7:25 AM > To: Prof Brian Ripley > Cc: [EMAIL PROTECTED] > Subject: Re: [R] Random number generation [snip] > What I read doesn't seem to be incorrect ho

Re: [R] Fundamental formula and dataframe question.

2008-05-12 Thread Greg Snow
I would have thought that: > lm( C1 ~ M^2, data=DF ) Would give the main effects and 2 way interaction(s) (but a quick test did not match my expectation). Possibly a feature request is in order if people plan to use this a lot. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermou

Re: [R] writing a table in the device (pdf in this case)

2008-05-12 Thread Greg Snow
You probably want to look at "Sweave" in the "utils" package or the "odfWeave" package. Both let you set up a planned set of commands interspersed with text (notes, explanations, full report, etc.) and then you process the file and get the output (and commands) in either a LaTeX file or an Open

Re: [R] A Very Simple Question

2008-05-13 Thread Greg Snow
?sweep -Original Message- From: "Yukihiro Ishii" <[EMAIL PROTECTED]> To: "r-help@r-project.org" Sent: 5/13/08 8:30 AM Subject: [R] A Very Simple Question Hi Rusers! I am ashed of asking such a simple question. X<-matrix(rnorm(24), 4) X0<-apply(X,2,mean) What I want is a matrix which

Re: [R] Random number generation

2008-05-13 Thread Greg Snow
> -Original Message- > From: Esmail Bonakdarian [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 13, 2008 8:13 AM > To: Greg Snow > Cc: Prof Brian Ripley; [EMAIL PROTECTED] > Subject: Re: [R] Random number generation > > Greg Snow wrote: > >> -Original M

Re: [R] Bubble plot pie chart map

2008-05-13 Thread Greg Snow
Using just base graphics you can use the floating.pie function from the plotrix package, or the my.symbols function from the TeachingDemos package with your own symbol/plotting function. Pie charts are usually not very useful, there may be another type of symbol (see the symbols function) or pl

Re: [R] Dividing Two Dataframes

2008-05-14 Thread Greg Snow
SDF3 <- SDF1/SDF2[ rep(1:12,12), ] -Original Message- From: "Bert Jacobs" <[EMAIL PROTECTED]> To: "'Henrique Dallazuanna'" <[EMAIL PROTECTED]> Cc: "r-help@r-project.org" Sent: 5/14/08 7:41 AM Subject: Re: [R] Dividing Two Dataframes Hi Henrique, I think I understand your formula, bu

Re: [R] A very simple question

2008-05-14 Thread Greg Snow
Use logical subscripts rather than which: > k <- c(1,1,1,2,2,1,1,1) > k[ k != 1 ] [1] 2 2 > k[ k != 2 ] [1] 1 1 1 1 1 1 > k[ k != 3 ] [1] 1 1 1 2 2 1 1 1 Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -O

Re: [R] Font settings in xfig

2008-05-16 Thread Greg Snow
If the main goal is to include graphs created by R in LaTeX documents and have them look nice, and using xfig was just one way of attempting this, then here are a couple other options that may or may not work better. Use the postscript graphics device and use psfrag in LaTeX to replace text in

Re: [R] Log or diary file

2008-05-19 Thread Greg Snow
The R2HTML package has tools for creating an HTML log of your session (see ?HTMLStart). Or the TeachingDemos package has a text based set of tools (see ?txtStart) for creating a log of your session. Neither is perfect (and imperfect in different ways), but could be what you are looking for. H

Re: [R] labels in multiple plot

2008-05-19 Thread Greg Snow
It is not clear what exactly you are trying to do, but you may want to look at ?matplot for an alternative to your loop, then look at ?legend for adding explanations. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-81

Re: [R] labels in multiple plot

2008-05-19 Thread Greg Snow
21, + col=c('red','green','blue')) > -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: Bruno C. [mailto:[EMAIL PROTECTED] > Sent: Monday, May 19, 2008

Re: [R] Alignment of axes intersection

2008-05-20 Thread Greg Snow
Mathematicians like to have axes cross at 0, the general rule for statistics is to have the axes positioned so that they help you understand the data, but don't interfere with the actual points (or force too much whitespace by being put to far away from the data), so the default positioning foll

Re: [R] Alignment of axes intersection

2008-05-20 Thread Greg Snow
t: Tuesday, May 20, 2008 10:37 AM > To: Greg Snow; r-help@r-project.org > Subject: Re: Alignment of axes intersection > > > Agreed. The main reason I wanted the change in alignment was > that I had three curves that were converging to a asymptote, > and when I drew the horizontal

Re: [R] Labeling a plot's x-axis with 12 strings, vertically oriented.

2008-05-21 Thread Greg Snow
Here is one example: > y <- rnorm(12) > x <- 1:12 > > par(mar=c(10, 4, 4, 1)+0.1) > plot(x,y, xlab='', xaxt='n') > axis(1, at=x, labels=month.name, las=2) > See help on par and axis for details. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (8

Re: [R] Get all X iterations in optim output when controls(trace=6)

2008-06-02 Thread Greg Snow
Here is an alternative approach to saving the itterations: testfunc <- function(data) { ms.mat <- matrix(nrow=0, ncol=2) f1 <- function(ms, data){ ms.mat <<- rbind(ms.mat, ms) -sum( dnorm(data, mean=ms[1], sd=ms[2], log=TRUE) ) } ou

Re: [R] boxplot with text and symbols on x

2008-06-02 Thread Greg Snow
An alternative way to draw the symbols (or some approximation of them) is to use the my.symbols function from the TeachingDemos package along with ms.male and ms.female (or your improvement of these, also from the TeachingDemos package). See the 4th example from ?ms.male (or ?ms.female). Hope

Re: [R] surprising predicting capabilities

2008-06-03 Thread Greg Snow
That is actually from August 2007 (typo in the fortunes package). If you do > RSiteSearch('Thou Shalt Not Even Think Graph Spreadsheet') Then it will bring up the actual post and you can read it in context (along with the posts that lead to it and those that followed). Basically, Ted was tryin

Re: [R] how to automatically create objects with names from a string list?

2008-06-04 Thread Greg Snow
Mark, Others have given answers to the question that you asked, in the spirit of fortune(108) I am going to answer some of the questions that you should have asked: Q1: Should I ever do this? Short answer: No Less short answer: probably not Longer answer: You should only do this once you fully

Re: [R] create many variables at one time~

2008-06-04 Thread Greg Snow
An easy and good way to make a bunch of variables is to store them in a list. For example: > mylist <- replicate(100, sample(1:100, 10), simplify=FALSE) > id <- paste('id.',1:100, sep='') > names(mylist) <- id > sapply(mylist, median) id.1 id.2 id.3 id.4 id.5 id.6 id.7 id.8 id.

Re: [R] quite complicated case(the repeated data arranage~)

2008-06-04 Thread Greg Snow
For the first question, what do you want to do with all the subsets? There are tools like split, by, lapply, lmList, etc. that make working with all the subsets easy. If you tell us what your final goal is, we may be able to help with a simple solution that does not need the intermediate "tabl

Re: [R] Graphing help revisited

2008-06-05 Thread Greg Snow
Does this do what you want? Bill <- data.frame(A= c(1,1,1,2,3,4,5,6,6,7), B=c(5,5,6,7,7,7,8,9,10,11), group=rep(1:2, each=5) ) with(Bill, plot(A,B, pch=group) ) mns <- with(Bill, tapply(B, group, mean)) tmp <- par('usr') # or range(Bill$A) med <- with(Bill, mean( c(max(A[group==

Re: [R] How to force two regression coefficients to be equal but opposite in sign?

2008-06-06 Thread Greg Snow
One simple way is to do something like: > fit <- lm(y ~ I(x1-x2) + x3, data=mydata) The first coeficient (after the intercept) will be the slope for x1, the slope for x2 will be the negative of that. This model is nested in the fuller model with x1 and x2 fit seperately and you can therefore t

Re: [R] Improving data processing efficiency

2008-06-06 Thread Greg Snow
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Burns > Sent: Friday, June 06, 2008 12:04 PM > To: Daniel Folkinshteyn > Cc: r-help@r-project.org > Subject: Re: [R] Improving data processing efficiency > > That is going to be situation depende

Re: [R] Improving data processing efficiency

2008-06-06 Thread Greg Snow
> -Original Message- > From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] > Sent: Friday, June 06, 2008 12:33 PM > To: Greg Snow > Cc: Patrick Burns; Daniel Folkinshteyn; r-help@r-project.org > Subject: Re: [R] Improving data processing efficiency > > On Fri, Jun

[R] New vocabulary on a Friday afternoon. Was: Improving data processing efficiency

2008-06-06 Thread Greg Snow
, June 06, 2008 12:58 PM > To: Gabor Grothendieck > Cc: Greg Snow; r-help@r-project.org > Subject: Re: [R] Improving data processing efficiency > > My guess is that number 2 is closest to the mark. > Typing too fast is unfortunately not one of my habitual attributes. > > Gabor Gr

Re: [R] color scale mapped to B/W

2008-06-06 Thread Greg Snow
Try this (you need tcl 8.5 and the TeachingDemos package): library(teachingDemos) tmpplot <- function(col1='red', col2='yellow', col3='green'){ plot(1:10,1:10, type='n') rect(1,1,4,4, col=col1) rect(1,4,4,7, col=col2) rect(1,7,4,10, col=col3) rect(6,1,9,4, col=col2grey(col1)) rect(6,4,9,7, c

Re: [R] color scale mapped to B/W

2008-06-06 Thread Greg Snow
You may also want to look at the "show.colors" function in the "DAAG" package to get candidate colors. From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Michael Friendly [EMAIL PROTECTED] Sent: Friday, June 06, 2008 2:37 PM To: R-Help Subject: [R] co

Re: [R] Plot Coloured Triangle

2008-06-09 Thread Greg Snow
Here is an example that may get you started: point1 <- c(1.1, 1.7, 255) point2 <- c(2.2, 1.5, 180) point3 <- c(1.8, 2.2, 60) mydf <- as.data.frame( rbind(point1, point2, point3) ) names(mydf) <- c('x1','x2','red') fit <- lm(red~x1+x2, data=mydf) df2 <- expand.grid( x1=seq(min(mydf$x1), max(mydf

Re: [R] Comparing two groups of proportions

2008-06-09 Thread Greg Snow
here is one approach: res <- cbind( c(10, 5, 1, 12, 3, 8, 7, 2, 10, 1), c(90,15,79,38,7,92,13,78,40,9) ) line <- gl(5,1,length=10, labels=LETTERS[1:5]) qa <- gl(2,5) fit <- glm( res ~ line*qa, family=binomial ) summary(fit) anova(fit, test='Chisq') The interaction terms measure the differe

Re: [R] Comparing two groups of proportions

2008-06-09 Thread Greg Snow
9:16 PM To: Greg Snow Cc: R-help forum Subject: Re: [R] Comparing two groups of proportions Your approach tacitly assumes --- as did the poster's question --- that the probability of passing an item by one method is *independent* of whether it is passed by the other method. Which makes t

Re: [R] Hello

2008-06-10 Thread Greg Snow
Look at the "image" function and the "levelplot" function in the lattice package. -Original Message- From: "sumit gupta" <[EMAIL PROTECTED]> To: "r-help@r-project.org" Sent: 6/10/08 6:55 AM Subject: [R] Hello Hello, I am facing a problem in drawing heat map using R. I have a 70X3 mat

Re: [R] Comparing two groups of proportions

2008-06-10 Thread Greg Snow
s are (error component). > > Thanks, > Ivan > > > cheers, > > > > Rolf Turner > > > > On 10/06/2008, at 2:57 PM, Greg Snow wrote: > > > here is one approach: > > > > > > res <- cbind( c(10, 5, 1, 12, 3,

Re: [R] Fast method to compute average values of duplicated IDs

2008-06-10 Thread Greg Snow
?tapply ?aggregate -- Gregory (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 Daren Tan > Sent: Tuesday, June 10, 2008 9:37 AM > To: r-help@r-pr

Re: [R] Concat Multiple Plots into one PNG figure

2008-06-10 Thread Greg Snow
Look at ?print.trellis in the lattice package (specifically the split and more argumnets). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Beh

Re: [R] Plotting multiple continuous lines with symbols

2008-06-10 Thread Greg Snow
In your plot and lines function call you specify type="b" which says to use "b"oth lines and points with gaps in the lines around the points. If you change that to type="o" then it will "o"verplot the points and lines (no gaps). The different types are documented in ?plot.default. Hope this he

<    1   2   3   4   5   6   7   8   9   >