Re: [R] help on bar chart

2010-07-07 Thread Greg Snow
fortune(197) If anything, there should be a Law: Thou Shalt Not Even Think Of Producing A Graph That Looks Like Anything From A Spreadsheet. -- Ted Harding (in a discussion about producing graphics) R-help (August 2007) Filling graphics objects with lines dates back to the days when

Re: [R] using objects from different workspaces

2010-07-07 Thread Greg Snow
Check out the high performance computing task view on CRAN. -- 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 Behalf Of

Re: [R] Data Labels in a barchart (Lattice or otherwise)

2010-07-07 Thread Greg Snow
fortune(197) If anything, there should be a Law: Thou Shalt Not Even Think Of Producing A Graph That Looks Like Anything From A Spreadsheet. -- Ted Harding (in a discussion about producing graphics) R-help (August 2007) Also read the discussion started with:

Re: [R] plot focus

2010-06-30 Thread Greg Snow
I would generally write a function to create the entire first plot, then the entire 2nd plot based on data or other arguments passed in, then in your loop or whatever call the function with the different steps. This will recreate the plots from scratch at each step rather than adding to the

Re: [R] Correctly plotting bar and scatter chart on 2-y axis plot with par(new=T)

2010-06-30 Thread Greg Snow
For 1 you can just reverse one of the y ranges, e.g.: updateusr(1:2, range(0,y1), 1:2, rev(range(y2)) ) on my computer for some reason the axis command needs you to explicitly set the at points, but then it works properly. For 2, are the axes on all the plots the same? If so you can put all

Re: [R] generate irregular series of dates

2010-06-29 Thread Greg Snow
A fairly simple way is to generate one series with all the Tuesdays, then another with all the Thursdays, combine and sort. sort( c( seq.Date( as.Date('2010-6-29'), by='week', length.out=10), + seq.Date( as.Date('2010-7-1'), by='week', length.out=10) ) + ) [1] 2010-06-29 2010-07-01 2010-07-06

Re: [R] How to draw multi group plot?

