Re: [R] Error running lda example from Help File (MASS library )

2009-11-14 Thread Ronggui Huang
I don't run into any problem when runing examples from lda help file. > sessionInfo() R version 2.10.0 Patched (2009-11-09 r50375) i386-pc-mingw32 locale: [1] LC_COLLATE=Chinese_People's Republic of China.936 [2] LC_CTYPE=Chinese_People's Republic of China.936 [3] LC_MONETARY=Chinese_People's Rep

Re: [R] Weighted descriptives by levels of another variables

2009-11-14 Thread David Freedman
In addition to using the survey package (and the svyby function), I've found that many of the 'weighted' functions, such as wtd.mean, work well with the plyr package. For example, wtdmean=function(df)wtd.mean(df$obese,df$sampwt); ddply(mydata, ~cut2(age,c(2,6,12,16)),'wtdmean') hth, david free

Re: [R] Weighted descriptives by levels of another variables

2009-11-14 Thread David Freedman
In addition to using the survey package (and the svyby function), I've found that many of the 'weighted' functions, such as wtd.mean, work well with the plyr package. For example, wtdmean=function(df)wtd.mean(df$obese,df$sampwt); ddply(mydata, ~cut2(age,c(2,6,12,16)),'wtdmean') hth, david free

Re: [R] A combinatorial optimization problem: finding the best permutation of a complex vector

2009-11-14 Thread Ravi Varadhan
Hi, It was pointed out to me by Hans Borchers that the timing that I reported (0.3 sec) in the previous email for solving the LSAP problem, for N=1000, was too optimistic, because "X" and "Y" were equivalent up to a permutation. In order to test this out, I ran a few more experiments with dif

Re: [R] Weighted descriptives by levels of another variables

2009-11-14 Thread David Winsemius
Have you reviewed the survey package functions? -- David On Nov 14, 2009, at 5:31 PM, Andrew Miles wrote: I've noticed that R has a number of very useful functions for obtaining descriptive statistics on groups of variables, including summary {stats}, describe {Hmisc}, and describe {psych}, but

Re: [R] re move row if the column "date_abandoned" has a date in it

2009-11-14 Thread David Winsemius
u were really asking for. The dates are in the format 20091114 so i'm just going to treat them as numbers for clean up purposes. I know that i use subset but not sure how to proceed from there. subdata <- subset(data, date_abandoned > "0101"() The problem with >

[R] Error running lda example from Help File (MASS library )

2009-11-14 Thread Greg Riddick
Hello all, I'm trying to run lda() from the MASS library but the Help example generates the following error: #Code from example in lda Help file # Resulting Error >Error in if (targetlist[i] == stringname) { : argument is of length zero My Current R Installation: MacOSX: 10.5.8 R: 2.10.0

Re: [R] when vectorising does not work: silent function fail?

2009-11-14 Thread Juliet Hannah
> > Also, you probably get less data copying by using a for() or while() loop > than by using apply() in this context. Why may there be less data copying with "for" and "while" compared to apply? > > Finally, the overhead of formula parsing and model matrix construction > repeated thousands of

Re: [R] re move row if the column "date_abandoned" has a date in it

2009-11-14 Thread frenchcr
reater than 1,010,000. > > Are you doing archeology? Given what you say next I wondered what > range you were really asking for. > >> >> The dates are in the format 20091114 so i'm just going to treat them >> as >> numbers for clean up purposes. >> &

[R] Weighted descriptives by levels of another variables

2009-11-14 Thread Andrew Miles
I've noticed that R has a number of very useful functions for obtaining descriptive statistics on groups of variables, including summary {stats}, describe {Hmisc}, and describe {psych}, but none that I have found is able to provided weighted descriptives of subsets of a data set (ex. descri

Re: [R] Best advice for connect R and Octave

2009-11-14 Thread Jason Rupert
Charlie, Thank you very much for your reply. I also read this earlier and noticed this package was contributed in 2002 and not updated since then, so I am afraid it has long since been surpassed by both the R and Octave architectures and not been maintained. Thus, I guess my search will co

Re: [R] Best advice for connect R and Octave

2009-11-14 Thread Uwe Ligges
See http://www.omegahat.org/ROctave/ which offers the source package for download and some documentation that is not too promising. Good luck, Uwe Ligges Jason Rupert wrote: Uwe, Thank you for the quick response, but I think I'm missing what is being suggested about the Omegahat site.

Re: [R] Best advice for connect R and Octave

2009-11-14 Thread Jason Rupert
Uwe, Thank you for the quick response, but I think I'm missing what is being suggested about the Omegahat site. I think I may be overlooking something about that site. I tried: > install.packages(ROctave, repos = "http://www.omegahat.org/R";) Error in install.packages(ROctave, repos = "http:

Re: [R] Best advice for connect R and Octave

2009-11-14 Thread Gabor Grothendieck
There is also this lexicon which might be sufficient to allow you to rewrite the Octave routine in R: http://cran.r-project.org/doc/contrib/R-and-octave.txt On Sat, Nov 14, 2009 at 5:29 PM, cls59 wrote: > > > Jason Rupert wrote: >> >> I see at one time there was a package called ROctave.  I tried

Re: [R] Best advice for connect R and Octave

2009-11-14 Thread cls59
Jason Rupert wrote: > > I see at one time there was a package called ROctave. I tried to install > that package: > >> install.packages("ROctave") > --- Please select a CRAN mirror for use in this session --- > Warning message: > In getDependencies(pkgs, dependencies, available, lib) : > pack

Re: [R] Best advice for connect R and Octave

2009-11-14 Thread Uwe Ligges
- It has never been on CRAN. - A quick Google search suggests it is on Omegahat. Uwe Ligges Jason Rupert wrote: I see at one time there was a package called ROctave. I tried to install that package: install.packages("ROctave") --- Please select a CRAN mirror for use in this session ---

Re: [R] naive "collinear" weighted linear regression

2009-11-14 Thread Peter Dalgaard
Mauricio O Calvao wrote: Unfortunately you eschewed answering objectively any of my questions; I insist they do make sense. Don't mention the data are perfect; this does not help to make any progress in understanding the choice of convenient summary info the lm method provides, as compared to wh

Re: [R] naive "collinear" weighted linear regression

2009-11-14 Thread David Winsemius
On Nov 14, 2009, at 1:50 PM, Mauricio O Calvao wrote: David Winsemius comcast.net> writes: Which means those x, y, and "error" figures did not come from an experiment, but rather from theory??? The fact is I am trying to compare the results of: (1) lm under R and (2) the Java applet at

[R] Best way to model colonization: logistic regression vs. Poisson regression, or perhaps some other technique.

