Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread Greg Snow
Try this: x - c(349/077,349/074,349/100,349/117, + 340/384.2,340/513,367/139,455/128,D13/168, + 600/437,128/903,128/904) library(gsubfn) out - strapply(x, '([0-9]+)(?=/)') out [[1]] [1] 349 349 349 349 [[2]] [1] 340 340 367 455 13 [[3]] [1] 600 128 128 The strapply

Re: [R] Apply parameters to a function from a list

2011-02-04 Thread Greg Snow
Try: do.call(test,point) -- 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-bounces@r- project.org] On Behalf Of Florian Burkart Sent: Friday,

Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread Greg Snow
Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Friday, February 04, 2011 12:22 PM To: Greg Snow Cc: Dick Harray; r-help@r-project.org Subject: Re: [R] lapply, strsplit, and list

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Greg Snow
Have you looked into bioconductor? There is a separate mailing list and many packages designed for genetic analysis within the bioconductor project. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message-

Re: [R] Quadratic regression: estimating the maximizing value

2011-02-04 Thread Greg Snow
No, your approach is not correct. For one you have not taken the covariance between B and C into account, another thing is that the ratio of 2 normal random variables is not necessarily normal, in some cases it can even follow a Cauchy distribution. Also note that with only 1 degree of

Re: [R] looping variable names

2011-02-03 Thread Greg Snow
It depends on what you are assigning. A simple example of assigning the values 1 through 100: mylist - lapply(1:100, I) names(mylist) - paste('var',1:100, sep='') Or if you have 100 files named dat1.txt, dat2.txt, ..., dat100.txt and you want to read them in: mylist - lapply( paste('dat',

Re: [R] looping variable names

2011-02-03 Thread Greg Snow
It is not clear what you are trying to do, but you can have lists (or vectors) of functions and that should simplify what you are trying to do: trigfuns - list( s=sin, c=cos, t=tan ) trigfuns $s function (x) .Primitive(sin) $c function (x) .Primitive(cos) $t function (x) .Primitive(tan)

Re: [R] Hidden variables

2011-02-02 Thread Greg Snow
Create a namespace for your package, anything not exported will be hidden (though a determined person can still find it). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] arranging pie charts in a matrix layout with row/col labels

2011-02-02 Thread Greg Snow
Yes, the better way to achieve this is to not use pie charts. Look at dotplots instead. Single pie charts are hard enough to read, multiple ones in the same plot will invite comparisons that at best are hard and are often wrong and misleading. -- Gregory (Greg) L. Snow Ph.D. Statistical Data

Re: [R] looping variable names

2011-02-02 Thread Greg Snow
The best way to do this is to not create those variables in the global workspace, but to create a list with the variables in the list (you can name the list elements and access them by name or by number). With lists you can use lapply and sapply to do many of the things that you think you want

Re: [R] A question about sampling

2011-02-02 Thread Greg Snow
The apply functions are really just hidden loops, and loops have been made efficient enough that they are usually not much slower (and sometimes a bit faster) than the apply's. If you really want to use apply, then look at mapply (might need to convert the matrix to a list), or you could use

Re: [R] unequally spaced factor levels orthogonal polynomial contrasts coefficients trend analysis

2011-02-02 Thread Greg Snow
If you know the spacing between the factor levels, then why not just treat it as a numeric vector and use the poly function to create orthogonal polynomials of the numeric variable. If you have an unequally spaced ordered factor that does not lend itself to the above, then I don't see that any

Re: [R] Plot 1:1 relationship

2011-01-28 Thread Greg Snow
In addition you may want to include asp=1 and pty='s' to the plot command. -- 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-bounces@r- project.org]

Re: [R] Months in alphabetical order rather than chronological order in graph

2011-01-28 Thread Greg Snow
This would be easier if you showed us a sample of your data and what commands you are using. Without we need to guess. Probably your month variable is being turned into a factor somewhere and the default for factors is alphabetical. The best solution depends on how/where/when your months are

Re: [R] boxplot - code for labeling outliers - any suggestions for improvements?

2011-01-27 Thread Greg Snow
...@gmail.com] Sent: Thursday, January 27, 2011 10:27 AM To: Tal Galili Cc: Greg Snow; r-help@r-project.org Subject: Re: [R] boxplot - code for labeling outliers - any suggestions for improvements? My colleagues that use one of the .Net languages/libraries can make scatter plots that look