2010-06-29 Thread Greg Snow
It is hard to know exactly what you want without a description of your data or what you want the final plot to look like. But you can do the equivalent of plot followed by multiple calls to points by using a loop, apply functions, the lattice package or the ggplots2 package (I'm guessing the

Re: [R] merging/intersecting 2 data frames

2010-06-29 Thread Greg Snow
Use the merge function, look at the by.x and by.y arguments, also look at the all.x and all.y arguments as well as the suffixes argument. You may need to delete some columns after the merge (or replace missing values in one column with those in the same location from the next column, see the

Re: [R] Calculating Summaries for each level of a Categorical variable

2010-06-28 Thread Greg Snow
The problem is that tapply is expecting a vector for the first argument, your first argument is a list or data frame, so the length that it sees is the number of list elements (columns of the data frame). You need to either pass a single vector, or use functions like aggregate or the plyr

Re: [R] several common sub-axes within multiple plot area

2010-06-28 Thread Greg Snow
How about: #my example: dev.new() layout( rbind( c(1,2), c(7,7), c(3,4), c(8,8), c(5,6), c(9,9) ), heights=c(10,1,10,1,10,1) ) #Graph 1: plot(rnorm(20), rnorm(20), xlab = Results 1 (Int), ylab = Variable A, main = Factor X) #Graph 2: plot(rnorm(20),

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-26 Thread Greg Snow
. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Atte Tenkanen [mailto:atte...@utu.fi] Sent: Friday, June 25, 2010 10:08 PM To: Atte Tenkanen Cc: Greg Snow; David Winsemius; R mailing list Subject: Re: [R] Wilcoxon signed rank test and its requirements Atte Tenkanen

Re: [R] Wilcoxon signed rank test and its requirements

2010-06-25 Thread Greg Snow
Let me see if I understand. You actually have the data for the whole population (the entire piece) but you have some pre-defined sections that you want to see if they differ from the population, or more meaningfully they are different from a randomly selected set of measures. Is that correct?

Re: [R] Trying to tile wireframe plots (using lattice package)

2010-06-25 Thread Greg Snow
The layout function is base graphics, wireframe from lattice is grid based and they don't play well together without extra effort. The simplest option will probably be to look at the help page for print.trellis, specifically the split and more arguments. Then look at the examples to see if

Re: [R] Comparing distributions

2010-06-24 Thread Greg Snow
If you want a more objective eye-ball test, look at: Buja, A., Cook, D. Hofmann, H., Lawrence, M. Lee, E.-K., Swayne, D.F and Wickham, H. (2009) Statistical Inference for exploratory data analysis and model diagnostics Phil. Trans. R. Soc. A 2009 367, 4361-4383 doi:

Re: [R] Correctly plotting bar and scatter chart on 2-y axis plot with par(new=T)

2010-06-24 Thread Greg Snow
Using par(new=T) is dangerous and tricky for those people who understand what it does and how to use it. Trying to use it without fully understanding it will be much worse. I would use the updateusr function from the TeachingDemos package instead. The first example on the help page may give

Re: [R] Correctly plotting bar and scatter chart on 2-y axis plot with par(new=T)

2010-06-24 Thread Greg Snow
Is this what you want: y1 - c(-30353.382, -21693.519, -7049.923, -72968.722, -10267.584, -269432.795, -19847.670, -686283.171, -376231.754, -597800.080, -274637.587, -112663.167, -39550.445, -133916.431) xlabs - c(1, 7, 13, 2, 8, 14, 3, 9, 4, 10, 5, 11, 6, 12) y2 - c(50, 25,

Re: [R] [OT] Combinatorials wtih constraints

2010-06-24 Thread Greg Snow
Well here is one way (but this finds too many, then reduces, so if the final result is near the memory limit, this would go over first): unique(t(combn( rep(LETTERS[1:5], each=2), 3))) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] Simple qqplot question

2010-06-24 Thread Greg Snow
The line for the perfect match would be abline(0,1) if you want to allow affine transformations, then it gets a bit harder. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] possibility to determine whether a script is sourced?

2010-06-23 Thread Greg Snow
Look at the interactive function, it may do what you want. -- 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 Behalf Of

Re: [R] About normality tests...

2010-06-23 Thread Greg Snow
Before doing normality tests look at fortune(117) and fortune(234). If you still feel the need to have the computer print out a p-value for a test of exact normality, then try SnowsPenultimateNormalityTest in the TeachingDemos package. If you want a test that is more meaningful, then look at

Re: [R] list() assigning the same value to two items

2010-06-22 Thread Greg Snow
One approach is to use the within function: within(list(), {a-1; b-a}) $b [1] 1 $a [1] 1 Now, whether that is simpler or more compact than other options is for you (or other users) to decide. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

Re: [R] k-sample Kolmogorov-Smirnov test?

2010-06-22 Thread Greg Snow
If you want to test the null that all datasets come from the same distribution, then I would probably do this as a permutation test. Find the largest K-S distance between 2 groups, then randomly permute the data into a new set of k groups (with same sample sizes) and find the largest K-S

Re: [R] Read code from character string

2010-06-18 Thread Greg Snow
You should also look at fortune(106) and think about possible other solutions to your overall objective. -- 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

Re: [R] questions on some operators in R

2010-06-18 Thread Greg Snow
Just to expand a little on David's reply. The vs. and | vs. || issue is really about where and how you plan to use things. and | work on vectors and are intended to be used to combine logical vectors into a new logical vector (that can be used for various things). and || are used for

Re: [R] questions on some operators in R

2010-06-18 Thread Greg Snow
, June 18, 2010 12:16 PM To: li li; Greg Snow Cc: r-help Subject: RE: [R] questions on some operators in R Li li, I know many S-language old timers would tell you to use - over = for assignment. Speaking from my own painful experience of debugging S/R codes, I much much much prefer

Re: [R] Read code from character string

2010-06-18 Thread Greg Snow
('106') Personally I have never regretted trying not to underestimate my own future stupidity. -- Greg Snow (explaining why eval(parse(...)) is often suboptimal, answering a question triggered by the infamous fortune(106)) R-help (January 2007) -- Gregory (Greg) L. Snow Ph.D

Re: [R] questions on some operators in R

2010-06-18 Thread Greg Snow
Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: Horace Tso [mailto:horace@pgn.com] Sent: Friday, June 18, 2010 3:15 PM To: Erik Iverson; Greg Snow Cc: r-help Subject: RE: [R] questions on some operators in R You still couldn't sway

Re: [R] Question regarding print

2010-06-17 Thread Greg Snow
The cat function is probably the best approach, but if your really feel the need to use print then you can just assign blank names (now it will be a named vector and slower in heavy calculations, but the printing is different). Try something like: names(x) - rep( '', length(x) ) print(x) #

Re: [R] R user interface

2010-06-17 Thread Greg Snow
One possibility (there are others as well) is write your own function that given the name of the country will grab the data and create the plot that you want. Then use the tkexamp function in the TeachingDemos package to create the GUI for this function. Other options (which I am less

Re: [R] Pretty printing progress

2010-06-17 Thread Greg Snow
Others mentioned progress bars and sprintf, one other option is to use a named vector and let R to the formatting: tmp - c(10, -1234) # or variables to put the values in names(tmp) - c('Iteration', ' Log Likelihood') print(tmp) Hope this helps, -- Gregory (Greg) L. Snow Ph.D.

Re: [R] points marking

2010-06-14 Thread Greg Snow
...@imail.org 801.408.8111 From: khush [mailto:bioinfo.kh...@gmail.com] Sent: Saturday, June 12, 2010 5:38 AM To: Greg Snow Cc: r-help@r-project.org; Petr PIKAL Subject: Re: [R] points marking Hi, Well Thanks for letting me know that pch is of no use with segments petr. I am using lend

Re: [R] points marking

2010-06-11 Thread Greg Snow
...@gmail.com] Sent: Friday, June 11, 2010 12:00 AM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] points marking Dear Gregory , Thnaks for your reply and help. I am explaining you my problems again, below is my script for the same . Dom -c (195,568,559) fkbp - barplot (Dom, col=black, xlab

Re: [R] adding column of ordered numbers to matrix

2010-06-10 Thread Greg Snow
newmat - cbind( oldmat, order=seq(nrow(oldmat)) ) See ?seq and/or ?rev for descending. -- 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-

Re: [R] points marking

2010-06-10 Thread Greg Snow
Your question is not really clear, do either of these examples do what you want? with(anscombe, plot(x1, y2, ylim=range(y2,y3)) ) with(anscombe, points(x1, y3, col='blue', pch=2) ) with(anscombe, segments(x1, y2, x1, y3, col=ifelse( y2y3, 'green','red') ) ) with(anscombe, plot(x1, y2,

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread Greg Snow
If you cannot set the aspect ratio to 1 for the entire plot (Peter's solution), then you may consider using either subplot or my.symbols (TeachingDemos package) to create an asp=1 region within the plot that you can use to plot the rotated rectangle. The other option is to do a little more

Re: [R] iterating over groups of columns

2010-06-09 Thread Greg Snow
You could try something like this (untested): tmpfun - function(i) { + tmp - paste( ^k., i, sep=) + apply( subset(mydf, select=grep(tmp, names(mydf) ) ), 1, min ) + } out1 - lapply(1:10, tmpfun) names(out1) - paste( min.k., 1:10, sep= ) mydf2 - cbind(mydf, out1) -- Gregory (Greg) L.

Re: [R] barplot of a table

2010-06-09 Thread Greg Snow
If your data came in using read.csv then it is most likely a data frame rather than a matrix. Try as.matrix to convert it to a matrix and then use barplot. If that does not work then give us a sample of your data and the exact commands (copy/paste) that use used along with any errors/warnings.

Re: [R] Help with seting up comparison

2010-06-08 Thread Greg Snow
...@imail.org 801.408.8111 From: Bart Joosen [mailto:bartjoo...@hotmail.com] Sent: Monday, June 07, 2010 11:37 PM To: Greg Snow; r-help Subject: RE: [R] Help with seting up comparison Greg, the animals are a sample of a larger population, as you guessed. I used lmer to estimate the effects: lmer(Count

Re: [R] Symbols in R

2010-06-08 Thread Greg Snow
The my.symbols function (TeachingDemos package) allows for defining your own symbols to use in plots using base graphics (see ms.filled.polygon for an example), there is also panel.my.symbols which works with lattice (possibly with general grid, but I have not tested it that way). Those may

Re: [R] scatterplot function - double check: dashed lines

2010-06-08 Thread Greg Snow
While it is possible to set your own dash patterns as you show below, it is unlikely that the resulting graph will be very meaningful. Most people cannot keep the detailed dash patterns separate, and if they need to refer to a legend then it makes it even harder (See Bert Gunter's rant on the

Re: [R] paste together a string object later to be utilized in a function

2010-06-07 Thread Greg Snow
Does the collapse argument to the paste function do what you want? Possibly nested inside another paste. -- 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

Re: [R] Loading an image/picture (png/jpeg/...) to screen...

2010-06-07 Thread Greg Snow
Once you have your image displayed in a plot, look at the updateusr function in the TeachingDemos package for a way to modify the coordinate system to what you want so that using locator() gives the results that you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain

Re: [R] Color scale graphic

2010-06-07 Thread Greg Snow
Do you just want a rectangle with different vertical color bands? Then look at the image function. Do you want a small rectangle that goes the length of the x-axis with these color bands, but gives room for another plot above that? Then look at the subplot function (TeachingDemos package)

Re: [R] Help with seting up comparison

2010-06-07 Thread Greg Snow
Are you interested in only those 35 animals (not every going to look at any other animals other than those 35, but you want to predict what will happen for those 35)? Or are the 35 animals a sample of a larger population of animals? If the later (seems the most likely case) then you probably

Re: [R] as.integer

2010-06-07 Thread Greg Snow
Usually when read.table converts numbers to factors it means that there is a problem in the data file, an extra character somewhere. It is best to fix the problem in the source data (or a copy of the source data) so that the data imports properly rather than try to fix it post hoc. If that is

Re: [R] how to parse out string separated by special character

2010-06-07 Thread Greg Snow
Look at the strapply function in the gsubfn package. It may do what you want. -- 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-

Re: [R] Shapes in barplots

2010-06-05 Thread Greg Snow
want to ask like I need to make round ended bars instead of normal one I have to look into rgl for the same, but is there any option which you think suitable for me in barplots. Whats your suggestions. Thank you Jeet On Fri, Jun 4, 2010 at 11:09 PM, Greg Snow greg.s...@imail.org wrote

Re: [R] Shapes in barplots

2010-06-04 Thread Greg Snow
The TeachingDemos package does not in any way replace the rgl package. They serve very different purposes (the TeachingDemos package does use rgl for a couple of functions). I would be very surprised if there was anything in the TeachingDemos package that would be of help in creating barplots

Re: [R] plot polar coordinates

2010-06-03 Thread Greg Snow
It looks like polar.plot does not handle negative lengths, you can preprocess the data and just add 180 degrees to the angles corresponding to negative lengths and then use their absolute values. The radial.lim is not ignored, based on the documentation the range is then made pretty (and 100

Re: [R] Wait for keystroke or timeout

2010-05-28 Thread Greg Snow
This is really a user interface issue and the standard user interface is different between platforms. Would tcltk (or RGTK or ...) be a possible solution for you? tcltk is fairly consistent across platforms and does provide for this type of thing (you can have a button to press to continue

Re: [R] How to get the definition of a function if it is masked by a variable?

2010-05-28 Thread Greg Snow
?'::' -- 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 Behalf Of thmsfuller...@gmail.com Sent: Friday, May 28, 2010 12:55

Re: [R] Methods to explore R data structures

2010-05-27 Thread Greg Snow
The TkListView function in the TeachingDemos package is an interactive tool for looking at the structure and contents of lists and other objects. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message-

Re: [R] shapiro.test

2010-05-27 Thread Greg Snow
Others pointed out that the error message is due to ozon being a data frame, but I think the true source of confusion comes a bit earlier. You really need to understand more about data objects and the search path. You first read in a table and name it tab1. Then you attach tab1 to the search

Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss?

2010-05-26 Thread Greg Snow
Inline below: From: Tal Galili [mailto:tal.gal...@gmail.com] Sent: Wednesday, May 26, 2010 12:26 AM To: Greg Snow Cc: Faiz Rasool; R-help@r-project.org Subject: Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss? Hello Greg, Thank you for the coding. A few

Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss?

2010-05-26 Thread Greg Snow
Healthcare greg.s...@imail.org 801.408.8111 From: Tal Galili [mailto:tal.gal...@gmail.com] Sent: Wednesday, May 26, 2010 2:10 PM To: Greg Snow; h...@stat.berkeley.edu Cc: Faiz Rasool; R-help@r-project.org Subject: Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss? Hello Greg

Re: [R] Problem with Sweave not recognising \Sexpr{}

2010-05-25 Thread Greg Snow
What other packages do you have loaded? Sometimes things interfere with each other. Also, what version, os, etc are you working with? (the info asked for in the posting guide). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] Getting sink to work with message on R 2.11.0 - what didI miss?

2010-05-25 Thread Greg Snow
and it will start to divert the output to a txt or a .doc file? Thank you once again to all of those who have participated in this thread. Faiz. - Original Message - From: David Winsemius dwinsem...@comcast.net To: Greg Snow greg.s...@imail.org Cc: r-help@r-project.org Sent

Re: [R] calling Perl script from R on Windows 7

2010-05-24 Thread Greg Snow
Try your same system command, but set intern=TRUE in the call and see if that does what you want. -- 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

Re: [R] Reading results of commands in Microsoft Word typed in the terminal window, A question from a Blind R user.

2010-05-21 Thread Greg Snow
The R2wd package can be used to send things to word documents, that may work for you. If you want this done automatically you could look at the txtStart and related functions in the TeachingDemos package and just change the parts that send plain text to the file (sink) with commands from R2wd.

Re: [R] Getting sink to work with message on R 2.11.0 - what did I miss?

2010-05-21 Thread Greg Snow
Look at txtStart and friends in the TeachingDemos package as an alternative to sink that includes commands as well as output. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] How to plot the sample size on top of the bars of a barchart plot?

2010-05-19 Thread Greg Snow
Yes, and many of us also know why doing so is a bad idea. This has been discussed before, if you search the archives you can find the full discussion showing how, why not, and better approaches. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

Re: [R] How to display data values for points in a plot?

2010-05-18 Thread Greg Snow
It depends on what you mean by display values. In addition to the other suggestions also look at the identify function as well as TkIdentify and HTKidentify in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] abline limit constrain x-range how?

2010-05-18 Thread Greg Snow
The clip function will limit the area that other functions (including abline) plot to, so that is one option. -- 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

Re: [R] p value

2010-05-18 Thread Greg Snow
An option similar to Bert's but looking more like a standard hypothesis test output is to use the function: SnowsCorrectlySizedButOtherwiseUselessTestOfAnything from the TeachingDemos package. If you want a more useful result then you will need to be less general and more specific. --

Re: [R] Box-Cox Transformation: Drastic differences when varying added constants

2010-05-18 Thread Greg Snow
Have you read the BoxCox paper? It has the theory in there for dealing with an offset parameter (though I don't know of any existing functions that help in estimating both lambdas at the same time). Though another important point (in the paper as well) is that the lambda values used should be

Re: [R] Text positioning in pixel coordinates?

2010-05-18 Thread Greg Snow
?grconvertX -- 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 Behalf Of Oliver Sent: Monday, May 17, 2010 8:24 AM To:

Re: [R] scaling with relative units in plots or retrieving axes limits in plots

2010-05-18 Thread Greg Snow
Look at the grconvertX and grconvertY functions for a built in solution with much more flexibility. -- 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

Re: [R] P values

2010-05-12 Thread Greg Snow
, 2010 3:50 PM To: Greg Snow; 'Bak Kuss'; murdoch.dun...@gmail.com; jorism...@gmail.com Cc: R-help@r-project.org Subject: RE: [R] P values Inline below. -- Bert Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help

Re: [R] Splines under tension

2010-05-12 Thread Greg Snow
I think this last line is a fortune candidate: It's not just that different disciplines rediscover the same ideas, they also relabel them. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] [Fwd: Re: Plotting log-axis with the exponential base to a plot with the default logarithm base 10]

2010-05-11 Thread Greg Snow
Is it the tick labels that you want to change? -Original Message- From: Elisabeth Bjerke Rastad ebr...@post.uit.no To: r-help@r-project.org r-help@r-project.org Sent: 5/10/10 11:20 AM Subject: [R] [Fwd: Re: Plotting log-axis with the exponential base to a plot with the default logarithm

Re: [R] Rd files must have a non-empty \title

2010-05-11 Thread Greg Snow
I nominate Duncan's last statement: If you don't want informative help files, it's really not much work to make uninformative ones. Duncan Murdoch For the fortunes package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] median of two groups

2010-05-11 Thread Greg Snow
Here is a simple example of a permutation test on medians without pairing and different numbers of subjects in each group: sw - iris$Sepal.Width[ c(101:130, 51:70) ] group - rep( 1:2, c(30,20) ) out - replicate( 1999, { tmp - sample(group); median(sw[tmp==1]) - median(sw[tmp==2]) } )

Re: [R] Help with scatter plot

2010-05-11 Thread Greg Snow
Probably easiest using the segments function. -- 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 Behalf Of A Ezhil Sent:

Re: [R] P values

2010-05-11 Thread Greg Snow
Bak, I think that you are focusing too much on strict definitions rather than on understanding the concepts. Definitions are important to make sure that we are consistent, but understanding is more important. The main idea behind p-values and other forms of hypothesis testing is a measure of

Re: [R] Transforming sequence data into numeric values.

2010-05-07 Thread Greg Snow
Here is one possibility: tmp - sample(c('R','L'), 100, replace=TRUE) tmp2 - rle(tmp) tmp3 - sapply( 1:length(tmp2$values), function(i) paste( rep(tmp2$values[i], tmp2$lengths[i]), collapse='') ) table(tmp3) the rle function computes the run lengths, the sapply line converts those results

Re: [R] median of two groups

2010-05-07 Thread Greg Snow
Permutation tests are real tests (if done properly), but one subtle but important note: The null hypothesis being tested is that the 2 distributions are identical, the medians being equal is part of that, but the null includes more than just that assumption. -- Gregory (Greg) L. Snow Ph.D.

Re: [R] How to sort a grouped barchart?

2010-05-07 Thread Greg Snow
See my recent reply under the subject bar order using lattice barchart() Running this code before doing your plot: barley$variety - reorder(barley$variety, barley$yield, function(x) x[2] ) will cause the bars in all the plots to be reordered such that 1931 Waseca is increasing, is that what

Re: [R] for loop

2010-05-07 Thread Greg Snow
Don't use the assign function (it is not even clear what you are trying to do with it). Here is a better approach based on your code: cc - list() d - 1 for (i in data) { + cc[[d]] - table( ... + d - d + 1 + } Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

Re: [R] Expressing z t test data in a graph

2010-05-07 Thread Greg Snow
I use the ci.examp function (TeachingDemos package), but your question is so vague that I don't know if that will help you or not. If you can give more detail on what you want to accomplish then we have a better chance of being able to help. -- Gregory (Greg) L. Snow Ph.D. Statistical Data

Re: [R] P values

2010-05-06 Thread Greg Snow
Because if you use the sample standard deviation then it is a t test not a z test. -- 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-

Re: [R] P values

2010-05-06 Thread Greg Snow
We cannot be certain without knowing what the data in cw3_data.txt is, but here are some likely issues. Notice that: (1-0.7335039)*2 [1] 0.5329922 Which implies that the wolfram value comes from taking the smaller tail area and multiplying by 2, which is a common way to compute p-values for

Re: [R] bar order using lattice barchart()

2010-05-06 Thread Greg Snow
The short answer to your query is ?reorder The longer answer (or a longer answer) gets into a bit of philosophy (so feel free to go back to the short answer and skip this if you don't want to get into the philosophy, you have been warned). Let's start with the question: is the order of the

Re: [R] Converting dollar value (factors) to numeric

2010-05-06 Thread Greg Snow
This can be further simplified by combining the 2 subs into a single gsub('[$,]','',as.character(y)). This will then convert $123$35,24,,$1$$2,,3.4 into a number when you may have wanted something like that to give a warning and/or NA value. The g in gsub stands for global (meaning replace

Re: [R] Dynamic clustering?

2010-05-06 Thread Greg Snow
You could do a hierarchical clustering, then look at the height of the last combination relative to the other heights, for your data: tmp - hclust( dist( c(1,2,3,2,3,1,2,3,400,300,400) ) ) tmp2 - hclust( dist( c(400,402,405, 401,410,415, 407,412) ) ) tmp$height [1] 0 0 0 0 0 0

Re: [R] custom metric for dist for use with hclust/kmeans

2010-05-06 Thread Greg Snow
The pam function in the cluster package accepts either raw data or a dissimilarity matrix and does the same idea as kmeans. The daisy function has more options for creating the dissimilarity matrix, if what you want is not in there, you could still use it as a model for creating your own

Re: [R] T-test for loop

2010-05-06 Thread Greg Snow
Golf entry: mean( replicate( 1, t.test(rnorm(10, 0.1, 1), alternative='greater', mu=0, conf.level=0.95)$p.value 0.05)) Or mean( replicate( 1, t.test(rnorm(10, .1), a='g')$p.value .05)) or even mean( replicate( 1, t.test(rnorm(10, .1), a='g')$p. .05)) -- Gregory (Greg) L.

Re: [R] P values

2010-05-06 Thread Greg Snow
. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Joris Meys [mailto:jorism...@gmail.com] Sent: Thursday, May 06, 2010 12:26 PM To: Greg Snow Cc: Thomas Roth; level; r-help@r-project.org Subject: Re: [R] P values Correction, I understood you wrong

Re: [R] OLS Regression diagnostic measures check list - what to consider?

2010-05-05 Thread Greg Snow
First a note, while that is a nice list, I think it needs a disclaimer about only running tests that answer a meaningful question for the data/problem being studied. If all those tests are run on datasets, I would be most suspicious of those datasets which passed all the tests. Also, failing

Re: [R] help overlay scatterplot to effects plot

2010-05-05 Thread Greg Snow
We cannot reproduce your example, don't have the data (or don't know where it is if we do) and where did the allEffects function come from? If this just makes a regular plot using base graphics and not messing with the user coordinates, then you can just use the points function to add

Re: [R] generating correlated random variables from different distributions

2010-05-04 Thread Greg Snow
...@gmail.com] Sent: Sunday, May 02, 2010 1:37 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] generating correlated random variables from different distributions Thank you for your reply. The application is a Monte Carlo simulation in environmental planning. Different possible

Re: [R] Is it possible to transform a factor to a number like this way?

2010-04-30 Thread Greg Snow
This is a Frequently Asked Question, so frequently in fact that it is found in the FAQ along with a couple of answers and discussion of their merits. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message-

Re: [R] Upgrade process for libraries: can I use installed.packages on an old installation followed by install.packages in a new one

2010-04-30 Thread Greg Snow
There exists a set of batchfiles for windows (they have been mentioned several times on this list before, searching the archives should give you their location) that will move or copy the installed packages from the folder for an old R installation to the folder for your new installation

Re: [R] Interaction terms in logistic regression using glm

2010-04-30 Thread Greg Snow
The Predict.Plot and TkPredict functions in the TeachingDemos package can also help with visualizing what the model means and the effect of the different terms. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original

Re: [R] reduce size of pdf

2010-04-30 Thread Greg Snow
-Original Message- From: Nevil Amos [mailto:nevil.a...@gmail.com] Sent: Thursday, April 29, 2010 5:37 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] reduce size of pdf The file is a large number of scatterplot matrices (120pp of 4x4 matrix) the individual plots may have up

Re: [R] Curve Fitting/Regression with Multiple Observations

2010-04-30 Thread Greg Snow
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Kyeong Soo (Joseph) Kim Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations [snip] By

Re: [R] drop last character in a names'vector

2010-04-30 Thread Greg Snow
The nchar and substring functions are both vectorized, you can do something like: substring(state.name, 1, nchar(state.name)-1) And it should be much faster. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original

Re: [R] What is the best way to have R output tables in an MS Word format?

2010-04-30 Thread Greg Snow
When I work with clients who want to cut and paste to word or powerpoint I usually use the odfWeave package, set up a template file with the tables and graphs (possibly other output), then I run that through odfWeave and then use openoffice to save the results as a word file that I can send to

Re: [R] as.environment Error

2010-04-30 Thread Greg Snow
I don't know what is specifically causing the error, but I think that you will be happier in the long run (and probably short run) if you abandon the use of assign and - and instead use lists. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] understanding behavior of merge

2010-04-30 Thread Greg Snow
So does each person have multiple rows and you want to sample the set of rows? The usual approach that I take is to split them into a list, sample from the list, the put the list back together, for example: tmp1 - split(as.data.frame(state.x77), state.division) tmp2 - sample(tmp1,

Re: [R] Periodic regression - lunar percent cover

2010-04-30 Thread Greg Snow
You have the correct general idea, but it looks like lp may have already been transformed to be in the range 0-1 rather than number of days, if that is the case then you don't need to dived by 29. Again. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

<    7   8   9   10   11   12   13   14   15   16   >