[R] Post stratification weights in survey package in R

2012-05-13 Thread Ruijie
Hi all, I have data collected from a survey administered on a subset of the population. I also have the population proportions of variables such as gender, race and housing type. I would like to combine the weights from each separate cross tab (of gender, race and housing type) such that the weigh

Re: [R] Why can we combine design matrix and data-frame in R?

2012-05-13 Thread Luna
Thanks! Do you think if the correctness of the such results could be generalized to other future cases? On Sun, May 13, 2012 at 7:10 PM, S Ellison wrote: > > But the line you cited was about "response" being a matrix, which is not > our case. > Yes, you're right; I picked the wrong thing to

Re: [R] Why can we combine design matrix and data-frame in R?

2012-05-13 Thread S Ellison
> But the line you cited was about "response" being a matrix, which is not our > case. Yes, you're right; I picked the wrong thing to cite. The only documentation I found about lm accepting a matrix in the predictors is a one-line statement in "Introduction to R" which says "term_i is either

Re: [R] Discrete choice model maximum likelihood estimation

2012-05-13 Thread Rui Barradas
Hello, There are several issues with your code. 1. The error message. Don't use 'par' as a variable name, it's already an R function, tyo get or set graphics parameters. Call it something else, say, 'param'. This is what causes the error. You must pass initial values to optim, but the variable yo

[R] CRAN (and crantastic) updates this week

2012-05-13 Thread Crantastic
CRAN (and crantastic) updates this week New packages * AGD (0.30) Maintainer: Stef van Buuren Author(s): Stef van Buuren License: GPL-2 | GPL-3 http://crantastic.org/packages/AGD Tools for NIHES course EP18 'Analysis of Growth Data', May 22-23 2012, Rotterdam. * bigml

[R] Discrete choice model maximum likelihood estimation

2012-05-13 Thread infinitehorizon
Hello, I am new to R and I am trying to estimate a discrete model with three choices. I am stuck at a point and cannot find a solution. I have probability functions for occurrence of these choices, and then I build the likelihood functions associated to these choices and finally I build the gener

Re: [R] Why can we combine design matrix and data-frame in R?

2012-05-13 Thread Michael
It's very interesting that the names of tmp has only 14 items, and the dim(tmp) shows 14 columns too, but actually the number of columns in tmp should be 16... This is very strange... > dim(X) [1] 7185 3 > dim(MathScores) [1] 7185 12 > dim(tmp) [1] 7185 14 > names(tmp) [1] "School" "Mino

Re: [R] Why can we combine design matrix and data-frame in R?

2012-05-13 Thread Michael
Thank you! But the line you cited was about "response" being a matrix, which is not our case. And also I have checked: Any more thoughts? Thank you! > names(tmp) [1] "School" "Minority" "Sex" "SES" "MathAch" "MEANSES.x" [7] "Size" "Sector" "PRACAD" "DISCLIM" "HIMINTY" "MEANSES.y" [13] "Inte

Re: [R] Couldn't plot all PCA new attributes on K-Means Clustering

2012-05-13 Thread Suhaila Haji Mohd Hussin
Please nevermind as I've just solved this by using scatterplot matrices. Suhaila > From: bell_beaut...@hotmail.com > To: r-help@r-project.org > Date: Mon, 14 May 2012 06:28:06 +1200 > Subject: [R] Couldn't plot all PCA new attributes on K-Means Clustering > > > Hello. > I'm trying to plot clust

Re: [R] Plotmath bug or my misunderstanding?

2012-05-13 Thread Bert Gunter
Peter/David: Yes, I think this is the general approach for multiple lines in plotmath expressions. For future reference, a simple canonical example is: exl <- list(quote(sigma), "tau",quote(beta)) plot(0:1,0:1,type="n",axes=FALSE) text(do.call(expression,exl),x=.5,y=seq(.4,.6,by=.1),cex=2) The p

[R] Couldn't plot all PCA new attributes on K-Means Clustering

2012-05-13 Thread Suhaila Haji Mohd Hussin
Hello. I'm trying to plot clusters for all possible combination of attributes. So I typed in plot(pr2NewMedicalData, col = kmpr2NewMedicalData$cluster) The problem is it only plots PC2 axis against PC1 axis. There should be PC1 to PC10. I tried it on normal data (not PCA) and it plots all possib

Re: [R] plot.ts error: cannot plot more than 10 series

2012-05-13 Thread Suhaila Haji Mohd Hussin
Thank you! Suhaila > From: ggrothendi...@gmail.com > Date: Sun, 13 May 2012 07:58:19 -0400 > Subject: Re: [R] plot.ts error: cannot plot more than 10 series > To: bell_beaut...@hotmail.com > CC: r-help@r-project.org > > On Sun, May 13, 2012 at 5:02 AM, Suhaila Haji Mohd Hussin > wrote: > > > >

[R] Residuals from binomial glm

2012-05-13 Thread Petar Milin
Dear all! Sometimes, when using plain lm(), if I have highly correlated numeric predictors (covariates), I firstly ran lm() to get residuals of one from the other. This way, they became uncorrelated (orthogonal), and I can check if the residualized one contributes to prediction, over and above the

Re: [R] Replacing cretin value in a file

2012-05-13 Thread Ken Hutchison
Perhaps you are in the first circle of the R Inferno? Ken Hutchison On May 13, 2012, at 9:31 AM, Berend Hasselman wrote: > > On 13-05-2012, at 15:08, Jonsson wrote: > >> Dear All, >> >> I am trying to replace a value of 528.8933 to - in my file >> >> t<- file("C:\\Users\\Amin\\Des

Re: [R] heatmap

2012-05-13 Thread David Winsemius
On May 13, 2012, at 11:23 AM, li li wrote: Dear all, I have a data set which is 100 \times 100 matrix. I made a heatmap of the data. The xlim and ylim are both shown to be c(0,1). I want to make both the xlim and ylim to be c(0,100). So the heatmap correspond to the 100 \times 100 locations.

Re: [R] Plotmath bug or my misunderstanding?

2012-05-13 Thread P Ehlers
Bert: inline On 2012-05-13 7:43, Bert Gunter wrote: Peter/David: 1. For some reason, I didn't see Peter's reply on r-help. 2. To Peter: Aha!! Let me play this back to you. In text(1,1,labels=expression(atop(atop(sigma,"some text"),"another level")),cex = 2) The (outer) whole atop() specifi

Re: [R] Plotmath bug or my misunderstanding?

2012-05-13 Thread David Winsemius
On May 13, 2012, at 10:43 AM, Bert Gunter wrote: Peter/David: 1. For some reason, I didn't see Peter's reply on r-help. 2. To Peter: Aha!! Let me play this back to you. In text(1,1,labels=expression(atop(atop(sigma,"some text"),"another level")),cex = 2) The (outer) whole atop() specificati

[R] heatmap

2012-05-13 Thread li li
Dear all, I have a data set which is 100 \times 100 matrix. I made a heatmap of the data. The xlim and ylim are both shown to be c(0,1). I want to make both the xlim and ylim to be c(0,100). So the heatmap correspond to the 100 \times 100 locations. Thank you. Hannah [[alternative

Re: [R] set specific contrasts using lapply

2012-05-13 Thread Rui Barradas
Hello, The value change inside a function's body is lost on exit. You have changed the value of a copy of the argument passed to the function. That copy exists in the function's environment only. And the original exists in another environment, the caller's, the parent frame. (.GlobalEnv?) Thi

Re: [R] Plotmath bug or my misunderstanding?

2012-05-13 Thread Bert Gunter
Peter/David: 1. For some reason, I didn't see Peter's reply on r-help. 2. To Peter: Aha!! Let me play this back to you. In text(1,1,labels=expression(atop(atop(sigma,"some text"),"another level")),cex = 2) The (outer) whole atop() specification is allocated twice the amount of space that would

Re: [R] Replacing cretin value in a file

2012-05-13 Thread Berend Hasselman
On 13-05-2012, at 15:08, Jonsson wrote: > Dear All, > > I am trying to replace a value of 528.8933 to - in my file > > t<- file("C:\\Users\\Amin\\Desktop\\1999n_Resample11.img", "rb") > e=readBin(t, double(), size=4,n=720*360, signed=TRUE) > e[e != -] <- e[e != -]*0.0099 + 477.6

Re: [R] Replacing cretin value in a file

2012-05-13 Thread David Winsemius
On May 13, 2012, at 9:08 AM, Jonsson wrote: Dear All, I am trying to replace a value of 528.8933 to - in my file t<- file("C:\\Users\\Amin\\Desktop\\1999n_Resample11.img", "rb") e=readBin(t, double(), size=4,n=720*360, signed=TRUE) e[e != -] <- e[e != -]*0.0099 + 477.65 -273.15 T

Re: [R] Replacing cretin value in a file

2012-05-13 Thread Jonsson
Dear All, I am trying to replace a value of 528.8933 to - in my file t<- file("C:\\Users\\Amin\\Desktop\\1999n_Resample11.img", "rb") e=readBin(t, double(), size=4,n=720*360, signed=TRUE) e[e != -] <- e[e != -]*0.0099 + 477.65 -273.15 This code given above would read a bina

Re: [R] Replacing cretin value in a file

2012-05-13 Thread David Winsemius
On May 13, 2012, at 8:12 AM, Jonsson wrote: Dear Jim, You may forget to add your suggestions because what I see is just my post The suggestion was to read the referenced FAQ. PLEASE do read the posting guide http://www.R-project.org/posting-guide.html And while you are referencing the

Re: [R] Plotmath bug or my misunderstanding?

2012-05-13 Thread Rui Barradas
Hello, It seems like a "feature". When trying the example below with more atops, the two bottom most lines, and only those two lines, feature character expansion relative to the default size and relative to the line before last. plot(1, type="n", xaxt='n', yaxt='n', ann=FALSE, xlim=c(-0.5,

Re: [R] Replacing cretin value in a file

2012-05-13 Thread Jonsson
Dear Jim, You may forget to add your suggestions because what I see is just my post -- View this message in context: http://r.789695.n4.nabble.com/Replacing-cretin-value-in-a-file-tp4629840p4629843.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] plot.ts error: cannot plot more than 10 series

2012-05-13 Thread Gabor Grothendieck
On Sun, May 13, 2012 at 5:02 AM, Suhaila Haji Mohd Hussin wrote: > > Hello. > I'm doing Principal Component Analysis. So I'm trying to plot the new data as > time series like this: > plot.ts(pr2$x) > But it gives me error: Error in plotts(x = x, y = y, plot.type = plot.type, > xy.labels = xy.lab

Re: [R] Replacing cretin value in a file

2012-05-13 Thread Jim Holtman
FAQ 7.31 Sent from my iPad On May 13, 2012, at 7:52, Jonsson wrote: > Dear All, > > I am trying to replace a value of 528.8933 to - in my file > > t<- file("C:\\Users\\Amin\\Desktop\\1999n_Resample11.img", "rb") > e=readBin(t, double(), size=4,n=720*360, signed=TRUE) > e[e != -] <- e[

[R] Replacing cretin value in a file

2012-05-13 Thread Jonsson
Dear All, I am trying to replace a value of 528.8933 to - in my file t<- file("C:\\Users\\Amin\\Desktop\\1999n_Resample11.img", "rb") e=readBin(t, double(), size=4,n=720*360, signed=TRUE) e[e != -] <- e[e != -]*0.0099 + 477.65 -273.15 ##worked well and values heve

Re: [R] categorical analysis - grouping rows

2012-05-13 Thread Rui Barradas
Hello, If the output of ftable is kept in an object named 'ft', try this. ftperc <- t(apply(ft, 1, function(x) if(sum(x)) round(100*x/sum(x)) else rep(0, length(x attributes(ftperc) <- attributes(ft) ftperc (And if you need it to process several datasets, a function with 'ft' as the

[R] how to calculate risk allele or score allele

2012-05-13 Thread ramakanth reddy
Hello, In a case control study how to calculate the risk allele or score allele. Regards GRR [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gui

[R] determine size (width and height) of a graphics file via R - how?

2012-05-13 Thread Mark Heckmann
Hi, is there a way to determine the size (width, height) of a graphics file saved on my hard disk, e.g. a .bmp, via R. What I want is basically the same information on the dimensions of the graphic file that I get from my file browser. Thanks Mark PS. Why: I use the R2PPT and I need to deter

Re: [R] x axis dates

2012-05-13 Thread Jim Lemon
On 05/13/2012 03:49 AM, pip wrote: The following data spans out to 2012 and when graphing out the data - R defaults dates on x axis only shows the years eg 200520072009 My question is how can I get the graph to show more dates on the axis - eg every qtr or 6 months or every month etc PR

[R] plot.ts error: cannot plot more than 10 series

2012-05-13 Thread Suhaila Haji Mohd Hussin
Hello. I'm doing Principal Component Analysis. So I'm trying to plot the new data as time series like this: plot.ts(pr2$x) But it gives me error: Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, : cannot plot more than 10 series as

Re: [R] Plotmath bug or my misunderstanding?

2012-05-13 Thread Duncan Murdoch
On 12-05-13 12:27 AM, David Winsemius wrote: On May 12, 2012, at 6:27 PM, Peter Ehlers wrote: Hi Bert, I think the 'cex=' argument applies to the outermost 'atop()'. It then applies that size specification to each of the two components of the atop(a,b). If one of the components is itself anot

Re: [R] memory growth with rbind and lapply

2012-05-13 Thread Duncan Murdoch
On 12-05-12 10:06 PM, Jack Tanner wrote: This version of my code makes the R process consume unreasonable amounts of RAM: datf<- rbind(lapply(mylist, function(item) { with(item, data.frame(col1, col2, col3)) })) This version works fine: datf<- lapply(mylist, function(item) {

Re: [R] round up/down to nearest hundredth

2012-05-13 Thread Petr Savicky
On Sat, May 12, 2012 at 01:38:16PM -0700, chuck.01 wrote: > Hi, > How can I round up and down to the nearest hundredth > > example: > > x <- 0.18 > how do I round down to 0.15? > how do I round down to 0.20? Hi. Rounding to 0.15 is not to a nearest hundredth, but to a nearest multiple of 0.05.

Re: [R] Help with writing data to csv

2012-05-13 Thread John
On Sat, 12 May 2012 13:33:19 -0700 (PDT) DL wrote: > I am trying to write data to csv but I am having issues with the > separations. > > Basically I have some results that I get with R that I copied and > pasted into word and then saved as .txt > > I want to write the results to csv because i