Re: [R] plot with 2 y axes

2011-01-26 Thread Greg Snow
Why do you need the line to overlay the bars? Which bars are touched by the line is just a quirk of scaling and could easily change with the scales. All the overlay does is to make it harder to read, why not jut have 2 panels aligned on the x-axis but with the line plot above the bar plot?

Re: [R] Making up a graph and its equation which better fits two groups of data

2011-01-26 Thread Greg Snow
Your faith in our ability to read your mind is apparently much higher than our actual ability to do so. What is the nature of your data? what question are you trying to answer? What type of equation do you want? What do you mean by better? Better than what? Maybe the esp package (pre-alpha)

Re: [R] boxplot - code for labeling outliers - any suggestions for improvements?

2011-01-26 Thread Greg Snow
For the last point (cluttered text), look at spread.labels in the plotrix package and spread.labs in the TeachingDemos package (I favor the later, but could be slightly biased as well). Doing more than what those 2 functions do becomes really complicated really fast. -- Gregory (Greg) L.

Re: [R] determining the order in which points are plotted

2011-01-25 Thread Greg Snow
With large numbers of points you might want to consider hexagonal binning instead of scatter plots. I don't know of any tools that both do the binning and take groups into account, but you could think it through and work something out. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

Re: [R] Extracting SSE from lm

2011-01-25 Thread Greg Snow
It is not clear what you are doing or why you are doing it. If you tell us your ultimate goal we may be able to help you find a way that does not require all the computing that you are doing. How do you get your coefficients? Are you using lm? Have you looked at the resid function? --

Re: [R] Looping with incremented object name and increment function

2011-01-21 Thread Greg Snow
This is FAQ 7.21. The real gem in the answer there is at the end where it tells you that it is easier to just use a list. If your fit1, fit2, fit3, and fit4 were elements in a list then you can just loop through the list elements, or even easier use the lapply function to loop through the

Re: [R] function of probability for normal distribution

2011-01-20 Thread Greg Snow
-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of JClark Sent: Wednesday, January 19, 2011 4:04 PM To: r-help@r-project.org Subject: Re: [R] function of probability for normal distribution Dear Greg Snow, I'm a biologist trying to write a mathematical formula for a doubly

Re: [R] R scheduling request

2011-01-19 Thread Greg Snow
- From: Alessandro Oggioni [mailto:a.oggi...@ise.cnr.it] Sent: Tuesday, January 18, 2011 6:33 AM To: Greg Snow Cc: r-help Subject: Re: [R] R scheduling request Many thanks Greg! I try to use tcltk2 and tclTaskSchedule function but in argument expr is possible to insert a R script

Re: [R] Barplot and line x-axis positions

2011-01-19 Thread Greg Snow
You can use the updateusr function in the TeachingDemos package to get them to match. Sent from my iPod On Jan 18, 2011, at 10:05 AM, Andy Aldersley ajalders...@hotmail.co.uk wrote: Hello all, Hoping that there is a fairly simple solution to my query... I'm trying to overlay a

Re: [R] Problems with TeachingDemos package

2011-01-17 Thread Greg Snow
What happens if you just load the R2wd package then run wdGet() yourself? Also what OS, version of R, version of TeachingDemos, and version of R2wd are you using? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original

Re: [R] R scheduling request

2011-01-17 Thread Greg Snow
You could write a batch file and then have your OS schedule to run R on the batch file whenever you want (see Rscript for one approach of running the batch). Inside of R you can use Sys.sleep to wait a certain amount of time before running the next command. If you load the tcltk2 package then

Re: [R] Problems with TeachingDemos package

2011-01-14 Thread Greg Snow
Do you have R2wd installed and working? Is the Rcomm system working for you? Do you receive any errors or warnings? I just tested it using the R gui under windows and when I do wdtxtStart() without any word documents open a new one starts and the output gets sent there. So there must be

Re: [R] Unexpected behaviour of write.csv - read.csv

2011-01-13 Thread Greg Snow
Another option to consider is instead of save/load to use save/attach. You save the data, but then instead of loading it back into the global environment you use the attach function to attach it in a new environment (position 2 on the search list by default). It will be attached with the same

Re: [R] send commands from script to console

2011-01-13 Thread Greg Snow
In the windows GUI cntrl+r will send the current line or selection to the command line. There is not a similar sequence to send from the command line to a script, but you can use the history function to create a new script from the recent commands (you can set how many). Another option is

Re: [R] What does the shell() command do?

2011-01-13 Thread Greg Snow
This depends partly on what operating system you are using (the posting guide suggests including this type of information). But basically shell will pass a command to the operating system (or a shell for unix Oss) for it to run the command. So in your example it is expecting to run dir/b on a

Re: [R] 2d plot with modification of plotting symbol to indicate third dimension.

2011-01-12 Thread Greg Snow
Look at the symbols function for some options of doing what you suggest (you can also do a search for bubble plot for a couple of other implementations). If you want to go a bit further than what symbols does for you then look at the my.symbols function in the TeachingDemos package. --

Re: [R] navigating in lists

2011-01-12 Thread Greg Snow
sapply(test, '[[', 1) a b c 1 3 5 -- 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 Jannis Sent: Wednesday,

Re: [R] Assumptions for ANOVA: the right way to check the normality

2011-01-11 Thread Greg Snow
From: Frodo Jedi [mailto:frodo.j...@yahoo.com] Sent: Monday, January 10, 2011 5:44 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] Assumptions for ANOVA: the right way to check the normality Dear Greg, first of all thanks for your reply. And I add also many thanks to all

Re: [R] Assumptions for ANOVA: the right way to check the normality

2011-01-10 Thread Greg Snow
. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Frodo Jedi [mailto:frodo.j...@yahoo.com] Sent: Saturday, January 08, 2011 3:20 AM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] Assumptions for ANOVA: the right way

Re: [R] write.table equivalent for lists?

2011-01-10 Thread Greg Snow
How about dput and dget in the base package? -- 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 Rainer M Krug

Re: [R] From vector to a step function

2011-01-10 Thread Greg Snow
?approxfun -- 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 Alaios Sent: Monday, January 10, 2011 9:43 AM To:

Re: [R] debug biglm response error on bigglm model

2011-01-10 Thread Greg Snow
Not sure, but one possible candidate problem is that in your simulations one iteration ended up with fewer levels of a factor than the overall dataset and that caused the error. There is no recode function in the default packages, there are at least 6 recode functions in other packages, we

Re: [R] Assumptions for ANOVA: the right way to check the normality

2011-01-07 Thread Greg Snow
-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Ben Ward Sent: Thursday, January 06, 2011 2:00 PM To: r-help@r-project.org Subject: Re: [R] Assumptions for ANOVA: the right way to check the normality On 06/01/2011 20:29, Greg Snow wrote: Some would argue to always use the kruskal

Re: [R] Problem with 2-ways ANOVA interactions

2011-01-07 Thread Greg Snow
06, 2011 2:39 PM To: Greg Snow; r-help@r-project.org Subject: Re: [R] Problem with 2-ways ANOVA interactions Dear Greg, many many thanks, still have a doubt: Before I wrongly thought that if I do the analysis anova(response ~ stimulus*condition) I would have got the comparison between the same

Re: [R] Problem with 2-ways ANOVA interactions

2011-01-06 Thread Greg Snow
You really need to spend more time with a good aov textbook and probably a consultant that can explain things to you face to face. But here is a basic explanation to get you pointed in the right direction: Consider a simple 2x2 example with factors A and B each with 2 levels (1 and 2). Draw

Re: [R] Assumptions for ANOVA: the right way to check the normality

2011-01-06 Thread Greg Snow
Remember that an non-significant result (especially one that is still near alpha like yours) does not give evidence that the null is true. The reason that the 1st 2 tests below don't show significance is more due to lack of power than some of the residuals being normal. The only test that I

Re: [R] Splitting a Vector

2011-01-06 Thread Greg Snow
I think that you are looking for the 'resid' and 'fitted' functions, these will give you the residuals and fitted values from an lm object (that added together gives the original response but are orthogonal to each other). Those values can then be assigned to a data frame or used by

Re: [R] Assumptions for ANOVA: the right way to check the normality

