[R] Hand-crafting an .RData file

2009-11-08 Thread Adam D. I. Kramer
Hello, I frequently have to export a large quantity of data from some source (for example, a database, or a hand-written perl script) and then read it into R. This occasionally takes a lot of time; I'm usually using read.table("filename",comment.char="",quote="") to read the data once it

[R] How to change color the default in levelplot() ?

2009-11-08 Thread BabyL BabyK
Dear R communities May I seek your advices on how to change color the default in levelplot(), e.g. from the default of pink and light blue, to e.g. red and green ? The levelplot function has 1 of the arguments being panel (which is actually panel.levelplot), but I am not sure where the commands

[R] Forward selection peculiarity

2009-11-08 Thread ricefan81
Hi all, I'm using the mle.stepwise function in the wle package to run forward selection. My statistical background tells me that the first variable selected should be the one with the highest correlation with the response, however that's not the case. The two highest correlations with the respons

Re: [R] Outputing multilple subsets

2009-11-08 Thread Johann Hibschman
On Nov 8, 2009, at 7:23 PM, rusers.sh wrote: for (i in num) { c_num<-c[c$b==num,] write.csv(c_num,file="c:/c_num.csv") } Warning messages: 1: In c$b == num : longer object length is not a multiple of shorter object length This is because you're comparing column b to the entire vector of

[R] Bug in gplots::heatmap.2 symbreaks arg default (?)

2009-11-08 Thread Steve Lianoglou
Hi all, I think the code to calculate the default value of the symbreaks argument in the gplots::heatmap.2 function is wrong. The documentation says symbreaks defaults to true if any negative values are detected in the data passed in. The relevant code in the parameter list of this functi

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread John Fox
Dear Peng, I'm tempted to try to get an entry in the fortunes package but will instead try to answer your questions directly: > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Peng Yu > Sent: November-08-09 7:41 PM > To: r-h...@

Re: [R] Models for Discrete Choice in R

2009-11-08 Thread Frank E Harrell Jr
Emmanuel Charpentier wrote: Le dimanche 08 novembre 2009 à 17:07 -0200, Iuri Gavronski a écrit : Hi, I would like to fit Logit models for ordered data, such as those suggested by Greene (2003), p. 736. Does anyone suggests any package in R for that? look up the polr function in package MASS

Re: [R] Outputing multilple subsets

2009-11-08 Thread Ista Zahn
Have you considered using split? -Ista On Sun, Nov 8, 2009 at 7:23 PM, rusers.sh wrote: > Hi Rusers, >  I hope to divide the original dataset into several subsets and output > these multilple datasets. But errors appeared in my loops. See example. > ## > a<-c(1:10) > b<-c(rep(1,3),rep(2,3),r

Re: [R] Simple 2-Way Anova issue in R

2009-11-08 Thread jim holtman
> x Year Depth Biomass1 Biomass2 1 199910 14.3 14.7 2 199915 14.7 15.6 > require(reshape) > melt(x, id=c('Year','Depth')) Year Depth variable value 1 199910 Biomass1 14.3 2 199915 Biomass1 14.7 3 199910 Biomass2 14.7 4 199915 Biomass2 15.6 On Sun, N

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread Peng Yu
Dear John, I did read Section 9.1.2 and various other textbooks before posting my questions. But each reference uses slightly different notations and terminology. I get confused and would like a description that summaries everything so that I don't have to refer to many different resources. May I

Re: [R] Simple 2-Way Anova issue in R

2009-11-08 Thread znd
Ah, I believe I constructed my *.csv wrong in that I only had 1 observation within groups whereas I needed at least 2. Originally I had: Year Depth Biomass1 Biomass2 1999 10 14.3 14.7 1999 15 14.7 15.6 etc. but I switched this to: Year

[R] Outputing multilple subsets

2009-11-08 Thread rusers.sh
Hi Rusers, I hope to divide the original dataset into several subsets and output these multilple datasets. But errors appeared in my loops. See example. ## a<-c(1:10) b<-c(rep(1,3),rep(2,3),rep(3,4)) c<-data.frame(a,b) #c is the example data num<-c(unique(b)) # I hope to get the subsets c_1.

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread John Fox
Dear Peng Yu, Perhaps you're referring to my text, Applied Linear Regression Analysis and Generalized Linear Models, since I seem to recall that you sent me a number of questions about it. See Section 9.1.2 on linear contrasts for the answer to your question. I hope this helps, John ---