2009-11-14 Thread John Sorkin
Please forgive a stats question I am trying to model colonization with a bacterium with the aims of quantifying overall colonization rate as well as determining risk factors for colonization in a in-hospital setting. Risk factors to me measured include type of contact with a patient (e.g. feedi

Re: [R] re move row if the column "date_abandoned" has a date in it

2009-11-14 Thread David Winsemius
you doing archeology? Given what you say next I wondered what range you were really asking for. The dates are in the format 20091114 so i'm just going to treat them as numbers for clean up purposes. I know that i use subset but not sure how to proceed from there. subdata <-

[R] re move row if the column "date_abandoned" has a date in it

2009-11-14 Thread frenchcr
I want to go through a column in data called date_abandoneddata["date_abandoned"]and remove all the rows that have numbers greater than 1,010,000. The dates are in the format 20091114 so i'm just going to treat them as numbers for clean up purposes. I know that i use

Re: [R] naive "collinear" weighted linear regression

2009-11-14 Thread Mauricio O Calvao
David Winsemius comcast.net> writes: > > Which means those x, y, and "error" figures did not come from an > experiment, but rather from theory??? > The fact is I am trying to compare the results of: (1) lm under R and (2) the Java applet at http://omnis.if.ufrj.br/~carlos/applets/reta/reta

Re: [R] vignettes: .png graphics or pre-compiled .pdf

2009-11-14 Thread Yihui Xie
Yes, I also wish Sweave could give us more flexible options, e.g. it should not be difficult to free the graphics device specification as an R function (pdf, png, CairoPDF, ...) instead of just letting us set pdf=T/F and eps=T/F. If we don't want to hack the Sweave code, we may also rewrite it as

Re: [R] setting contrasts for a logistic regression

2009-11-14 Thread Frank E Harrell Jr
w_poet wrote: Hi everyone, I'm doing a logistic regression with an ordinal variable. I'd like to set the contrasts on the ordinal variable. However, when I set the contrasts, they work for ordinary linear regression (lm), but not logistic regression (lrm): ddist = datadist(bin.time, exp.loc) op

[R] formatting dates in axis labels (ggplot2)

2009-11-14 Thread Michael Friendly
I'm having trouble figuring out how to format Date variables when used as axis labels in graphs. The particular case here is an attempt to re-create Nightingale's coxcomb graph with ggplot2, where I'd like the months to be labeled as "Mar 1885", "Apr 1885", using a date format of "%b %Y" applied

[R] Best advice for connect R and Octave

2009-11-14 Thread Jason Rupert
I see at one time there was a package called ROctave. I tried to install that package: > install.packages("ROctave") --- Please select a CRAN mirror for use in this session --- Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘ROctave’ is not available Unfortu

Re: [R] Problems by saving Rprofile.site under vista

2009-11-14 Thread Charles Annis, P.E.
You may have to run R as Administrator (right-click, choose run as administrator) to make these kinds of changes. After you have things the way you like them, run R in the usual way by clicking on the icon. Charles Annis, P.E. charles.an...@statisticalengineering.com 561-352-9699 http://www.St

Re: [R] vignettes: .png graphics or pre-compiled .pdf

2009-11-14 Thread Michael Friendly
Thanks, Yihui Your solution, for png(), only looks dirty because you had to hack the Sweave code. It would be nice to have png() support included directly. Yihui Xie wrote: I was reminded that the attachments were blocked by the list, so I send these links again: http://yihui.name/en/wp-conte

Re: [R] refactoring in R

2009-11-14 Thread Tobias Verbeke
Hi Peng, I'm wondering which eclipse I shall download to use with StatET. Would you please let me know? http://www.eclipse.org/downloads/ This depends on your needs other than R programming. As you can see, there are Eclipse Packages targeted at C/C++ developers, PHP developers, Java EE devel

Re: [R] R and Python

2009-11-14 Thread lgautier
There appear to be win32 binaries for the the current release of rpy2. L. On Nov 4, 4:21 pm, Gabor Grothendieck wrote: > As far as I know the latest versions of neither RSpython norrpy2 > support Windows. For accessing SymPy (which is a python computer > algebra system) from R rSymPy went wi

Re: [R] cleanse columns and unwanted rows

2009-11-14 Thread frenchcr
The full code and error message i get is... > cleanse <- function(a){ + data1<-a + for (i in 1:dim(data1)[1]) + { + if (data1[i,"legal_status"] == "Private"){ + data1[i,"legal_status"]<-data1[-i,] + if (data1[i,"legal_status"] == "Private (Op"){ + data1[i,"legal_status"]<

Re: [R] cleanse columns and unwanted rows

2009-11-14 Thread frenchcr
The solution is much simpler (thanks Phil!) new_data = data[!data$"legal status" %in% c("Private","Private (Op","Unknown"),] ...works nicely. frenchcr wrote: > > hello folks, > > Im trying to clean out a large file with data i dont need. > The column im manipulating in the file i

Re: [R] Silently loading an R package.

2009-11-14 Thread Guillaume Yziquel
Yihui Xie a écrit : please read the 'Details' section of ?require To suppress messages during the loading of packages use 'suppressPackageStartupMessages': this will suppress all messages from R itself but not necessarily all those from package authors. Regards, Yihui Thank you

Re: [R] A combinatorial optimization problem: finding the best permutation of a complex vector

2009-11-14 Thread Ravi Varadhan
Hi, I have solved the problem that I had posed before. Here is a statement of the problem: "I have a complex-valued vector X in C^n. Given another complex-valued vector Y in C^n, I want to find a permutation of Y, say, Y*, that minimizes ||X - Y*||, the distance between X and Y*. " I was t

Re: [R] refactoring in R

2009-11-14 Thread Peng Yu
I'm wondering which eclipse I shall download to use with StatET. Would you please let me know? http://www.eclipse.org/downloads/ On Sat, Nov 14, 2009 at 5:46 AM, Tobias Verbeke wrote: > Hi Peng, > > Some of the refactoring methods I identified back > then were integrated into Eclipse/StatET in t

Re: [R] linear model and by()

2009-11-14 Thread David Winsemius
On Nov 13, 2009, at 11:49 AM, Sam Albers wrote: Hello R list, snipped answered question Sorry to not use your data but it's not in a form that lends itself very well to quick testing. If you had included the input commands I might have tried it. No problem not use my data. For futur

[R] a problem about GPD distribution fit

2009-11-14 Thread fuzuo xie
If i want to fit my data using gpd(data) in a extreme theory packages , how can i fit the lower tail of my data ?? the gpd function seems just has upper threshold , so ,if i want to fit the lower tail of my data , i have to use gpd(-data) . can i fit the lower tail just use gpd(data)

Re: [R] refactoring in R

2009-11-14 Thread Tobias Verbeke
Hi Peng, Some of the refactoring methods I identified back then were integrated into Eclipse/StatET in the mean time. StatET by the way contains some extensions that were not in the original proposal on that website. For the announcement of the latest release, see http://lists.r-forge.r-projec

Re: [R] R and HDF5 Question

2009-11-14 Thread Paul Hiemstra
Hi, You can also read the hdf5 files with the rgdal package. This loads them into sp-objects, see the sp-package for more info. In the archives of the r-sig-geo mailing list there have been some other people (including myself :)) that have asked this question: https://stat.ethz.ch/pipermail/

Re: [R] Change working directory

2009-11-14 Thread Gabor Grothendieck
On Fri, Nov 13, 2009 at 6:24 PM, Don MacQueen wrote: > In R for Macintosh, there is a Preferences setting that will do this. > You can also drag and drop a file onto the R icon and I believe it will > change the working directory to the directory that contains the file. > > On unix-like systems, u

Re: [R] Change working directory

2009-11-14 Thread Jim Lemon
anna_l wrote: Hello, I am using setwd() to change the working directory but I have to enter it everytime I open R, is there a way to set this permanently as a working directory? Thanx =^D Hi Anna, I create a .First function that is run when the session starts that looks like this: .First<

Re: [R] shrink list by mathed entries

2009-11-14 Thread Soeren . Vogel
On 14.11.2009, at 03:58, David Winsemius wrote: On Nov 13, 2009, at 11:19 AM, soeren.vo...@eawag.ch wrote: a <- c("Mama", "Papa", "Papa; Mama", "", "Sammy; Mama; Papa") a <- strsplit(a, "; ") mama <- rep(F, length(a)) mama[sapply(a, function(x) { sum(x=="Mama") }, simplify=T) > 0] <- T [...]

[R] setting contrasts for a logistic regression

2009-11-14 Thread w_poet
Hi everyone, I'm doing a logistic regression with an ordinal variable. I'd like to set the contrasts on the ordinal variable. However, when I set the contrasts, they work for ordinary linear regression (lm), but not logistic regression (lrm): ddist = datadist(bin.time, exp.loc) options(datadist=

Re: [R] R and HDF5 Question

2009-11-14 Thread Scott MacDonald
That did it, boy do I feel silly. Thanks! On Fri, Nov 13, 2009 at 10:16 PM, Berwin A Turlach wrote: > G'day Scott, > > On Fri, 13 Nov 2009 09:52:43 -0700 > Scott MacDonald wrote: > > > I am trying to load an hdf5 file into R and running into some > > problems. > > It's a while that I used hdf5