2011-01-06 Thread Greg Snow
training and experience. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 From: Frodo Jedi [mailto:frodo.j...@yahoo.com] Sent: Thursday, January 06, 2011 12:57 PM To: Greg Snow; r-help@r-project.org Subject: Re: [R] Assumptions

Re: [R] Problem with 2-ways ANOVA interactions

2011-01-06 Thread Greg Snow
See inline From: Frodo Jedi [mailto:frodo.j...@yahoo.com] Sent: Thursday, January 06, 2011 12:37 PM To: Greg Snow; r-help@r-project.org Subject: Re: [R] Problem with 2-ways ANOVA interactions Dear Greg, thanks so much, I think that now I have understood. Please confirm me this reading

Re: [R] need help for chi-squared test

2011-01-06 Thread Greg Snow
David, I think the poster wants to use one of the columns as x and the other as y, ignoring the remaining columns. If that is the case then he/she needs to read the section in Introduction to R on subsetting data frames. I agree that the output so far is meaningless, from the degrees of

Re: [R] get() within a command, specifically lmer

2011-01-05 Thread Greg Snow
Formula syntax is different from regular syntax, it is quoted and not evaluated in the same way as regular commands (otherwise operations like '+' and '-' would do very different things). For what you are trying to do, I would suggest creating the formula as a string using paste or sprintf,

Re: [R] Comparing fitting models

2011-01-05 Thread Greg Snow
Just do anova(fit3, fit1) This compares those 2 models directly. -- 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

Re: [R] Comparing fitting models

2011-01-05 Thread Greg Snow
[mailto:frodo.j...@yahoo.com] Sent: Wednesday, January 05, 2011 2:46 PM To: Greg Snow; r-help@r-project.org Subject: Re: [R] Comparing fitting models Dear Greg, thanks for your answer, but that is not the point. My question is another: from the data in the R prompt how can I compare the models? I don

Re: [R] Help with For instruction

2011-01-04 Thread Greg Snow
If you had followed David's advice and put everything into a list or other structure instead of using the assign function (see fortune(236)) then you could just access the list element instead of needing get. In the long run (or even medium and short run) life will be much easier for you if

Re: [R] Page eject and clearing the console

2011-01-04 Thread Greg Snow
Well the things most like cat('\n') for starting a new page would be cat('\013') or cat('\014') (vertical tab and form feed), however on all the terminals I tried they don't do anything since page is not a concept on a terminal. However if you outputted one of those into a file and interpreted

Re: [R] levelplot blocks size

2010-12-28 Thread Greg Snow
Here is a basic example: tmp.df - expand.grid( x= 1:100, y=1:100 ) tmp.df$z - with(tmp.df, x+2*y) library(lattice) levelplot( z ~ x + y, data=tmp.df ) tx2 - with(tmp.df, cut(x, seq(0.5, 100.5, 10) ) ) ty2 - with(tmp.df, cut(y, seq(0.5, 100.5, 20) ) ) tmp.df2 - aggregate(tmp.df, list( tx2, ty2

Re: [R] levelplot blocks size

2010-12-27 Thread Greg Snow
Look at the functions cut, findInterval, tapply, and aggregate. Sent from my iPod On Dec 26, 2010, at 4:34 PM, jonathan j...@than.biz wrote: Thanks for your advice, but my data is not decimals, so I don't need to round the values. Instead, what I need to really do is group the values into

Re: [R] read.data? without separator

2010-12-27 Thread Greg Snow
Would the read.fwf function work for you? -- 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 Fror Sent: Sunday,

Re: [R] Removing rows with earlier dates

2010-12-24 Thread Greg Snow
Whenever a task calls for breaking a data object into pieces, operate on the pieces, then put it back together, then think about using the plyr package. Sent from my iPod On Dec 24, 2010, at 6:58 AM, Ali Salekfard salekf...@googlemail.com wrote: Hi all, I'm new to the list but have

Re: [R] Poor quality plotting symbols in Windows metafile

2010-12-22 Thread Greg Snow
You could use the my.symbols function from the TeachingDemos package to create your own versions of the symbols that you want. Using the ms.polgon function with it will draw polygons (which can simulate most of the symbols you want) and should show up vectorized in metafile formats. --

Re: [R] Please help with one problem

2010-12-17 Thread Greg Snow
The clt.examp function in the TeachingDemos package shows the effect of sample size on approximate normality for 4 different distribution of which the uniform distribution is one. This may do what you want, or you could start with that code and modify it to do what you want. If not then try

Re: [R] box-and-whisker plots based on summary not data

2010-12-17 Thread Greg Snow
Can you show us what you tried and how it differs from what you expect? The boxplot function calculates the summaries, then calls the bxp function to do the plotting. So you should be able to create a list similar to what boxplot does that you can then pass directly to bxp. If you have tried

Re: [R] sink output

2010-12-17 Thread Greg Snow
The sink function does not capture the output, but the txtStart (and friends) function(s) in the TeachingDemos package can capture both input and output (using etxtStart instead allows for coloring and including of graphs). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain

Re: [R] lower/upper case question

2010-12-17 Thread Greg Snow
See ?toupper for the toupper, tolower, chartr, and casefold functions. -- 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

Re: [R] Adding graphs to a map

2010-12-16 Thread Greg Snow
The symbols function can add symbols (including boxplot style boxes) to an existing plot (your map for example). The subplot function in the TeachingDemos package can add entire plots (including boxplots) to an existing plot. Both the above work with base graphs only, not grid (lattice,

Re: [R] How to save play back an entire R session?

2010-12-16 Thread Greg Snow
To just save a copy of all the commands issued you can use the savehistory function (this is documented on the same page as history, so David's answer would have lead you there as well). If you want to save all the outputs from you session you can use the sink function. You can save a

Re: [R] Question

2010-12-14 Thread Greg Snow
What about thoughtless un-nasty comments? I would suggest the original poster (and others thinking that they want to do normality testing) read the help page for SnowsPenultimateNormalityTest in the TeachingDemos package, which I think agrees mostly with what Bert wrote below (though it goes

Re: [R] colour-plot of point intensities?

2010-12-14 Thread Greg Snow
Look at the hexbin package (bioconductor). -- 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 Matthew Vernon

Re: [R] from table to matrix

2010-12-14 Thread Greg Snow
If the goal is to produce a filled contour plot, then look at the levelplot function in the trellis package, it takes the data in the form that you already have it, no need to transform. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] How to print colorful R output??

2010-12-13 Thread Greg Snow
One possibility, though not as simple as what you ask for, is to use etxtStart and friends from the TeachingDemos package. Other possibilities include using gui interfaces to R, possibilities (though they may do more than you ask, and color might be different) include emacs/ess; vim; jgr; and

Re: [R] Browsing through a dataframe page by page (like with shell command more)

2010-12-13 Thread Greg Snow
For data frames the best is probably the View function (note capitol V) which opens the data frame in a spreadsheet like window that you can scroll through. For more complicated, list or list-like objects, look at TkListView in the TeachingDemos package. For more general investigation of data

Re: [R] Odp: 2 plots with different scales in the same graphical window

2010-12-09 Thread Greg Snow
Just be sure to read the note on the help page for twoord.plot, then reread it, then consider alternatives (including the one mentioned in the note), then if you still want to do this, follow the advice in the note. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain

Re: [R] Barplot with Independent Lines Y axis

2010-12-09 Thread Greg Snow
Look at the twoord.plot function in the plotrix package, but be sure to read the note on the help page, then reread it and take its advice if you decide to stick with this type of plot. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] prevent line breaks with sink()

2010-12-09 Thread Greg Snow
You can set options(width= ) with a sufficiently large number and you should not see the wrapping. If you don't want wrapping or the initial [1], then consider using cat instead of print (or implied print), cat can even bypass the need for sink if you just want to send vector contents to a

Re: [R] Barplot with Independent Lines Y axis

2010-12-09 Thread Greg Snow
: Rodrigo Aluizio [mailto:r.alui...@gmail.com] Sent: Thursday, December 09, 2010 12:27 PM To: Greg Snow; 'R Help' Subject: RES: [R] Barplot with Independent Lines Y axis Thank you for the function suggestion, works nicely for complete data vectors. Just another question. When using

Re: [R] Projecting data on a world map using long/lat

2010-12-09 Thread Greg Snow
The symbols function can add circles to an existing plot with the diameter based on another variable. You may need to project points if you draw a map with a projection. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] read.table and factors

2010-12-08 Thread Greg Snow
Yes, just set the colClasses argument to read.table (this will also tend to speed up the reading, though only noticeable for really big files). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] please show me simple example how to plot

2010-12-07 Thread Greg Snow
Like Peter says, this sounds like loess, there are examples on the help page for scatter.smooth, you could also do this with lattice graphics using type=c('p','smooth'), or ggplot2 graphics (probably something like geom_smooth or geom_loess, I don't know ggplot2 that well yet). If you want to

Re: [R] how to get vector of data from line ?

2010-12-07 Thread Greg Snow
There are a few different options depending on what you are trying to do. If you just need some data pairs (for plotting for example), then the return from density has a vector of x's and a vector of y's, just use those. If you have specific x values that you need the height at and they follow

Re: [R] Efficient way to use data frame of indices to initialize matrix

2010-12-07 Thread Greg Snow
tmpdf - data.frame( x = c(1,2,3), y=c(2,3,1), a=c(10,20,30) ) mymat - matrix(0, ncol=3, nrow=3) mymat[ as.matrix(tmpdf[,c('x','y')]) ] - tmpdf$a -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

Re: [R] getting R to download data

2010-12-07 Thread Greg Snow
If you don't want to use the OS (windows does have a scheduling service) then I would suggest using the tools in tcltk and possibly tcltk2 (tclTaskSchedule). They can have a delayed thing in the background so you can still use the R console, but the download will happen automatically. --

Re: [R] LaTeX, MiKTeX, LyX: A Guide for the Perplexed

2010-12-07 Thread Greg Snow
See inline below -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Paul Miller Sent: Tuesday, December 07, 2010 4:29 PM To: r-help@r-project.org Subject: [R] LaTeX, MiKTeX, LyX: A Guide for the Perplexed Hello Everyone,

Re: [R] less than full rank contrast methods

2010-12-06 Thread Greg Snow
Have you tried setting singular.ok=TRUE in the call to lm? This will start with the full set of contrasts, but only fit those that it is able to. Otherwise you can set specific contrasts or subsets using the C (note case) or contrasts functions. -- Gregory (Greg) L. Snow Ph.D. Statistical

Re: [R] Suitable test for ordinal variable vs continuous variable trend

2010-12-02 Thread Greg Snow
There are many possibilities depending on what you are really looking for (strict increasing, vs. increasing or constant, vs. general trend, etc.) I would start with a plot of the data, that may result in a significant interocular concussion test and will at least help you understand what is

Re: [R] Sequence for repeated numbers

2010-12-01 Thread Greg Snow
Try this: id - 1:20 grade - c(4,4,4,5,5,7,7,7,7,8,8,8,9,9,9,9,9,10,10,10) sequence - ave( id, grade, FUN=seq ) # if grade is not sorted grade2 - sample(grade) sequence2 - ave( id, grade2, FUN=seq ) cbind( grade2, sequence2 ) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

Re: [R] Getting user input without hitting enter

2010-11-24 Thread Greg Snow
This is a user interface issue. The standard command line user interfaces all wait for the user to hit enter before sending the information to the parser, so this cannot be done using the standard command line interface. You could rewrite the source code, but that is probably overkill. The

Re: [R] Par() Variables, Timing, and Resizing

2010-11-24 Thread Greg Snow
I would suggest using the layout function instead of the mfcol and pin with par. The layout function gives you more control of the size of areas to be plotted to. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original

Re: [R] overlay histograms on map at map coordinates

2010-11-23 Thread Greg Snow
Look at the subplot function in the TeachingDemos package. -- 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] how to add frequencies to barplot

2010-11-23 Thread Greg Snow
I would suggest reading the discussion (all the posts) starting at: http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22858.html This gives reasons for not doing what you are asking along with some alternatives. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

Re: [R] save a regression model that can be used later

2010-11-23 Thread Greg Snow
One possibility for what is happening is that when you load the object it does not automatically load the package as well, so you get an error when working with the object. Try loading lme4 package in a new session, then load the saved object and see if things work for you. -- Gregory (Greg)

Re: [R] how do remove those predictor which have p value greater than 0.05 in GLM?

2010-11-23 Thread Greg Snow
What Frank was trying to tell you is that the p-values don't have much meaning if you do stepwise regression (sometimes they are worse than useless). The p-values are computed based on certain assumptions, once you remove a variable because it is Not Significant, then recompute, those

Re: [R] Sampling from multi-dimensional kernel density estimation

2010-11-23 Thread Greg Snow
Generating new data from a kernel density estimate is equivalent to choosing a point from your data at random, then generating a point from your kernel centered at the chosen point. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] How to produce a graph of glms in R?

2010-11-22 Thread Greg Snow
Look at Predict.Plot (and possibly TkPredict) in the TeachingDemos package. -- 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]

Re: [R] Bold plot axis

2010-11-19 Thread Greg Snow
Often when things look to small/thin it is because the plot is being created at too large a size, then shrunk. How are you creating the graph? How are you transferring it? Try creating the graph at the exact size that it will be when used in the powerpoint, then without needing to resize

Re: [R] aspect ratio 1 and blank space

2010-11-18 Thread Greg Snow
Look at the squishplot function in the TeachingDemos package, it may do what you want, or if not quite then you could perhaps tweak the code to include the values you want and create the correct aspect ratio. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

Re: [R] how exactly does 'identify' work?

2010-11-18 Thread Greg Snow
I think that your problem comes from a misunderstanding. The general rule is that you give the plot command 2 vectors, x and y (though you can give it the vectors separately, or together in a list or matrix). If you give plot only a single vector then it will use this as the y vector and use

Re: [R] how exactly does 'identify' work?

2010-11-18 Thread Greg Snow
Did you read the help page for qqnorm? The return value has the x and y coordinates used, you can just do something like: tmp - qqnorm( resid(test.lm) ) identify(tmp, , names(resid(test.lm)) ) Or the plot.lm function has an argument id.n that automatically labels the n most extreme values:

Re: [R] how exactly does 'identify' work?

2010-11-18 Thread Greg Snow
-help-boun...@r- project.org] On Behalf Of Greg Snow Sent: Thursday, November 18, 2010 1:11 PM To: casperyc; r-help@r-project.org Subject: Re: [R] how exactly does 'identify' work? Did you read the help page for qqnorm? The return value has the x and y coordinates used, you can just do

Re: [R] plot vs print ??

2010-11-17 Thread Greg Snow
Well, assuming this refers to the histogram function in the lattice package, looking at the code for print.trellis shows that the default behavior is to call plot.trellis with the same arguments. So unless you change the default behavior, there really is no difference between printing and

Re: [R] Need help with pointLabels()

2010-11-15 Thread Greg Snow
What package is pointLabel (or is it pointLabels) in? giving a reproducible example includes stating packages other than the standard ones. What you are trying to do is not simple for general cases, some tools work better on some datasets, but others work better on other datasets. Some other

Re: [R] Defining functions inside loops

2010-11-15 Thread Greg Snow
This is a side effect of the lazy evaluation done in functions. Look at the help page for the force function for more details and how to force evaluation and solve your problem. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] How to plot effect of x1 while controlling for x2

2010-11-15 Thread Greg Snow
Look at Predict.Plot (and TkPredict) from the TeachingDemos package. -- 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

Re: [R] Time Delay / Wait

2010-11-12 Thread Greg Snow
In addition to Michael's answer, look at the ?par help page and look at the ask argument, you can use this to have the graphics device wait for you to click before starting a new plot. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] Merge postscript files into ps/pdf

2010-11-12 Thread Greg Snow
The best approach if creating all the files using R is to change how you create the graphs so that they all go to one file to begin with (as mentioned by Joshua), but if some of the files are created differently (rgl, external programs), then this is not an option. One external program that

Re: [R] Kolmogorov Smirnov Test

2010-11-11 Thread Greg Snow
necessary, so is it incorrect to have the same standard deviation too? I need to go back and read on the K-S test to see what the appropriate constraints are before bothering anyone for more help. Sorry, I thought I had it. Thanks again, kbrownk On Nov 11, 12:40 am, Greg Snow greg.s

<    4   5   6   7   8   9   10   11   12   13   >