Re: [R] Express "e" in R?

2009-11-08 Thread David Winsemius
exp(1) #[1] 2.718282 On Nov 8, 2009, at 5:03 PM, Crab wrote: How do you express "e" the base of the natural log in R. -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] Express "e" in R?

2009-11-08 Thread Duncan Murdoch
On 08/11/2009 5:03 PM, Crab wrote: How do you express "e" the base of the natural log in R. e <- exp(1) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/postin

[R] Express "e" in R?

2009-11-08 Thread Crab
How do you express "e" the base of the natural log in R. -- View this message in context: http://old.nabble.com/Express-%22e%22-in-R--tp26258503p26258503.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing li

Re: [R] Normal distribution

2009-11-08 Thread mandalic05
Normal distribution check within R can be done with functions available in nortest package. This package consists of several normality tests. In order to install package type install.packages('nortest'). Afterwards, you should consider running ks.test() only if mu and sigma parameters are known (t

Re: [R] Turn dates into age

2009-11-08 Thread Marc Schwartz
> Sys.Date() [1] "2009-11-08" > as.Date("05/29/1971", format = "%m/%d/%Y") [1] "1971-05-29" > as.numeric((Sys.Date() - as.Date("05/29/1971", format = "%m/%d/ %Y")) / 365.25) [1] 38.44764 or perhaps more clearly: EndDate <- Sys.Date() StartDate <- as.Date("05/29/1971", format = "%m/%d/%Y")

Re: [R] Simple 2-Way Anova issue in R

2009-11-08 Thread Jeremy Miles
If I've understood correctly, you have cell sizes of 1. This is not enough. ANOVA compares within group variance to between group variance, and your within group variances are zero. You need more data, or to collapse some cells. Jeremy 2009/11/8 znd : > > Hello, I'm new to R and have been f

[R] ordered factor and unordered factor

2009-11-08 Thread Peng Yu
I don't understand under what situation ordered factor rather than unordered factor should be used. Could somebody give me some examples? What are the implications of order vs. unordered factors? Could somebody recommend a textbook to me? __ R-help@r-pro

Re: [R] Turn dates into age

2009-11-08 Thread Jim Burke
To clarify. Lets turn a date into an age. Given 05/29/1971 in mm/dd/ format. What is the year difference between then and today? This would be the "age" requested that starts 05/29/1971 as one. Thanks, Jim David Winsemius wrote: > > On Nov 8, 2009, at 3:11 PM, frenchcr wrote: > >> >> >> w

Re: [R] Turn dates into age

2009-11-08 Thread David Winsemius
On Nov 8, 2009, at 3:11 PM, frenchcr wrote: why do you use 365.25? As opposed to what? -- David dates<-as.character(data[,"date_commissioned"]); # convert dates to characters #dates[1:10] #[1] "19910101" "19860101" "19910101" "19860101" "19910101" "19910101" "19910101" "19910101" "199

[R] Simple 2-Way Anova issue in R

2009-11-08 Thread znd
Hello, I'm new to R and have been following many guides including the two-way anova (http://www.personality-project.org/r/r.anova.html). Using that walkthrough including the supplied data I do str(data.ex2) and receive the appropriate types of data as follows: > str(data.ex2) 'data.frame': 16 o

Re: [R] rd doc truncated with R 2.10.0

2009-11-08 Thread Patrick Giraudoux
Patrick Giraudoux a écrit : Duncan Murdoch a écrit : On 08/11/2009 12:07 PM, Patrick Giraudoux wrote: Hi, I am routinely compiling a package and since I have moved to R 2.10.0, it troncates some section texts in the doc: With the following section in the rd file: \details{ The function ca

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread Peng Yu
On Sun, Nov 8, 2009 at 11:28 AM, Peter Dalgaard wrote: > Gabor Grothendieck wrote: >> >> On Sun, Nov 8, 2009 at 11:59 AM, Peng Yu wrote: >>> >>> On Sun, Nov 8, 2009 at 10:11 AM, Duncan Murdoch >>> wrote: On 08/11/2009 11:03 AM, Peng Yu wrote: > > I'm wondering which textbook di

Re: [R] Obtaining midpoints of class intervals produced by cut and table

2009-11-08 Thread Gabor Grothendieck
Try this: library(gsubfn) demo("gsubfn-cut") and note the strapply call that converts the levels from cut to a matrix. On Sun, Nov 8, 2009 at 4:08 PM, jose romero wrote: > Hello list: > > I am using "cut" and "table" to obtain a frequency table from a numeric > sample vector.  The idea is to c

Re: [R] Obtaining midpoints of class intervals produced by cut and table

2009-11-08 Thread Peter Dalgaard
jose romero wrote: Hello list: I am using "cut" and "table" to obtain a frequency table from a numeric sample vector. The idea is to calculate mean and standard deviation on grouped data. However, I can't extract the midpoints of the class intervals, which seem to be strings treated as factors.

Re: [R] Obtaining midpoints of class intervals produced by cut and table

2009-11-08 Thread baptiste auguie
Hi, Maybe something like this (inspired by ?cut), cut2num <- function(f){ labs <- levels(f) d <- data.frame(lower = as.numeric( sub("\\((.+),.*", "\\1", labs) ), upper = as.numeric( sub("[^,]*,([^]]*)\\]", "\\1", labs) )) d$midpoints <- rowMeans(d) d } a <- c(1, 2, 3, 4

[R] Obtaining midpoints of class intervals produced by cut and table

2009-11-08 Thread jose romero
Hello list: I am using "cut" and "table" to obtain a frequency table from a numeric sample vector.  The idea is to calculate mean and standard deviation on grouped data.  However, I can't extract the midpoints of the class intervals, which seem to be strings treated as factors.  How do i extrac

Re: [R] Turn dates into age

2009-11-08 Thread frenchcr
why do you use 365.25? dates<-as.character(data[,"date_commissioned"]); # convert dates to characters #dates[1:10] #[1] "19910101" "19860101" "19910101" "19860101" "19910101" "19910101" "19910101" "19910101" "19910101" "19910101" dateObs <- as.Date(dates,format="%Y%m%d") #dateObs[1:10] #[1] "1

Re: [R] Turn dates into age

2009-11-08 Thread frenchcr
it sure does thank you! > will this work for you > > x <- c('19910101', '19950302', '20010502') > today <- Sys.Date() > x.date <- as.Date(x, format="%Y%m%d") > round(as.vector(difftime(today , x.date, units='day') / 365.25)) [1] 19 15 9 > On Sun, Nov 8, 2009 at 2:44 PM, wrote: > Hi Jim, >

Re: [R] MCMC gradually slows down

2009-11-08 Thread Jens Malmros
Thanks a lot, this works. jim holtman wrote: > First of all, allocate 'theta' to be the final size you need. Every > time through your loop you are extending it by one, meaning you are > spending a lot of time copying the data each time. Do something like: > > theta <- numeric(n) > > and then

Re: [R] Models for Discrete Choice in R

2009-11-08 Thread Emmanuel Charpentier
Le dimanche 08 novembre 2009 à 17:07 -0200, Iuri Gavronski a écrit : > Hi, > > I would like to fit Logit models for ordered data, such as those > suggested by Greene (2003), p. 736. > > Does anyone suggests any package in R for that? look up the polr function in package MASS (and read the releva

Re: [R] MCMC gradually slows down

2009-11-08 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jens Malmros > Sent: Sunday, November 08, 2009 11:11 AM > To: r-help@r-project.org > Subject: [R] MCMC gradually slows down > > Hello, > > I have written a simple Metropolis-Has

[R] a question in coxph

2009-11-08 Thread Lei Liu
Hi there, I tried to fit a penalized spline for a continuous risk factor in recurrent events data. I found that I can include both pspline and frailty terms in coxph. So I use code like fit1 <- coxph(Surv(start, end, event)~pspline(age, df=0) + male + white +frailty(id), data.all) It yie

Re: [R] Turn dates into age

2009-11-08 Thread Marc Schwartz
As Jim has noted, if the dates you have below are an 'end date', you need to define the time0 or start date for each to calculate the intervals. On the other hand, are the dates you have below the start dates and you need to calculate the time to today? In the latter case, see ?Sys.Date to

Re: [R] Extracting matched expressions

2009-11-08 Thread Gabor Grothendieck
strapply in the gsubfn package can do that. It applies the indicated function, here just c, to the back references from the pattern match and then simplifies the result using simplify. (If you omit simplify here it would give a one element list like strsplit does.) library(gsubfn) pat <- "(.*?) (.

Re: [R] MCMC gradually slows down

2009-11-08 Thread Viechtbauer Wolfgang (STAT)
Try this: Instead of: theta = c() use: theta <- rep(NA, 50) or however many iterations you want the algorithm to run. Best, -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +31 (0)43 388-2277 School for Public Health

Re: [R] MCMC gradually slows down

2009-11-08 Thread jim holtman
First of all, allocate 'theta' to be the final size you need. Every time through your loop you are extending it by one, meaning you are spending a lot of time copying the data each time. Do something like: theta <- numeric(n) and then see how fast it works. On Sun, Nov 8, 2009 at 2:11 PM, Jens

Re: [R] Extracting matched expressions

2009-11-08 Thread jim holtman
Is this what you want: > x <- ' one two three ' > y <- > sub(".*?([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([ehrt]{5}).*", + "\\1 \\2 \\3", x, perl=TRUE) > unlist(strsplit(y, ' ')) [1] "one" "two" "three" On Sun, Nov 8, 2009 at 1:51 PM, Hadley Wickham wrot

Re: [R] correlated binary data and overall probability

2009-11-08 Thread Christian Lerch
To answer my own question: The package mvtBinaryEP was helpful! Christian Lerch schrieb: Dear All, I try to simulate correlated binary data for a clinical research project. Unfortunately, I do not come to grips with bindata(). Consider corr<-data.frame(ID=as.factor(rep(c(1:10), each=5)),

Re: [R] Turn dates into age

2009-11-08 Thread jim holtman
What is the frame of reference to determine the age? Check out 'difftime'. On Sun, Nov 8, 2009 at 1:50 PM, frenchcr wrote: > > Ive got a big column of dates (also some fields dont have a date so they have > NA instead), > that i have converted into date format as so... > > > dates<-as.character

Re: [R] lme4 and incomplete block design

2009-11-08 Thread Christian Lerch
Many thanks, Bill and Emmanuel! Christian Emmanuel Charpentier schrieb: Le dimanche 08 novembre 2009 à 00:05 +0100, Christian Lerch a écrit : Dear list members, I try to simulate an incomplete block design in which every participants receives 3 out of 4 possible treatment. The outcome in bina

[R] Turn dates into age

2009-11-08 Thread frenchcr
Ive got a big column of dates (also some fields dont have a date so they have NA instead), that i have converted into date format as so... dates<-as.character(data[,"date_commissioned"]); # converted dates to characters dates[1:10] [1] "19910101" "19860101" "19910101" "19860101" "19910101" "199

[R] negative log likelihood

2009-11-08 Thread mat7770
I have two related variables, each with 16 points (x and Y). I am given variance and the y-intercept. I know how to create a regression line and find the residuals, but here is my problem. I have to make a loop that uses the seq() function, so that it changes the slope value of the y=mx + B equati

[R] MCMC gradually slows down

2009-11-08 Thread Jens Malmros
Hello, I have written a simple Metropolis-Hastings MCMC algorithm for a binomial parameter: MHastings = function(n,p0,d){ theta = c() theta[1] = p0 t =1 while(t<=n){ phi = log(theta[t]/(1-theta[t])) phisim = phi + rnorm(1,0,d)

[R] Models for Discrete Choice in R

2009-11-08 Thread Iuri Gavronski
Hi, I would like to fit Logit models for ordered data, such as those suggested by Greene (2003), p. 736. Does anyone suggests any package in R for that? By the way, my dependent variable is ordinal and my independent variables are ratio/intervalar. Thanks, Iuri. Greene, W. H. Econometric Anal

[R] Extracting matched expressions

2009-11-08 Thread Hadley Wickham
Hi all, Is there a tool in base R to extract matched expressions from a regular expression? i.e. given the regular expression "(.*?) (.*?) ([ehtr]{5})" is there a way to extract the character vector c("one", "two", "three") from the string "one two three" ? Thanks, Hadley -- http://had.co.nz/

Re: [R] How to create multiple command windows of R on Windows?

2009-11-08 Thread Ivan
Thanks a lot for your explanation. That actually makes sense. On Sat, Nov 7, 2009 at 3:54 PM, Duncan Murdoch wrote: > On 07/11/2009 6:31 PM, Ivan wrote: > >> Well, the problem is that I want those console to be from the same session >> (i.e., they share same objects etc.). I do not think multipl

Re: [R] rd doc truncated with R 2.10.0

2009-11-08 Thread Patrick Giraudoux
Duncan Murdoch a écrit : On 08/11/2009 12:07 PM, Patrick Giraudoux wrote: Hi, I am routinely compiling a package and since I have moved to R 2.10.0, it troncates some section texts in the doc: With the following section in the rd file: \details{ The function calls gpsbabel via the system.

Re: [R] linear trend line and a quadratic trend line.

2009-11-08 Thread Peter Dalgaard
Eric Fail wrote: Dear list users How is it possible to visualise both a linear trend line and a quadratic trend line on a plot of two variables? Here my almost working exsample. data(Duncan) attach(Duncan) plot(prestige ~ income) abline(lm(prestige ~ income), col=2, lwd=2) Now I

Re: [R] rd doc truncated with R 2.10.0

2009-11-08 Thread Duncan Murdoch
On 08/11/2009 12:07 PM, Patrick Giraudoux wrote: Hi, I am routinely compiling a package and since I have moved to R 2.10.0, it troncates some section texts in the doc: With the following section in the rd file: \details{ The function calls gpsbabel via the system. The gpsbabel program must

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread Peter Dalgaard
Gabor Grothendieck wrote: On Sun, Nov 8, 2009 at 11:59 AM, Peng Yu wrote: On Sun, Nov 8, 2009 at 10:11 AM, Duncan Murdoch wrote: On 08/11/2009 11:03 AM, Peng Yu wrote: I'm wondering which textbook discussed the various contrast matrices mentioned in the help page of 'contr.helmert'. Could so

[R] linear trend line and a quadratic trend line.

2009-11-08 Thread Eric Fail
Dear list users How is it possible to visualise both a linear trend line and a quadratic trend line on a plot of two variables? Here my almost working exsample. data(Duncan) attach(Duncan) plot(prestige ~ income) abline(lm(prestige ~ income), col=2, lwd=2) Now I would like to add

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread Gabor Grothendieck
On Sun, Nov 8, 2009 at 11:59 AM, Peng Yu wrote: > On Sun, Nov 8, 2009 at 10:11 AM, Duncan Murdoch wrote: >> On 08/11/2009 11:03 AM, Peng Yu wrote: >>> >>> I'm wondering which textbook discussed the various contrast matrices >>> mentioned in the help page of 'contr.helmert'. Could somebody let me

Re: [R] Counting non-empty levels of a factor

2009-11-08 Thread John Kane
With xx as your sample data will this work? See ?addmargins jj <- table(xx) addmargins(jj, 2) # or for both margins addmargins(jj, c(1,2)) or apply(jj, 1, sum) --- On Sun, 11/8/09, sylvain willart wrote: > From: sylvain willart > Subject: [R] Counting non-empty levels of a factor > To:

[R] rd doc truncated with R 2.10.0

2009-11-08 Thread Patrick Giraudoux
Hi, I am routinely compiling a package and since I have moved to R 2.10.0, it troncates some section texts in the doc: With the following section in the rd file: \details{ The function calls gpsbabel via the system. The gpsbabel program must be present and on the user's PATH for the function

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread Peng Yu
On Sun, Nov 8, 2009 at 10:11 AM, Duncan Murdoch wrote: > On 08/11/2009 11:03 AM, Peng Yu wrote: >> >> I'm wondering which textbook discussed the various contrast matrices >> mentioned in the help page of 'contr.helmert'. Could somebody let me >> know? > > Doesn't the reference on that page discuss

Re: [R] Strange Conflicts with Debian Repositories

2009-11-08 Thread Dirk Eddelbuettel
On Sun, Nov 08, 2009 at 10:31:12AM -0600, Dirk Eddelbuettel wrote: > > On 8 November 2009 at 17:05, Lorenzo Isella wrote: > | I am experiencing some really strange problems in updating my system > | whenever I have both the R repository and the multimedia repository > | available. > [...] > | deb

Re: [R] look up and Missing

2009-11-08 Thread John Kane
I'm not quite sure I understood the second queston but does this work? subset(temp, xx$v2==-9) subset(temp, xx$v2!= -9) --- On Sun, 11/8/09, Ashta wrote: > From: Ashta > Subject: [R] look up and Missing > To: r-h...@stat.math.ethz.ch > Received: Sunday, November 8, 2009, 10:23 AM > HI  R-User

Re: [R] look up and Missing

2009-11-08 Thread David Winsemius
On Nov 8, 2009, at 11:08 AM, David Winsemius wrote: On Nov 8, 2009, at 10:23 AM, Ashta wrote: HI R-Users Assume that I have a data frame 'temp' with several variables (v1,v2,v3,v4,v5.). v1 v2 v3 v4 v5 1 2 3 36 5 2 420 2 -9 5 43 6 2 1 34 1, I wa

Re: [R] look up and Missing

2009-11-08 Thread Jorge Ivan Velez
Dear Ashta, Is this what you want? x <- read.table(textConnection("v1 v2 v3 v4 v5 1 2 3 36 5 2 420 2 -9 5 43 6 2 1 34"), header = TRUE) closeAllConnections() x # Option 1 x1 <- x # copy of x just for this example x1$v2[which(x1$v2 == -9)] <- NA x

Re: [R] look up and Missing

2009-11-08 Thread Dimitris Rizopoulos
try this: temp.new <- temp[temp$v2 != -9, ] temp.new I hope it helps. Best, Dimitris Ashta wrote: HI R-Users Assume that I have a data frame 'temp' with several variables (v1,v2,v3,v4,v5.). v1 v2 v3 v4 v5 1 2 3 36 5 2 420 2 -9 5 43 6 2 1 3

Re: [R] look up and Missing

2009-11-08 Thread David Winsemius
On Nov 8, 2009, at 10:23 AM, Ashta wrote: HI R-Users Assume that I have a data frame 'temp' with several variables (v1,v2,v3,v4,v5.). v1 v2 v3 v4 v5 1 2 3 36 5 2 420 2 -9 5 43 6 2 1 34 1, I want to look at the entire row values of when v2 =-9

Re: [R] Strange Conflicts with Debian Repositories

2009-11-08 Thread Dirk Eddelbuettel
On 8 November 2009 at 17:05, Lorenzo Isella wrote: | I am experiencing some really strange problems in updating my system | whenever I have both the R repository and the multimedia repository | available. [...] | deb http://cran.ch.r-project.org/bin/linux/debian lenny-cran/ This URLs doesn't exis

Re: [R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread David Winsemius
On Nov 8, 2009, at 11:03 AM, Peng Yu wrote: I'm wondering which textbook discussed the various contrast matrices mentioned in the help page of 'contr.helmert'. Could somebody let me know? My version of "Modern Applied Statistics in S" (aka MASS) deals with it in enough detail for a person

Re: [R] look up and Missing

2009-11-08 Thread jim holtman
Here is how to find out which rows contain -9 and then you can do with it as you please: > x v1 v2 v3 v4 v5 1 1 2 3 3 6 2 5 2 4 2 0 3 2 -9 5 4 3 4 6 2 1 3 4 > which(apply(x, 1, function(.row) any(.row == -9))) [1] 3 > > On Sun, Nov 8, 2009 at 10:23 AM, Ashta wrote: > HI  R-

[R] Recall: Scheffe test

2009-11-08 Thread Mangalani Peter Makananisa
Mangalani Peter Makananisa would like to recall the message, "Scheffe test". Please Note: This email and its contents are subject to our email legal notice which can be viewed at http://www.sars.gov.za/Email_Disclaimer.pdf [[alternative HTML version deleted]] __

[R] Scheffe test

2009-11-08 Thread Mangalani Peter Makananisa
Dear Prof, Please help me with the R code which compute SCHEFFE TEST Thanking you in advance Kind regards Mangalani Peter Makananisa Statistical Analyst South African Revenue Service (SARS) Segmentation and Research : Data Modelling Tel: +2712 422 7357 Cell: +2782 456 4669

[R] Scheffe test

2009-11-08 Thread Mangalani Peter Makananisa
Dear all, Please help me with the R code which compute SCHEFFE TEST Thanking you in advance Kind regards Mangalani Peter Makananisa Statistical Analyst South African Revenue Service (SARS) Segmentation and Research : Data Modelling Tel: +2712 422 7357 Cell: +2782 456 4669 F

[R] Scheffe test

2009-11-08 Thread Mangalani Peter Makananisa
Dear all, Please help me with the R code which compute SCHEFFE TEST Thanking you in advance Kind regards Mangalani Peter Makananisa Statistical Analyst South African Revenue Service (SARS) Segmentation and Research : Data Modelling Tel: +2712 422 7357 Cell: +2782 456 4669 F

[R] Strange Conflicts with Debian Repositories

2009-11-08 Thread Lorenzo Isella
Dear All, I have just installed a fresh Debian testing (squeeze) on my system (amd64 architecture). I am experiencing some really strange problems in updating my system whenever I have both the R repository and the multimedia repository available. This is my source.list (when I disable the multimed

[R] reference on contr.helmert and typo on its help page.

2009-11-08 Thread Peng Yu
I'm wondering which textbook discussed the various contrast matrices mentioned in the help page of 'contr.helmert'. Could somebody let me know? BTW, in R version 2.9.1, there is a typo on the help page of 'contr.helmert' ('cont.helmert' should be 'contr.helmert').

Re: [R] Counting non-empty levels of a factor

2009-11-08 Thread sylvain willart
Thanks a lot for those solutions, Both are working great, and they do slightly different (but both very interesting) things, Moreover, I learned about the length() function ... one more to add to my personal cheat sheet King Regards 2009/11/8 David Winsemius : > > On Nov 8, 2009, at 9:11 AM, David

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

2009-11-08 Thread Hao Cen
Hi Henrik, I am using your saveObject/loadObject to handle over 1000 matrices. It worked beautifully. Because I need to load those matrices often for evaluating a few functions on them and those matrices do not fit all in memory at once, is there a way to speed up the loading part? I tried save al

[R] how to remove one of any two indices with a correlation greater than 0.90 in a matrix (or data.frame)

2009-11-08 Thread bbslover
my code is not right below: rm(list=ls()) #define data.frame a=c(1,2,3,5,6); b=c(1,2,3,4,7); c=c(1,2,3,4,8); d=c(1,2,3,5,1); e=c(1,2,3,5,7) data.f=data.frame(a,b,c,d,e) #backup data.f origin.data<-data.f #get correlation matrix cor.matrix<-cor(origin.data) #backup corre

Re: [R] Windows 7 editor - I can't make RWinEdt work

2009-11-08 Thread Uwe Ligges
Aha, what is that blog post and what does not work for you? I haven't got any report so far and do not have Windows 7 easily available yet. Best, Uwe Ligges Peter Flom wrote: Good morning I just got a new computer with Windows 7. R works fine, but the editor I am used to using "RWinEdt"

[R] look up and Missing

2009-11-08 Thread Ashta
HI R-Users Assume that I have a data frame 'temp' with several variables (v1,v2,v3,v4,v5.). v1 v2 v3 v4 v5 1 2 3 36 5 2 420 2 -9 5 43 6 2 1 34 1, I want to look at the entire row values of when v2 =-9 like 2 -9 5 43 I wrote

[R] Windows 7 editor - I can't make RWinEdt work

2009-11-08 Thread Peter Flom
Good morning I just got a new computer with Windows 7. R works fine, but the editor I am used to using "RWinEdt" does not. I did find one blog post on how to get RWinEdt to work in Windows 7, but I could not get those instructions to work either. Is there a patch for RWinEdt? If not, is the

Re: [R] Counting non-empty levels of a factor

2009-11-08 Thread David Winsemius
On Nov 8, 2009, at 9:11 AM, David Winsemius wrote: On Nov 8, 2009, at 8:38 AM, sylvain willart wrote: Hi everyone, I'm struggling with a little problem for a while, and I'm wondering if anyone could help... I have a dataset (from retailing industry) that indicates which brands are pr

Re: [R] plot.window arguments being ignored?

2009-11-08 Thread Bryan Hanson
Dan, with base graphics, the> plot command determines the ylim, >lines can only add lines/points to an exisiting graph, it cannot modify the existing ylim. You have two choices. 1) Before proceeding to the graph, determine which of the two data sets has the greater range and call >plot with that

Re: [R] Counting non-empty levels of a factor

2009-11-08 Thread David Winsemius
On Nov 8, 2009, at 8:38 AM, sylvain willart wrote: Hi everyone, I'm struggling with a little problem for a while, and I'm wondering if anyone could help... I have a dataset (from retailing industry) that indicates which brands are present in a panel of 500 stores, store , brand 1 , B1 1 , B2

Re: [R] influence.measures(stats): hatvalues(model, ...)

2009-11-08 Thread Viechtbauer Wolfgang (STAT)
Not sure what you mean. yi <- c(2,3,2,4,3,6) xi <- c(1,4,3,2,4,5) res <- lm(yi ~ xi) hatvalues(res) X <- cbind(1, xi) diag( X%*%solve(t(X)%*%X)%*%t(X) ) Same result. Best, -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +

[R] Counting non-empty levels of a factor

2009-11-08 Thread sylvain willart
Hi everyone, I'm struggling with a little problem for a while, and I'm wondering if anyone could help... I have a dataset (from retailing industry) that indicates which brands are present in a panel of 500 stores, store , brand 1 , B1 1 , B2 1 , B3 2 , B1 2 , B3 3 , B2 3 , B3 3 , B4 I would lik

Re: [R] influence.measures(stats): hatvalues(model, ...)

2009-11-08 Thread Peter Ehlers
Sigmund Freud wrote: Hello: I am trying to understand the method 'hatvalues(...)', which returns something similar to the diagonals of the plain vanilla hat matrix [X(X'X)^(-1)X'], but not quite. A Fortran programmer I am not, but tracing through the code it looks like perhaps some sort of co

Re: [R] lme4 and incomplete block design

2009-11-08 Thread Emmanuel Charpentier
Le dimanche 08 novembre 2009 à 00:05 +0100, Christian Lerch a écrit : > Dear list members, > > I try to simulate an incomplete block design in which every participants > receives 3 out of 4 possible treatment. The outcome in binary. > > Assigning a binary outcome to the BIB or PBIB dataset of th

[R] plot.window arguments being ignored?

2009-11-08 Thread ARRRRR_user
Hi, Why, when I run the script below, is my y-axis range command being ignored? I.e., the y axis graphed consistently fits the line specified in the plot command, but never fits the line I'm trying to add in the subsequent line command. This is my first R script, so if I'm doing anything else wac

Re: [R] after PCA, the pc values are so large, wrong?

2009-11-08 Thread bbslover
ok,I understand your means, maybe PLS is better for my aim. but I have done that, also bad. the most questions for me is how to select less variables from the independent to fit dependent. GA maybe is good way, but I do not learn it well. Ben Bolker wrote: > > bbslover yeah.net> writes: > >>

Re: [R] fill map with gradient: package?

2009-11-08 Thread Thomas Steiner
Thanks Paul. I'm still struggeling with some beginners issues on the ps-import (windows troubles with installing ghostscript), but when I resolved them I'm sure that I can use your example code which loos great to me. Thanks a lot, Thomas 2009/11/4 Paul Murrell : > Hi > > > Thomas Steiner wrote: