[R] mac question

2009-11-02 Thread Antje
Hi there, currently, I've updated R on my Mac (OS X) to version 2.10. I was wondering if I have to install all additional packages again??? In Windows, I just needed to copy the library folder of the old installation but how does it work with Mac? Can anybody give me a hint? Antje _

[R] about the cox result

2009-11-02 Thread 孟欣
Hi all: I finished cox analysis like this: fit_cox<-coxph(Surv(dat$Time, dat$death) ~ dat$CD4 + strata(dat$gender),data=dat); > fit_cox Call: coxph(formula = Surv(data_ori$Time, data_ori$death) ~ data_ori$drug + strata(data_ori$gender), data = data_ori) coef exp(coef) se(co

[R] 1 dimensional optimization with local minima

2009-11-02 Thread Jeroen Ooms
I am using numerical optimization to fit a 1 parameter model, in which the input parameter is bounded. I am currently using optimize(), however, the problem turns out to have local minima, and optimize does not always seem to find the global minimum. I could to write a wrapping function that tries

[R] hierarchical clustering with Jaccard index

2009-11-02 Thread karuna m
hi, I want to do hierarchical clustering with Jaccord index. I tried to do with vegan package for finding index and hierarchical clustering with hclust function. While doing clustering it is showing an error message as "invalid distance method". I would be grateful if anyone tells how to rectify

Re: [R] design matrix construction question

2009-11-02 Thread Ken Knoblauch
> On Nov 2, 2009, at 10:40 PM, Ben Bolker wrote: > > with the following simple data frame > > dd = structure(list(z = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L > > ), .Label = c("a", "b"), class = "factor"), x = c(0.3, 0.2, 0.1, > > 0, 0, 0, 0.2, 0.3)), .Names = c("z", "x"), row.names = c(NA, > >

[R] help with SSOAP (can't find working examples)

2009-11-02 Thread Hari Krishna Dara
First of all, let me confess that I am a newbie to R and don't know much about the language or the environment. We have a need for plugging in R in our production runtime and need the ability to pull data out of our existing services. I am trying to see if I can take advantage of SSOAP such that we

[R] why is adnonis function called adonis {package vegan}

2009-11-02 Thread stvienna wiener
Hello all, I used google and looked at the documentation to find out why the ADONIS function is called adonis (in the vegan package). I am writing a document and would like to include a abbreviation list (similar to "ANOSIM = Analysis of Similarities"). regards, Steve

Re: [R] design matrix construction question

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 10:40 PM, Ben Bolker wrote: with the following simple data frame dd = structure(list(z = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L ), .Label = c("a", "b"), class = "factor"), x = c(0.3, 0.2, 0.1, 0, 0, 0, 0.2, 0.3)), .Names = c("z", "x"), row.names = c(NA, -8L), class = "d

Re: [R] save an object by dynamicly created name

2009-11-02 Thread Hao Cen
Hi Henrik and David, Thank you very much for your suggestions. I found both meet my needs. In the following code, I found save(obj,file=pathname) would save the content into an object called obj. path <- "~/"; dir.create(path); for (i in 1:10) { assign( paste("m", i, sep=""), i:5) filena

[R] OpenOffice Calc ODBC equivalent

2009-11-02 Thread Kenneth Roy Cabrera Torres
Hi R users: I am using RODBC to create some new ".xls" files each with several sheets (about 100) with sqlSave() from a data.frame inside R without any problem, but on windows XP platform. I would like to know if it is posible to make a similar solution on linux with openoffice? RODBC work onl

[R] design matrix construction question

2009-11-02 Thread Ben Bolker
with the following simple data frame dd = structure(list(z = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L ), .Label = c("a", "b"), class = "factor"), x = c(0.3, 0.2, 0.1, 0, 0, 0, 0.2, 0.3)), .Names = c("z", "x"), row.names = c(NA, -8L), class = "data.frame") I would like know if it's possible

Re: [R] re ading tokens

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 8:00 PM, j daniel wrote: Greetings, I am not familiar with processing text in R. Can someone tell me how to read each line of words as separate elements in a list? FE, I would like to turn: word1 word2 word3 word2 word4 into a list of length two with three character

Re: [R] re ading tokens

2009-11-02 Thread jim holtman
Is this what you want: > x <- readLines(textConnection("word1 word2 word3 + word2 word4")) > closeAllConnections() > yourList <- strsplit(x, '[[:space:]]+') > > > yourList [[1]] [1] "word1" "word2" "word3" [[2]] [1] "word2" "word4" > On Mon, Nov 2, 2009 at 8:00 PM, j daniel wrote: > > Greetin

