Re: [R] Proper Paste for Data Member

2009-07-15 Thread Greg Snow
The dollar sign ($) is a magical shortcut for the [[ subset operator (yes the doubling is intentional) for accessing parts of lists/data frames/etc. When you try to use magical shortcuts for purposes beyond what they were designed for, you get the computer equivalent of turning yourself into a

[R] Error in simulation R-code

2009-07-15 Thread Steve Hong
Dear List, I have got error message when I run the R-code. Can anyone has a suggestion? v.code <- df.bm7[,c(10:31)]; v.code[1:3,] names(v.code) CM = v.code # variable binomial code sim.sp <- function(data,CM,n,N) { C <- matrix(rep(NA,N),ncol=1) for(i in 1:N) { j <- n x

Re: [R] Help with averaging

2009-07-15 Thread David Winsemius
You might want to look at the help page for: ?mean and pay close attention to the na.rm= argument/ On Jul 15, 2009, at 12:51 PM, Amit Patel wrote: Hi I am using the following script to average a set of data 0f 62 columns into 31 colums. The data consists of values of ln(0.01) or -4.6051

[R] FW: Package submission to CRAN

2009-07-15 Thread Gates, Michael
Please Note: Email below was bounced back (rejected by the Packages email list moderator), so please do not ask me to submit to r-packa...@r-project.org. Members, I recently submitted my first package to the submissions ftp site on CRAN (7.3.09). The package ha

[R] Substituting a user-defined function for a standard function in graphics

2009-07-15 Thread John Kolassa
Dear R-help readers, I'm trying to substitute my own version of plot.default, in order to capture low-level graphics input for further manipulation. I seem to be having difficulties getting the versions of functions that I intend to use called at the right places. Specifically, I have a

[R] Axes origins and labeling

2009-07-15 Thread Marlin Keith Cox
I have re-labeled tick marks on the x axis. The problem is that by using axes=FALSE, the axes disappears and when they are called back using axis(side=1)..etc. the axis on sides 1 and 2 do not meet at the bottom left corner of the graph. I would also like to have the 3rd and 4th axes in there as

[R] Error in simulation R-code

2009-07-15 Thread Steve Hong
Dear List, I have got error message when I run the R-code. I guess this happened when observation(s) has no neighborhood at specified distance. Is there any way/R-code to ignore one without neighborhood and proceed the simulation? v.code <- df.bm7[,c(10:31)]; v.code[1:3,] names(v.code) CM = v.co

Re: [R] Comprehensive power analysis/sample size package in R?

2009-07-15 Thread Greg Snow
I don't know of a single package that is comparable to PASS, but the R system itself is the most comprehensive tool available for power and sample size computations. For the simple cases you already found the pwr package, there are also some power functions in the stats package and in some othe

Re: [R] FW: Package submission to CRAN

2009-07-15 Thread Dirk Eddelbuettel
On 15 July 2009 at 13:34, Gates, Michael wrote: | Please Note: Email below was bounced back (rejected by the Packages email list moderator), so please do not ask me to submit to r-packa...@r-project.org. | | | Members, | I recently submitted my first package to

Re: [R] Comprehensive power analysis/sample size package in R?

2009-07-15 Thread Frank E Harrell Jr
Greg Snow wrote: I don't know of a single package that is comparable to PASS, but the R system itself is the most comprehensive tool available for power and sample size computations. For the simple cases you already found the pwr package, there are also some power functions in the stats packa

Re: [R] Axes origins and labeling

2009-07-15 Thread Greg Snow
Look at the box function, or use xaxt='n' and/or yaxt='n' rather than axes=FALSE. 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 [mailto:r-help

Re: [R] Comprehensive power analysis/sample size package in R?

2009-07-15 Thread Mitchell Maltenfort
It's not R nor is it open source, but G*Power 3 is free: http://www.psycho.uni-duesseldorf.de/abteilungen/aap/gpower3/ Apparently the new version (for Windows -- Mac version is lagging) includes Poisson and logistic regression. On Tue, Jul 14, 2009 at 3:04 PM, wrote: > Dear all, > my colleag

Re: [R] Substituting a user-defined function for a standard function in graphics

2009-07-15 Thread David Winsemius
On Jul 15, 2009, at 4:25 PM, John Kolassa wrote: Dear R-help readers, I'm trying to substitute my own version of plot.default, in order to capture low-level graphics input for further manipulation. I seem to be having difficulties getting the versions of functions that I intend to us

Re: [R] Comprehensive power analysis/sample size package in R?

2009-07-15 Thread Tobias Verbeke
Frank E Harrell Jr wrote: Greg Snow wrote: I don't know of a single package that is comparable to PASS, but the R system itself is the most comprehensive tool available for power and sample size computations. For the simple cases you already found the pwr package, there are also some power f

Re: [R] Differing Variable Length Inconsistencies in Random Effects/Regression Models

2009-07-15 Thread Mark Difford
Hi Aditi, Parts of _your_ code for the solution offered by Jerome Goudet are wrong; see my comments. > famfit<-lmer(peg.no~1 + (1|family), na.action=na.omit, vcdf) ## use: > na.action=na.exclude > resfam<-residuals(famfit) > for( i in 1:length(colms)) + { + print ("Marker", i) + regfam<-ab

[R] Simulation code error

2009-07-15 Thread Steve Hong
Dear List, I have some problem with my simulation code. Here is output from R: > sim.sp <- function(data,CM,n,N) + { + C <- matrix(rep(NA,N),ncol=1) + for(i in 1:N) + { + j <- n + xx <- which(colSums(CM[j,])==1) + V <- names(xx) + V <- paste(V, collapse="+") + V <- paste("SBA~", V) + rd <- round

Re: [R] How to deploy statistical models built in R in real-time?

2009-07-15 Thread Guazzelli, Alex
Hi Allan, Thanks a lot for your reply. I am glad you are an advocate for PMML. I found PMML in 2004 and was fascinated by the idea of representing my models in a standard language that can actually be moved around different platforms. PMML started small, but is now a mature standard. The

Re: [R] spreadsheet-style autoupdating

2009-07-15 Thread Charles C. Berry
On Wed, 15 Jul 2009, Liviu Andronic wrote: Hello Patrick, On 7/15/09, Patrick Burns wrote: How about something along the lines of: apply(twocolumns, 1, any) This efficiently solves the first part of my question. I will probably content myself with issuing this command each time I update on

Re: [R] Differing Variable Length Inconsistencies in Random Effects/Regression Models

2009-07-15 Thread Mark Difford
Perhaps I should have added the following: To see that it "works," run the following: famfit<-lmer(peg.no~1 + (1|family), na.action=na.exclude, vcdf) resfam<-residuals(famfit) for( i in 1:length(colms)) { print(coef(lm(resfam~colms[,i]))) } Regards, Mark. A Singh wrote: > > > Dear All, >

Re: [R] Simulation code error

2009-07-15 Thread Roger Bivand
This message is one of a number of identical copies, also cross-posted to R-sig-geo, and in fact with an obvious solution that the author gives at the end. The thread will be continued on R-sig-geo. Cross posting is advised against expressly in e.g. http://en.wikipedia.org/wiki/Crossposting, and

Re: [R] Substituting a user-defined function for a standard function in graphics

2009-07-15 Thread Duncan Murdoch
On 15/07/2009 4:25 PM, John Kolassa wrote: Dear R-help readers, I'm trying to substitute my own version of plot.default, in order to capture low-level graphics input for further manipulation. I seem to be having difficulties getting the versions of functions that I intend to use called at t

[R] Select set of variables with strongest correlation

2009-07-15 Thread nyk
What would be a good method to find the subset of columns of a data matrix (with about 200 rows and columns) that has the strongest correlation to one other column? I tried testing sub-matrices with random sets of 10 columns selected using lm(x ~submtrx) and comparing the r^2 values. But isn't the

[R] abline(v= x) in plot with time formated xaxis not working

2009-07-15 Thread F!!
Hi, I try to create a vertical line in my plot, which has a xaxis comprising time formated data. This is what I tried: y<-152833 x<-strptime(y, format="%H%M%S") abline(v=x, col="red") for some reason, it doesn't work and no error msg is displayed... I hope

Re: [R] searching for elements

2009-07-15 Thread Moshe Olshansky
?outer --- On Thu, 16/7/09, Chyden Finance wrote: > From: Chyden Finance > Subject: [R] searching for elements > To: r-help@r-project.org > Received: Thursday, 16 July, 2009, 3:00 AM > Hello! > > For the past three years, I have been using R extensively > in my PhD program in Finance for stat

Re: [R] Axes origins and labeling

2009-07-15 Thread S Ellison
Since you;re already specifying the axis tick locations for the x-axis any ylim for y, one way of dealing with it is to give the axes an extra tick at each end: Instead of axis(side=1, at=c(1,2,3,4), labels=gut) use axis(side=1, at=0:5, labels=gut) Similarly for axis(2), use axis(2, at=seq(0,250,

[R] axis label config mgp

2009-07-15 Thread Marlin Keith Cox
I have long axis labels (8units) on the x axis and 2 unit number labels on the y axis. I need to move the x axis title without moving the y axis title. I have used mgp=c(title, label and line), but mgp moves both the x and y titles. The following puts the y axis title way way out to the left. An

Re: [R] GLM Gamma Family logLik formula?

2009-07-15 Thread Ben Bolker
jseabold wrote: > > Hello all, > > I was wondering if someone can enlighten me as to the difference > between the logLik in R vis-a-vis Stata for a GLM model with the gamma > family. > > Stata calculates the loglikelihood of the model as (in R notation) > some equivalent function of > > -1/s

Re: [R] GLM Gamma Family logLik formula?

2009-07-15 Thread Skipper Seabold
On Wed, Jul 15, 2009 at 8:45 PM, Ben Bolker wrote: > > > > jseabold wrote: >> >> Hello all, >> >> I was wondering if someone can enlighten me as to the difference >> between the logLik in R vis-a-vis Stata for a GLM model with the gamma >> family. >> >> Stata calculates the loglikelihood of the mod

[R] duplicate data points on a line graph

2009-07-15 Thread Carl Witthoft
If you want to take the second approach, it can be relatively easily generalized by calculating the cex values based on the count of ordered pairs in the original dataset. Here's a data set: > xy x y [1,] 1 4 [2,] 1 5 [3,] 2 3 [4,] 3 3 [5,] 4 5 [6,] 5 2 [7,] 1 4 [8,] 2 3 Here's the same

[R] evaluate sum of sum

2009-07-15 Thread Roslina Zakaria
Hi R-users, Could anybody show me how to write a code to evaluate sum(z[i] + sum(k[j]*(z[i])^(k[j])), i=1 to 4, j=0 to infinity) ? Thank you so much for any help given. [[alternative HTML version deleted]] __ R-help@r-project.org mail

Re: [R] abline(v= x) in plot with time formated xaxis not working

2009-07-15 Thread David Winsemius
On Jul 15, 2009, at 5:25 PM, F!! wrote: Hi, I try to create a vertical line in my plot, which has a xaxis comprising time formated data. This is what I tried: y<-152833 x<-strptime(y, format="%H%M%S") abline(v=x, col="red") But, but, but ... where is your plot functi

[R] Help with RODBC connection to multiple MS SQL Sever databases

2009-07-15 Thread Chris Anderson
I'm trying to pull data from multiple MS SQL Sever databse in R. I can access the databases one at a time, but the tables are to large to pull the entire tables then join then in R. So I need to do a SQL join that will join the tables from the each of the databases. How do I combine the connecti

[R] Extract pairs (rowname, columname) from a matrix where value is 0

2009-07-15 Thread Alberto Lora M
Dear sir, I have a matrix like a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a F1 F2 F3 A1 0 4 5 A2 2 0 8 A3 0 6 0 I want to extract all pairs (rownames, columnames) from which the value in the matrix is 0 The result should be

[R] how to group the output of aov by a variable?

2009-07-15 Thread Ayelet Landau
Hi there, I am new to R and have what seems to be a simple question. I put together the following commands in order to run an anova on multiple different variables at once: for(i in 10:20) {subj <- mydata[ which(lupi2$subject=='mas'),] cat("ANOVA for variable:", names(subj[i])) pri

[R] Count the number of occurences in ranges

2009-07-15 Thread torpedo fisken
I got a vector of probabilities like, probs<-c(0.001,0.5,0.02,1,.) Is there any nice and easy builtin function to get the number of occurences within some specified probabality range. Like with 2% it would be occur[1] = sum(probs[probs>0&probs<0.02]) occur[2] = sum(probs[probs>0.02&probs<0.04

Re: [R] Count the number of occurences in ranges

2009-07-15 Thread Jorge Ivan Velez
Dear torpedo, Take a lookat ?cut and its examples. HTH, Jorge On Wed, Jul 15, 2009 at 11:26 PM, torpedo fisken wrote: > I got a vector of probabilities like, > probs<-c(0.001,0.5,0.02,1,.) > > Is there any nice and easy builtin function to get the number of > occurences within some specifi

Re: [R] evaluate sum of sum

2009-07-15 Thread Rolf Turner
On 16/07/2009, at 2:30 PM, Roslina Zakaria wrote: Hi R-users, Could anybody show me how to write a code to evaluate sum(z[i] + sum (k[j]*(z[i])^(k[j])), i=1 to 4, j=0 to infinity) ? No. No-one can. It is conceptually impossible. (a) Computers cannot do infinite sums; they can only do fin

[R] Problem using strptime

2009-07-15 Thread Alon Ben-Ari
Hello I am trying to read a date and time from a file and convert them to POSIXct using strptime() the dates are stored in t which is a factor This the code I am using to illustarte > t[1] [1] 07/14/2009 13:41:00 10 Levels: 07/14/2009 13:41:00 07/14/2009 13:42:00 ... 07/15/2009 07:12:00 > a=t[1]

Re: [R] Problem using strptime

2009-07-15 Thread Gabor Grothendieck
Check out: http://article.gmane.org/gmane.comp.lang.r.general/155702 On Wed, Jul 15, 2009 at 11:45 PM, Alon Ben-Ari wrote: > Hello > I am trying to read a date and time from a file and convert them to POSIXct > using strptime() > the dates are stored in t which is a factor > This the code I am us

[R] Question on importing large dataset (1.4GB) into R-Bioconductor

2009-07-15 Thread Anqi
To whom it may concern, I am a student from Peking University, China. I am currently doing some microarray data analysis research with Bioconductor package of R. Problem arises when I try to import into R my dataset which contains 109 samples (total size more than 1.4 GB). The memory limit o

Re: [R] Extract pairs (rowname, columname) from a matrix where value is 0

2009-07-15 Thread David Winsemius
On Jul 15, 2009, at 7:15 PM, Alberto Lora M wrote: Dear sir, I have a matrix like a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a F1 F2 F3 A1 0 4 5 A2 2 0 8 A3 0 6 0 I want to extract all pairs (rownames, columnames) from whi

Re: [R] Extract pairs (rowname, columname) from a matrix where value is 0

2009-07-15 Thread Jorge Ivan Velez
Dear Alberto, Try this: # colnames and rownames cn <- colnames(a) rn <- rownames(a) # the index ind <- which(a==0, arr = TRUE) # the result data.frame( res = apply(ind, 1, function(x) paste(rn[x[1]],",", cn[x[2]], sep ="") )

[R] error for installation

2009-07-15 Thread jlfmssm
I used packages 'fields". when I load workspace again, then do installation again. I get the following error. I read R for Windows FAQ (4.8 see below), but I still can't figure it out. Does anyone can help me out? Thanks, jlm > install.packages("fields",repos="http://streaming.stat.iastate.ed

Re: [R] Extract pairs (rowname, columname) from a matrix where value is 0

2009-07-15 Thread Gabor Grothendieck
Here is a variation on the solution below (first line is the same but second differs): > ind <- which(a == 0, arr = TRUE) > mapply("[", dimnames(a), as.data.frame(ind)) [,1] [,2] [1,] "A1" "F1" [2,] "A3" "F1" [3,] "A2" "F2" [4,] "A3" "F3" On Thu, Jul 16, 2009 at 12:40 AM, Jorge Ivan Velez w

Re: [R] storing lm() results and other objects in a list

2009-07-15 Thread Dieter Menne
Idgarad wrote: > > > ... Very long non-self-contained code removed > > Suggestions on how to handle the whole linearModel and the child data? > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do rea

[R] how to get means and confidence limits after glmmPQL or lmer

2009-07-15 Thread Don Driscoll
R, I want to get means and confidence limits on the original scale for the treatment effect after running a mixed model. The data are: response<-c(16,4,5,8,41,45,10,15,11,3,1,64,41,23,18,16,10,22,2,3) block<-factor(c("A","A","A","A","I","I","I","I","N","N","N","P","P","P","P","P","P","S","S"

<    1   2