[R] re ading tokens

2009-11-02 Thread j daniel
Greetings, I am not familiar with processing text in R. Can someone tell me how to read each line of words as separate elements in a list? FE, I would like to turn: word1 word2 word3 word2 word4 into a list of length two with three character elements in the first list and two elements in the

[R] Can't pass file name as parameter to Corpus function

2009-11-02 Thread renjl0810
I'm working on a small project to extract high-frequency terms from a document and then display those terms in web page. To this end, I've to pass the file name as parameter to the Corpus function to build a corpus of only one document. I can build the corpus using the code below interactively in

[R] residuals(lme) error message

2009-11-02 Thread Rupa Parvataneni
Dear R-help, I am trying to perform residual diagnostics on a repeated measures mixed effect model. With 3 time points as the fixed effect and subjects as the random effects. > time.linearc<- summary(lmer(cnim~(as.factor(time)), random= ~1|subj, data=ex.rmc, na.action=na.omit)) > time.linearc

Re: [R] Frequency

2009-11-02 Thread Nikhil Kaza
try sort (table(MAT), decreasing=T) if MAT is your matrix I think this is what you want. though if you want to sort by the first occurrence then it is a different story. Nikhil On 2 Nov 2009, at 1:35PM, Val wrote: V1 v2 v3 v4 569 10 347 10 46 10 18

[R] kernel density estimation and classification

2009-11-02 Thread wk y
Hi, I am interested to use Kernel Density Estimation on bivariate data for multi-class classification. So far, I have managed to use the 'ks' package to plot the contours of the kernel density estimates based on 8-class training dataset with only 2 variables. However, I do not know how to m

Re: [R] Time Series methods

2009-11-02 Thread Tim Bean
Sure, but it seems like the point of the time series class is so you don't have to create a factor based on the period of sampling. Is there anyway of imposing calculations like median on the time series class, or is Kjetil's suggestion the only approach? Thanks! On Sun, Nov 1, 2009 at 4:09 PM, K

Re: [R] How to exclude certain columns by column names?

2009-11-02 Thread Linlin Yan
Try this: > x[, colnames(x) != 'a'] [1] 3 4 On Tue, Nov 3, 2009 at 9:31 AM, Peng Yu wrote: > I can exclude columns by column number using '-'. But I wondering if > there is an easy way to exclude some columns by column names. > >> x=cbind(c(1,2),c(3,4)) >> x >     [,1] [,2] > [1,]    1    3 > [2,

Re: [R] How to exclude certain columns by column names?

2009-11-02 Thread Jorge Ivan Velez
Hi Peng, Here is a suggestion: subset(x, select = -a) See ?subset for more details. HTH, Jorge On Mon, Nov 2, 2009 at 8:31 PM, Peng Yu <> wrote: > I can exclude columns by column number using '-'. But I wondering if > there is an easy way to exclude some columns by column names. > > > x=cbin

[R] How to exclude certain columns by column names?

2009-11-02 Thread Peng Yu
I can exclude columns by column number using '-'. But I wondering if there is an easy way to exclude some columns by column names. > x=cbind(c(1,2),c(3,4)) > x [,1] [,2] [1,]13 [2,]24 > colnames(x)=c('a','b') > x a b [1,] 1 3 [2,] 2 4 > x[,-'a'] Error in -"a" : invalid ar

Re: [R] modifying predict.nnet() to function with errorest()

2009-11-02 Thread Max Kuhn
Dave, You should look at the train() function in teh caret package. Max On Mon, Nov 2, 2009 at 6:01 PM, Armitage, Dave wrote: > Greetings, > > I am having trouble calculating artificial neural network misclassification > errors using errorest() from the ipred package. I have had no problems > e

Re: [R] qqplot

2009-11-02 Thread John Fox
Dear Carol, > -Original Message- > From: carol white [mailto:wht_...@yahoo.com] > Sent: November-02-09 4:04 PM > To: 'Peter Flom'; John Fox > Cc: r-h...@stat.math.ethz.ch; 'Yihui Xie' > Subject: RE: [R] qqplot > > Thanks for all your replies. > > I just wanted to compare the distribution

Re: [R] avoiding loop

2009-11-02 Thread jim holtman
The first thing I would suggest is convert your dataframes to matrices so that you are not having to continually convert them in the calls to the functions. Also I am not sure what the code: realized_prob = with(DF, { ind <- (CHOSEN == 1)

Re: [R] a prolem with constrOptim

2009-11-02 Thread Ravi Varadhan
Hi, I noticed that you are setting very small tolerance as convergence criterion. In most optimization problems, it does not make much practical sense to set such a low tolerance. If you increase this, then `constrOptim' also works. For example, constrOptim(theta=theta.0, f=likelihood, grad=scor

[R] modifying predict.nnet() to function with errorest()

2009-11-02 Thread Armitage, Dave
Greetings, I am having trouble calculating artificial neural network misclassification errors using errorest() from the ipred package. I have had no problems estimating the values with randomForest() or svm(), but can't seem to get it to work with nnet(). I believe this is due to the output o

Re: [R] a prolem with constrOptim

2009-11-02 Thread Ravi Varadhan
Hi Davidov, You can use the `constrOptim.nl' function that I have written for solving problems like yours. It is better and more general than the `constrOptim' function. It is able to solve your problem, but I am not sure how well posed your problem is. One of the parameters seems to go to 0.

[R] AR Simulation with non-normal innovations - Correct

2009-11-02 Thread Ricardo Gonçalves Silva
Dear Users, I would like to simulate an AR(1) (y_t=ct1+y_t-1+e_t) model in R where the innovations are supposed to follow a t-GARCH(1,1) proccess. By t-GARCH I want to mean that: e_t=n_t*sqrt(h_t) and h_t=ct2+a*(e_t)^2+b*h_t-1. where n_t is a random variable with t-Student distribution. If s

[R] AR Simulation with non-normal innovations

2009-11-02 Thread Ricardo Gonçalves Silva
Dear Users, I would like to simulate AR(1) (y_t=ct1+y_t-1+e_t) model in R where the innovations are supposed to follow a t-GARCH(1,1) proccess. By t-GARCH I want to mean that: e_t=n_t*sqrt(h_t) and h_t=ct2+a*(e_t)^2+b*h_t-1. If someone could give some guidelines, I can going developing the mo

Re: [R] problems with read.csv

2009-11-02 Thread Joe King
I use indata = read.csv(file.choose(),header=TRUE) of course you can specify your file. Joe King 206-913-2912 j...@joepking.com "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt -Original Message- From: r-help-boun...@r-p

Re: [R] Regex matching that gives byte offset?

2009-11-02 Thread Johannes Graumann
On Monday 02 November 2009 13:41:45 Prof Brian Ripley wrote: > On Mon, 2 Nov 2009, Johannes Graumann wrote: > > Hmmm ... that should do it, thanks. But how would one use this on a file > > without reading it into memory completely? > > ?file, ?readLines, ?readBin > > will tell you about connectio

Re: [R] Plots with k-means

2009-11-02 Thread Iuri Gavronski
David, Eduardo, Thanks for the code. I have run it and I'm not sure what to do with the graph when it comes up. Can I interact with it, such as an RGL graph? I've tried clicking or dragging with the mouse and nothing happens. My system is a Windows Vista and R2.9. Best, Iuri. On Mon, Nov 2, 200

Re: [R] problems with read.csv

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 4:09 PM, Fang (Betty) Yang wrote: Dear all, I'd like to ask help on R code to get the same results as the following Splus code: indata<-importData("/home/data_new.csv") indata[1:5,4] [1] 0930 1601 1006 1032 1020 I tried the following R code: indata<-read.csv("/h

Re: [R] problems with read.csv

2009-11-02 Thread Ista Zahn
Superficially, one answer is indata <- read.csv("/home/data_new.csv", colClasses="character") but I'm not sure that's what you want... -Ista On Mon, Nov 2, 2009 at 4:09 PM, Fang (Betty) Yang wrote: > Dear all, > > > > I'd like to ask help on R code to get the same results as the following > Sp

Re: [R] Plots with k-means

2009-11-02 Thread David Winsemius
The attached file did not come through to the list. I think you have some non-standard characters (or at least non-standard in my locale). I was able to get the code to run after using the Zap Gremlins function in TextWrangler. Prior to that "treatment" pretty much every line threw an error

Re: [R] Robust ANOVA or alternative test?

2009-11-02 Thread Kingsford Jones
See the nlme library and accompanying book by Pinheiro and Bates. The lme function is appropriate for linear mixed models with normal errors, and the 'weights' argument provides flexible methods for modeling error heterogeneity. hth, Kingsford On Mon, Nov 2, 2009 at 12:10 PM, jinyan fan wrote:

[R] need help in using Hessian matrix

2009-11-02 Thread Laila Alkhalfan
Hi I need to find the Hessian matrix for a complicated function from a certain kind of data but i keep getting this error Error in f1 - f2 : non-numeric argument to binary operator the data is given by U<-runif(n) Us<-sort(U) tau1<- 2 F1tau<- pgamma((tau1/t

[R] problems with read.csv

2009-11-02 Thread Fang (Betty) Yang
Dear all, I'd like to ask help on R code to get the same results as the following Splus code: >indata<-importData("/home/data_new.csv") >indata[1:5,4] [1] 0930 1601 1006 1032 1020 I tried the following R code: > indata<-read.csv("/home/data_new.csv") > indata[1:5,4] [1] 9

Re: [R] qqplot

2009-11-02 Thread carol white
Thanks for all your replies. I just wanted to compare the distributions of two populations and see how different they are. I thought that QQplot would be a good idea. It's true that the mean and sd of the two distributions are not the same. I don't know if any other method or graphical presenta

Re: [R] Plots with k-means

2009-11-02 Thread eduardo san miguel
I send r-code in an attached file. 2009/11/2 Iuri Gavronski : > Eduardo, > > Would you mind sending me the R code in an attached file. Your code didn't > work here and I am not sure it is because of line breaks from the email > program. > > Iuri. > > On Mon, Nov 2, 2009 at 10:53 AM, eduardo san mi

[R] reference on p.adjust()

2009-11-02 Thread Peng Yu
I'm wondering if there is a textbook that summarize the methods on adjusting p-values for multiple comparisons. Most of the references on p.adjust() are over 10 years old. I feel it would be better if somebody could recommend me a textbook on multiple hypothesis correction, so that I can quickly ge

Re: [R] Frequency

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 2:49 PM, Jorge Ivan Velez wrote: Hi Ashta, Yes, it is possible. Here is a suggestion: # Data set x <- read.table(textConnection("v1 v2 v3 v4 569 10 347 10 46 10 18"), header = TRUE) closeAllConnections() # Table res <- table(data.matrix(x))

Re: [R] "Safe" way to automatically install required packages...

2009-11-02 Thread Charlie Sharpsteen
On Mon, Nov 2, 2009 at 10:56 AM, Jonathan Greenberg wrote: > R-helpers: > >   I'm working on an r-package that I want to make as easy-to-use as possible > for a novice R-user, which includes automatically installing required > packages.   I, myself, am a novice R-packager, so the solution I came u

Re: [R] Incremental ReadLines

2009-11-02 Thread Gene Leynes
James, I think those are Unix commands? I'm on Windows, so that's not an option (for now) Also the suggestions posed by Duncan and Phil seem to be working. Thank you so much, such a simple thing to add the "r" or "rt" to the file connection. I read about blocking, but I didn't imagine that it

Re: [R] Sorting NA's and Graphing a histogram

2009-11-02 Thread Jorge Ivan Velez
Hi Koraelus, Here is a suggestion for the first part: index <- apply(Dataset, 1, function(x) sum( is.na( x ) ) < 2 ) d2 <- Dataset[index ,] d2 # Alpha Beta Gamma Delta # A 12 3 4 # BNA2 4 5 # D 891011 # E 5 NA 713 Could you please ex

Re: [R] Robust ANOVA or alternative test?

2009-11-02 Thread Liviu Andronic
Hello On 11/2/09, jinyan fan wrote: > to address this issue, either by some sort of Robust ANOVA procedure, or by > some alternative tests? Thanks a lot. > I cannot address this specific question, but you may want to address robustness-related queries to r-sig-robust, and perhaps check the Robus

Re: [R] Frequency

2009-11-02 Thread Jorge Ivan Velez
Hi Ashta, Yes, it is possible. Here is a suggestion: # Data set x <- read.table(textConnection("v1 v2 v3 v4 569 10 347 10 46 10 18"), header = TRUE) closeAllConnections() # Table res <- table(data.matrix(x)) f <- sort(res, decreasing = TRUE) data.frame(value = na

Re: [R] Incremental ReadLines

2009-11-02 Thread James W. MacDonald
Hi Gene, Rather than using R to parse this file, have you considered using either grep or sed to pre-process the file and then read it in? It looks like you just want lines starting with numbers, so something like grep '^[0-9]\+' thefile.csv > otherfile.csv should be much faster, and then yo

Re: [R] Incremental ReadLines

2009-11-02 Thread Duncan Murdoch
On 11/2/2009 2:03 PM, Gene Leynes wrote: I've been trying to figure out how to read in a large file for a few days now, and after extensive research I'm still not sure what to do. I have a large comma delimited text file that contains 59 fields in each record. There is also a header every 121 re

Re: [R] Frequency

2009-11-02 Thread Ashta
Thank you Jorge and > res <- table(unlist(x)) > res[order(res, decreasing = TRUE)] > # 10 4 6 3 5 7 9 18 > # 3 2 2 1 1 1 1 1 This one works fine for me. Is it possible to transpose it? I tried t(res[order(res, decreasing = TRUE)]), but it did not work! I want the result like this

[R] Sorting NA's and Graphing a histogram

2009-11-02 Thread Koraelus
Let's say I have a dataset Dataset<-read.csv("Dataset.txt", header=T, row.names=1) Dataset Alpha Beta Gamma Delta A 1 23 4 B NA24 5 C NA3NA NA D 8 9 10 11 E5 NA 713 F NANA NA 4 I

[R] Robust ANOVA or alternative test?

2009-11-02 Thread jinyan fan
Dear Colleagues,   I am running a three-way mixed-design ANOVA, with one manipulated IV, a group membership IV, and pre-/post- within subject factor. I am interested in the three-way interaction effect. The regular ANVOA is problematic, because (a) the sample sizes are very unbalanced, due to th

[R] Incremental ReadLines

2009-11-02 Thread Gene Leynes
I've been trying to figure out how to read in a large file for a few days now, and after extensive research I'm still not sure what to do. I have a large comma delimited text file that contains 59 fields in each record. There is also a header every 121 records This function works well for smallis

Re: [R] "Safe" way to automatically install required packages...

2009-11-02 Thread hadley wickham
If you package "depends" on another package, it will be automatically installed. Hadley On Mon, Nov 2, 2009 at 12:56 PM, Jonathan Greenberg wrote: > R-helpers: > >   I'm working on an r-package that I want to make as easy-to-use as possible > for a novice R-user, which includes automatically ins

Re: [R] using exists with coef from an arima fit

2009-11-02 Thread Rolf Turner
On 2/11/2009, at 5:27 PM, Erin Hodgess wrote: Dear R People: I have the output from an arima model fit in an object xxx. I want to verify that the ma1 coefficient is there, so I did the following: xxx$coef ar1ar2ma1 intercept 1.3841297 -0.4985667 -0.996 -0.109

[R] "Safe" way to automatically install required packages...

2009-11-02 Thread Jonathan Greenberg
R-helpers: I'm working on an r-package that I want to make as easy-to-use as possible for a novice R-user, which includes automatically installing required packages. I, myself, am a novice R-packager, so the solution I came up with was to embed: print("Loading required packages...") if

Re: [R] Frequency

2009-11-02 Thread Joe King
sorry, I forgot to send my reply to the list, I got to remember to hit reply all: So I set up a dummy matrix, v1,v2,v3,v4, an datamatrix v1 = c(5,3,4) v2 = c(6,4,6) v3 = c(9,7,10) v4 = c(10,10,18) datamatrix=c(v1,v2,v3,v4) then do sort(table(datamatrix)) Joe King 206-913-2912 j...@joepking.co

Re: [R] Frequency

2009-11-02 Thread Jorge Ivan Velez
Hi Val, Here is a suggestion: res <- table(unlist(x)) res[order(res, decreasing = TRUE)] # 10 4 6 3 5 7 9 18 # 3 2 2 1 1 1 1 1 HTH, Jorge On Mon, Nov 2, 2009 at 1:35 PM, Val <> wrote: > BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS > > Hi All, > > I have a da

Re: [R] how to print the full name of the factors in summary?

2009-11-02 Thread Bert Gunter
Jack: You are confused! You have specified that the factor is ordered (ordered = TRUE), so you do _not get_ the (6, not 7 btw)single degree of freedom contrasts corresponding to weekday names. Instead you get the (default) contrasts for an ordered factor (.L = linear, .Q = quadratic, etc.). Also

[R] Frequency

2009-11-02 Thread Val
BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS Hi All, I have a data set "x" with several variables. Sample of the data is shown below V1 v2 v3 v4 569 10 347 10 46 10 18 I want the frequency of each data point sorted by their occ

[R] "object not found" within function

2009-11-02 Thread Thushyanthan Baskaran
Hi, I am trying to write a function to compute many cross-tabulations with the -svytable- command. Here is a simplified example of the structure of my code (adapted from the -svytable- help file): data(api) func.example<-function(variable){ dclus1<-svydesign(id=~1, weights=~pw,data=apiclus1

[R] R and Python

2009-11-02 Thread Ryan Sheftel
I am a long time user of R for financial time series analysis (xts, zoo, etc) and for my next project I am thinking of adding the Python language to the mix. The reason for adding Python is primarily its non-statistical capabilities. So my questions are what have people's experiences been with usi

[R] a prolem with constrOptim

2009-11-02 Thread Davidov, Ori (NIH/NIEHS) [V]
Hi, I apologize for the long message but the problem I encountered can't be stated in a few lines. I am having some problems with the function constrOptim. My goal is to maximize the likelihood of product of K multinomials, each with four catagories under linear constraints on the parameter va

[R] Summing rows based on criteria

2009-11-02 Thread PDXRugger
I am attempting to clean up some land use building data and need to join some buildings together making sure not to double count GIS slivers. The first data.frame is the original, the 2nd adds all the acres for each identical bldgid. I now want to a) throw out all but one of the the cases where

Re: [R] Avoiding for loops

2009-11-02 Thread Noah Silverman
Wow, That's nice. Should work well, but I just realized that I missed something in explaining my code. I need to calculate the exp function on X so it should be exp(x) / sum(exp(x)) for each group I tried this with: foo <- ave(rawdata$foo,rawdata$code,FUN=function(x) exp(x) / sum(exp(x)))

Re: [R] qqplot

2009-11-02 Thread Peter Flom
Peter Ehlers wrote > >That's not what qqline() does and for good reason - it treats >x and y asymmetrically. > >But qqline() is a very simple function, using the quartiles >as also suggested by John. Here's a modified version that >should work for Carol: > >qqline2 <- function (x, y, ...) >{ >

Re: [R] qqplot

2009-11-02 Thread Peter Flom
John Fox wrote > >I assumed that Carol wanted to compare the shapes of the distributions and >to adjust for differences in centre and spread. To put a line through the >quartiles or to base a line on the medians and IQRs is more robust than >using the means and sds. > Hi John Indeed it is. It al

Re: [R] qqplot

2009-11-02 Thread John Fox
Dear Peter, I assumed that Carol wanted to compare the shapes of the distributions and to adjust for differences in centre and spread. To put a line through the quartiles or to base a line on the medians and IQRs is more robust than using the means and sds. Best, John > -Original Message--

Re: [R] qqplot

2009-11-02 Thread Peter Ehlers
Peter Flom wrote: David Winsemius wrote I always assumed that the intercept was zero and the slope = unity. y <- rt(200, df = 5) qqnorm(y); qqline(y, col = 2) qqplot(y, rt(300, df = 5)) abline(0, 1, col="red") Suppose you have the following x <- rnorm(500) y <- 500*(x + runif(500, 0,1)

Re: [R] save an object by dynamicly created name

2009-11-02 Thread Dieter Menne
jeffc wrote: > > Hi, > > I would like to save a few dynamically created objects to disk. The > following is the basic flow of the code segment > > for(i = 1:10) { >m = i:5 >save(m, file = ...) ## ??? > } > To distinguish different objects to be saved, I would like to save m as > m1, m

Re: [R] qqplot

2009-11-02 Thread Peter Flom
carol white wrote >So the conclusion is that abline(0,1) should always be used and if it doesn't >go through the qqplot, the two distributions are not similar? I think it depends what you mean by "similar". E.g., if you mean "are both of these distributions (e.g.) normal?" then abline(0,1) is

Re: [R] qqplot

2009-11-02 Thread Peter Flom
David Winsemius wrote >I always assumed that the intercept was zero and the slope = unity. > > y <- rt(200, df = 5) > qqnorm(y); qqline(y, col = 2) > qqplot(y, rt(300, df = 5)) > abline(0, 1, col="red") > Suppose you have the following x <- rnorm(500) y <- 500*(x + runif(500, 0,1)) qqplot(x,

Re: [R] qqplot

2009-11-02 Thread carol white
So the conclusion is that abline(0,1) should always be used and if it doesn't go through the qqplot, the two distributions are not similar? Thanks --- On Mon, 11/2/09, Yihui Xie wrote: > From: Yihui Xie > Subject: Re: [R] qqplot > To: "carol white" > Cc: "David Winsemius" , r-h...@stat.math.

Re: [R] qqplot

2009-11-02 Thread Yihui Xie
abline(0,1) is somewhere in the upper-left corner which you are unable to see. At least the first distribution seems to have a larger mean than the second one (i.e. they are not the same distribution). Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics

Re: [R] how can I convert .csv format to matrix???

2009-11-02 Thread Dieter Menne
bbslover wrote: > > In my disk C:/ have a a.csv file, I want to read it to R, importantly, > when I use x=read.csv("C:/a.csv") ,the x format is data.frame, I want > to it to become matrix format, how can I do it ? > as.matrix should do the job; if it does not (second example), you proba

[R] R and Python

2009-11-02 Thread Ryan Sheftel
I am a long time user of R for financial time series analysis (xts, zoo, etc) and for my next project I am thinking of adding the Python language to the mix. The reason for adding Python is primarily its non-statistical capabilities. So my questions are what have people's experiences been with usi

Re: [R] qqplot

2009-11-02 Thread carol white
if I have the two following matrices, abline(0,1) doesn't go through. QQplot is attached. [,1] [,2] [,3] [,4] [,5] 2.149644 1.992864 3.346375 2.793511 3.428230 1.100762 2.152981 2.735401 2.175185 3.323058 1.212406 2.131813 2.672598 2.389996 3.242490 1.183770 1.908633

Re: [R] qqplot

2009-11-02 Thread John Fox
Carol, You could run a line through the pairs of first and third quartiles of the two distributions, i.e., c(quantile(x, .25), quantile(y, .25)) and c(quantile(x, .75), quantile(y, .75)). (Of course, you'd want the line to extend across the whole graph.) I hope this helps, John > -Original

Re: [R] how to print the full name of the factors in summary?

2009-11-02 Thread John Fox
Jen-Chien and Adaikalavan, Weekday is specified as an ordered factor, for which the default contrast type is contr.poly, i.e., orthogonal-polynomial contrasts. I would have expected a 6th-degree polynomial for the 7 days of the week, and there's a message that suggests that 3 coefficients are alia

Re: [R] qqplot

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 10:40 AM, carol white wrote: Hi, We could use qqplot to see how two distributions are different from each other. To show better how they are different (departs from the straight line), how is it possible to plot the straight line that goes through them? I am looking for

Re: [R] partial matching with grep()

2009-11-02 Thread jim holtman
Is this what you want: depends on it occurring at the endo of the string: > grep("\\.x[^x]*$",c("a.x" ,"b.x","a.xx"),value=TRUE) [1] "a.x" "b.x" On Mon, Nov 2, 2009 at 9:57 AM, Vito Muggeo (UniPa) wrote: > dear all, > This is a probably a silly question. > If I type >> grep("x",c("a.x" ,"b.x",

[R] qqplot

2009-11-02 Thread carol white
Hi, We could use qqplot to see how two distributions are different from each other. To show better how they are different (departs from the straight line), how is it possible to plot the straight line that goes through them? I am looking for some thing like qqline for qqnorm. I thought of abline

[R] Problem building R 2.10.0 - Matrix package

2009-11-02 Thread Thomas Adams
All: Attached is the output file from building R 2.10.0 on RedHat Linux. I have never previously experienced any problems when building R from source with new releases. But, now I get a compile error with the Matrix package: CHOLMOD/Include/cholmod.h:87:22: error: UFconfig.h: No such file or

Re: [R] partial matching with grep()

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 9:57 AM, Vito Muggeo (UniPa) wrote: dear all, This is a probably a silly question. If I type > grep("x",c("a.x" ,"b.x","a.xx"),value=TRUE) [1] "a.x" "b.x" "a.xx" > grep("\\.x\\b",c("a.x" ,"b.x","a.xx"),value=TRUE) [1] "a.x" "b.x" Or: > grep("\\.x$",c("a.x" ,"b.x","a.xx")

Re: [R] convert list to numeric

2009-11-02 Thread Don MacQueen
An example will help show the difference between single vs. double brackets. ## xl is a list with three elements xl <- list( a=1:3, b=2:7, c=c('X','Y')) xl $a [1] 1 2 3 $b [1] 2 3 4 5 6 7 $c [1] "X" "Y" ## with single brackets, we get a subset. A subset of a list is still a list xl[

Re: [R] how to print the full name of the factors in summary?

2009-11-02 Thread Adaikalavan Ramasamy
It would be useful to say which package the object SJ comes from or provide a more reproducible example. Assuming that Demand variable is continuous and you are fitting a standard lm() model, then your results looks suspicious. Where are the coefficients for Month, Holiday, Season? Jen-Ch

Re: [R] package lme4

2009-11-02 Thread Douglas Bates
On Sun, Nov 1, 2009 at 9:01 AM, wenjun zheng wrote: > Hi R Users, >     When I use package lme4 for mixed model analysis, I can't distinguish > the significant and insignificant variables from all random independent > variables. >     Here is my data and result: > Data: > >  Rice<-data.frame(Yield

Re: [R] superscript troubles

2009-11-02 Thread baptiste auguie
Hi, Try this, x = rnorm(1) y = rnorm(1) leg = bquote(r^2*"="*.(round(x,digits=3))*", P="*.(round(y, digits=3))) plot.new() legend (bty ="n","topright",legend=leg) HTH, baptiste 2009/11/2 Jacob Kasper : > I know that this has been revisited over and over, yet I cannot figure out > how to solve

Re: [R] superscript troubles

2009-11-02 Thread Peter Dalgaard
Jacob Kasper wrote: > I know that this has been revisited over and over, yet I cannot figure out > how to solve this case of superscript troubles... > I would like the 2 in r2 to be superscript, yet I am pasting text before and > after it. I have tried several variations but have not solved this ye

Re: [R] Interaction contrasts or posthoc test for glm (MASS) with ANOVA design

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 8:40 AM, Maya Pfaff wrote: Dear R experts I am running a negative-binomial GLM (glm.nb) to test the null hypotheses that species 1 and 2 are equally abundant between site 1 and site2, and between each other. So, I have a 2x2 factorial design with factors Site (1,2) an

[R] superscript troubles

2009-11-02 Thread Jacob Kasper
I know that this has been revisited over and over, yet I cannot figure out how to solve this case of superscript troubles... I would like the 2 in r2 to be superscript, yet I am pasting text before and after it. I have tried several variations but have not solved this yet, any suggestions? legend

[R] how to print the full name of the factors in summary?

2009-11-02 Thread Jen-Chien Chang
Hi, I am wondering if there is a simple way to fix the problem I am having. For unknown reason, I could not get the full name of the factors to be printed in the summary. I have tried to used summary.lm as well but the problem still persists. SJ$Weekday <- factor(SJ$Weekday,1:7,c("Mon","Tue

Re: [R] Using processed objects as arguments of a function

2009-11-02 Thread David Winsemius
This would return a vector the names of objects whose names begin with "fund": ls()[grep("^fund", ls())] I'm such a grep-noob that I don't know off the top of my head what the pattern should be to restrict it to only those objects with digits in the next position. Perhaps: do.call( "rbin

[R] partial matching with grep()

2009-11-02 Thread Vito Muggeo (UniPa)
dear all, This is a probably a silly question. If I type > grep("x",c("a.x" ,"b.x","a.xx"),value=TRUE) [1] "a.x" "b.x" "a.xx" Instead, I would like to obtain only "a.x" "b.x" How is it possible to get this result with grep()? many thanks for your attention, best, vito --

Re: [R] convert list to numeric

2009-11-02 Thread Adaikalavan Ramasamy
It's a way of extracting from a list. See help("[") or help("Extract"). dadrivr wrote: Great, that works very well. What is the purpose of double brackets vs single ones? I will remember next time to include a subset of the data, so that readers can run the script. Thanks again for your hel

Re: [R] convert list to numeric

2009-11-02 Thread Adaikalavan Ramasamy
It's a way of extracting from a list. See help("[") or help("Extract") Regards, Adai dadrivr wrote: Great, that works very well. What is the purpose of double brackets vs single ones? I will remember next time to include a subset of the data, so that readers can run the script. Thanks again

Re: [R] convert list to numeric

2009-11-02 Thread dadrivr
Great, that works very well. What is the purpose of double brackets vs single ones? I will remember next time to include a subset of the data, so that readers can run the script. Thanks again for your help! Benilton Carvalho wrote: > > it appears that what you really want is to use: > > ta

Re: [R] Titles on lattice colorkey

2009-11-02 Thread Walmes Zeviani
r-help.20.trevva wrote: > > Dear R-ers, > > I'm not sure if this is a missing feature, a support request, or stupidity > on my part, but nevertheless, its a question. Is it possible to add titles > to colorkey legends? As far as I can tell, there is a command to do it for > normal "key" legend

[R] Interaction contrasts or posthoc test for glm (MASS) with ANOVA design

2009-11-02 Thread Maya Pfaff
Dear R experts I am running a negative-binomial GLM (glm.nb) to test the null hypotheses that species 1 and 2 are equally abundant between site 1 and site2, and between each other. So, I have a 2x2 factorial design with factors Site (1,2) and Taxon (1,2). Since the Site:Taxon interaction is signif

  1   2   >