[R] Fatal error: you must specify '--save', '--no-save' or '--vanilla'
Hi, I get the above error when starting my program with rake (ruby make) instead of manual startup (which works as expected). It happens on R initialization with REmbeddedPostgres --gui=none --silent as arguments (this is part of my way of embedding R in a C application using libR.so). Any help would be appreciated! Greetings, Andreas -- http://www.maunz.de Yoda of Borg are we: Futile is resistance. Assimilate you, we will. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with PCA
On 3/3/08, Richard Rowe [EMAIL PROTECTED] wrote: This is a homework problem. I know how to do a PCA, you need to learn. I suggest you visit your textbook, then check the documentation for R's various PCA implementations to work out how to effect the analysis. Check Rcmdr. There you can perform it graphically. This would be a starting point. This page [1] should also be of interest. [1] http://www.statmethods.net/advstats/factor.html Liviu __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] handling big data set in R
Dear Shu, Why not store your dataset in a database? Then you can start each loop by reading the submatrix you need for the analysis. This will require much less memory. loops from the apply-family with work better than the for loop. HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens shu zhang Verzonden: maandag 3 maart 2008 6:35 Aan: r-help@r-project.org Onderwerp: [R] handling big data set in R Hello R users, I'm wondering whether it is possible to manage big data set in R? I have a data set with 3 million rows and 3 columns (X,Y,Z), where X is the group id. For each X, I need to run 2 regression on the submatrix. I used the function split: datamatrix-read.csv(datas.csv, header=F, sep=,) dim(datamatrix) # [1] 2980523 3 names(datamatrix)-c(X,Y,Z) attach(datamatrix) subX-split(X, X) subY-split(Y,X) subZ-split(Z,X) n-length(subdata) ### number of groups s1-s2-rep(NA, n) ### vector to store the regression slope for (i in 1:n){ a-table(Y[[i]]) table.x-as.numeric(names(a)) table.y-as.numeric(a) fit1-lm(table.y~table.x)# find the slope of the histogram of y s1[i]-fit$coefficients[2] fit2-lm(subY[[i]]~subZ[[i]]) ### regress y on z s2[i]-fit$coefficients[2] } But my R died before completing the loop... (I've thought about doing it in SAS, but I don't know how to write a loop combined with a PROC REG...) One thing that might be helpful is that my data set has already been sorted based on X. I don't know whether this can be any helpful for managing the dataset. Any suggestion would be appreciated! Thanks! -Shu __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] handling big data set in R
On 3/3/08, shu zhang [EMAIL PROTECTED] wrote: Hello R users, I'm wondering whether it is possible to manage big data set in R? I This [1] recent thread might be of interest. Liviu [1] http://www.nabble.com/How-to-read-HUGE-data-sets--tt15729830.html __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] regression output to latex
On Sunday 02 March 2008 (18:50:53), Luca Braglia wrote: hello everybody i was seeking a converter beetween R regression output (eg with summary) and the conventional way to present regression output in paper: every model as a vertical vector with \beta, t beetween parenthesis below the first, and other statistics (R^2 etc) . Function 'mtable' from the package 'memisc' is designed to do this. Maybe that is what you are looking for ... Best, Martin - Dr. Martin Elff Faculty of Social Sciences LSPWIVS (van Deth) University of Mannheim A5, 6 68131 Mannheim Germany Phone: +49-621-181-2093 Fax: +49-621-181-2099 E-Mail: [EMAIL PROTECTED] Web: http://webrum.uni-mannheim.de/sowi/elff/ http://www.sowi.uni-mannheim.de/lspwivs/ __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] silhouette plot for kmeans result
Dear All, Is there any existing code for plotting silhouette for kmeans clustering results? Many thanks! Linda [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Studdy Missing Data, differentiate between a percent with in the valid answers and with in the different missing answers
On 3/3/08 8:21 PM, Ericka Lundström wrote: I'm trying to emigrate from SPSS to R, thou I have some problems whit getting R to distinguish between the different kind of missing. ... Is there a smart way in R to differentiate between missing and valid and at the same time treat both the categories within missing and valid as answers (like SPSS did above) The Hmisc package has some support for special missing values, for instance when reading in SAS datasets using sas.get. I don't believe spss.get offers the same facility, though. You can define special missing values for a variable manually, which might seem a bit involved, but this could easily be automated. For your example, try: special - dataFrame$TWO %in% c(?,X) attr(dataFrame$TWO, special.miss) - list(codes=as.character(dataFrame$TWO[special]), obs=(1:length(dataFrame$TWO))[special]) class(dataFrame$TWO) - c(factor, special.miss) is.na(dataFrame$TWO) - special # Then describe gives new percentages describe(dataFrame$TWO) dataFrame$TWO n missing ? X unique 3 4 2 2 2 No (2, 67%), yes (1, 33%) HTH, James -- James Reilly Department of Statistics, University of Auckland Private Bag 92019, Auckland, New Zealand __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] glm: offset
On Mon, 3 Mar 2008, [EMAIL PROTECTED] wrote: On 03-Mar-08 03:19:01, Wensui Liu wrote: HI, John, my understanding is that you should use log(...) instead of its original scale. Below is the logic in the case of poisson reg. log(y / offset) = x'b = log(y) - log(offset) = x'b = log(y) = x'b + log(offset) Well, this is where it gets interesting! The above statement of the logic begs the question (i.e. assumes the answer). I would go according to the general interpretation of offset in LM and GLM modelling -- an offset is a quantitative variable whose regression coefficient is known to be 1 [McCullough and Nelder (1983) Generalised Linear Models, page 138] Yes, and that is how it is defined in R too -- see ?offset. The issue is more what you want to do with the offset. In a Poisson regression, the offset is most often used to include exposure time, the Poisson model being for log rate. Thus mu = lambda*T, log(lamba) = Xb means log(mu) = Xb + log(T) is the model for Poisson counts of occurrences in time intervals and hence the offset is log(T). As ?offset hints, there are examples under ?glm (taken from MASS) and for dataset Insurance in package MASS. One with non-logged offset and one with Since the GLM for a Poisson regression with log link is to model L = log(mu) = a + b1*X1 + B2*X2 + ... mu is the Poisson mean, and where X1, X2, ... are the raw (untransformed, unless you have other reasons for tranforming them prior to bringing them into the regression) explanatory variables, if X1 is the variable you wish to use as offset in the above sense then it should be used un-transformed. On this basis, the answer to John Sorkin's question should be: don't use log(NumUniPt), use NumUniPt. There's a potential confusion here in that presumably NumUniPt may be a positive variable whose distribution in the data may be skew, i.e. the sort of variable that you may feel urged to take the log of before using it. But that would be an other reason in the sense of my comment above. After all, suppose NumUniPt denoted a variable in the data that could take negative values. Would you be happy to use log(NumUniPt) in that case? Best wishes to all, Ted. On Sun, Mar 2, 2008 at 10:01 PM, John Sorkin [EMAIL PROTECTED] wrote: R 2.6.0 Windows XP A question about running a generalized linear model. I am running a glm with (1) a poisson distribution and a log link: family=poisson(link = log) and an offset. I would like to know if I should express the offset as the log of the offset value, i.e. offset=log(NumUniqPt) or as: offset=NumUniqPt I suspect I need to use the log, bu t I can't find any discussion of this in MASS 1994 or on the man page for glm. Thanks John -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem plotting curve on survival curve (something silly?)
Calum wrote: All of that is very nice so far. The I followed bits and pieces of other peoples posts in the past to plot on a weibull regression... my_curve.Plac - survreg( Surv(Survival, Censored==0)~ TreatmentGroup, subset=TreatmentGroup==Placebo, data=TestData, dist='weibull') Peter wrote: I'd take a hard look at the pweibull(...) bit. Is scale really what you want it to be? If coef(my_curve.Pred) is not a scalar, then it gets recycled, which could easily cause oscillations. Aha - found it. Its from my attempt to subgroup the data before I discovered subset... I now have a curve instead of an oscillation. Now possibly that curve is wrong... will need to do more reading! For reference the line above should read: my_curve.Plac - survreg( Surv(Survival, Censored==0)~ 1, subset=TreatmentGroup==Placebo, data=TestData, dist='weibull') Also is it possible to get an R-squared type value for the fit of this curve from someplace? Finally (three questions in one!) the first two censored data points (1 in each group) are actually lost to follow-ups. Should they be marked differently from censored? Customarily they are not. (I'm sure it is possible to speculate at length about it, though.) Going off topic a bit - but did you mean customarily they are not censored or customarily they are not handled differently from censored! Nothing spectacularly incompetent this far... (I'm not happy with R^2 measures outside of linear models, or even within linear models, but several well-reputed people do find them useful, so who am I to bicker?) I'm not competent to argue. But are you suggesting there is a better way to assess fit of the line to the data? Thats what I want - Not being a statistician I'm not fussed how its done. But If I'm going to extrapolate a line I'd like to know its a reasonable fit first (is that purely by eye?) There is a p value reported by survreg but no idea how to interpret it ;-) __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] unable to start device PNG and unable to open connection to X11 display
Hi, I consulted ?png, and it uses X11. is there any way to save plots into png, without using X11 ? On 3/3/08, Prof Brian Ripley [EMAIL PROTECTED] wrote: Please consult the help page for png. On Mon, 3 Mar 2008, Ng Stanley wrote: Hi, I have installed R on a computational cluster, and am using putty to access R. Please help on how to solve the problem of saving png files. png(file=myplot.png, bg=transparent) Error in X11(paste(png::, filename, sep = ), width, height, pointsize, : unable to start device PNG In addition: Warning message: unable to open connection to X11 display '' [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] listing components of an object
Does names(obj) do what you want? Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Nair, Murlidharan T wrote: Is there a method to list the components of an object, instead of looking at the help for that method? Let me be more clear with an example data(iris) ## tune `svm' for classification with RBF-kernel (default in svm), ## using one split for training/validation set obj - tune(svm, Species~., data = iris, ranges = list(gamma = 2^(-1:1), cost = 2^(2:4)), tunecontrol = tune.control(sampling = fix) ) ## alternatively: ## obj - tune.svm(Species~., data = iris, gamma = 2^(-1:1), cost = 2^(2:4)) summary(obj) plot(obj) - For tune, an object of class tune, including the components: best.parameters a 1 x k data frame, k number of parameters. best.performance best achieved performance. performances if requested, a data frame of all parameter combinations along with the corresponding performance results. train.ind list of index vectors used for splits into training and validation sets. best.model if requested, the model trained on the complete training data using the best parameter combination. I got the above by doing ?tune. Is there a function that helps be do this? Thanks ../Murli __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Imputation Packages
On 3/3/08 6:42 AM, ArunPrasad wrote: Hi everyone, I am looking for a package in R which can help me in using the imputation technique to find the missing values for my regression analysis. Any help would be appreciated. Cheers Arun Have a look at the Missing data sections of the Multivariate and SocialSciences task views on CRAN: http://cran.r-project.org/web/views/ James -- James Reilly Department of Statistics, University of Auckland Private Bag 92019, Auckland, New Zealand __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem with mt.teststat function
Dear Sir/Madam, Am using mt.teststat function from 'multtest' package. My variable to 'classlabel' argument having 'NA'.I tried to get rid of this by using na=.mt.naNUM. But this parameter is not working. I understood from help file that this haven't fully implemented yet. Could yo suggest any other way to solve this problem? Thanks in advance Gireesh Kumar [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to assign identifiers to objects being clustered
I have a number of non-periodic signals , that have been detrended and denoised. Each signal is made up of a variable number of cycles non necessarily of the same length. We can now fit a regression model to each cycle and then use the returned coefficients, together with some other data, to form clusters. We would like to keep track of which signal each cycle came from in the clusters layout. It must be a trivial problem. However I cannot pass such identifier to the routines that calculate the similarity matrix as it would be used in the distance calculation process. So I ran out of ideas about how to keep the clustering objects (cycles) distinguishable all along the clustering process (calculation of similarity matrix and later clustering). Is that doable at all ? Thank you so much, -- Maura E.M __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fatal error: you must specify '--save', '--no-save' or '--vanilla'
Andreas Maunz wrote: Hi, I get the above error when starting my program with rake (ruby make) instead of manual startup (which works as expected). It happens on R initialization with REmbeddedPostgres --gui=none --silent as arguments (this is part of my way of embedding R in a C application using libR.so). Any help would be appreciated! So you have not tried to add one of the mentioned flags? Uwe Ligges Greetings, Andreas __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plot using colors
Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab=zeit [s],ylab=Variation [%], col = ifelse(var = varstability, 'green','red')) this works well! But since I add a type=l to my plot, it will color all the plot with green!!! Is there any solution? I avoid to use teachingDemos. Thanks. -- View this message in context: http://www.nabble.com/Plot-using-colors-tp15799930p15799930.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function to convert a number to text
lin tang wrote: hi, Dear R users - I wonder is there a written R function to convert a number to a text, say convert 1 to one , 100 to one hundred. I know in xls. has such a function BAHTTEXT, does anybody know is there a similar function in R ? Thanks. Hi Lin, I got bored after the millions, but this should handle the smaller numbers, and you can always extend it. digits2text-function(x,mult=) { units-c(one,two,three,four,five, six,seven,eight,nine) teens-c(ten,eleven,twelve,thirteen,fourteen, fifteen,sixteen,seventeen,eighteen,nineteen) tens-c(ten,twenty,thirty,forty,fifty, sixty,seventy,eighty,ninety) digits-rev(as.numeric(strsplit(as.character(x),)[[1]])) digilen-length(digits) if(digilen == 2 digits[2] == 1) return(teens[digits[1]+1]) digitext-units[digits[1]] if(digilen 1) digitext-c(digitext,tens[digits[2]]) if(digilen 2) digitext-c(digitext,hundred,units[digits[3]]) if(digilen 3) digitext- c(digitext,digits2text(floor(x/1000),thousand)) if(digilen 6) digitext- c(digitext,digits2text(floor(x/100),million)) return(paste(c(rev(digitext),mult),sep=,collapse= )) } Jim __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fatal error: you must specify '--save', '--no-save' or '--vanilla'
Uwe Ligges wrote: Andreas Maunz wrote: Hi, I get the above error when starting my program with rake (ruby make) instead of manual startup (which works as expected). It happens on R initialization with REmbeddedPostgres --gui=none --silent as arguments (this is part of my way of embedding R in a C application using libR.so). Any help would be appreciated! So you have not tried to add one of the mentioned flags? I did, actually! ;-) Increasing the options to REmbeddedPostgres --no-save --gui=none --silent results in the following: Error: syntax error in: ironment - function () .Internal(environment(NULL)) mkenv - function() .Internal(new.env(TRUE, baseenv(), 29L The code is taken from http://developer.r-project.org/embedded.html (Initializing R from within an Application). Again, I want to stress that the program works as expected when calling it directly, or via a shell skript. It is a C application that listens as a daemon on some port, using fork() and output redirection to a socket (at first I suspected this could be a problem). Best regards, Andreas Maunz -- http://www.maunz.de Yoda of Borg are we: Futile is resistance. Assimilate you, we will. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] names of data.frame variables?
Hi there! I'd like to make many tests and plots, for each variables. i.E. i - 1 repeat { print (t.test(e[i], f[i])) i - i + 1 if (i == 21) break } but the output is: Welch Two Sample t-test data: e[i] and f[i] ... so I don't know which data was calculated. Is there a way to tell the t.test or I'll make the same with plotmeans (from the gplots library) but I'd like to have it like t.text(e$angststoer, f$angststoer) so I know what was calculated or plotted... Any ideas? Thanks, Martin -- Ihr Partner für Webdesign, Webapplikationen und Webspace. http://www.roomandspace.com/ Martin Kaffanke +43 650 4514224 signature.asc Description: Dies ist ein digital signierter Nachrichtenteil __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Odp: Newbie:Export Data into Excel from R
Hi you can also write.table(probe_gene, file = c:/foo.xls, sep = \t, col.names = NA) or write.table(tab, clipboard, sep = \t , col.names = NA) and after opening Excel just press Ctrl-V. Maybe you also find usefull to add row.names=FALSE into export construction. Petr [EMAIL PROTECTED] [EMAIL PROTECTED] napsal dne 02.03.2008 16:12:51: Hi, All i want is to export my list into c: drive and save it as csv file and manually import into Excel. I have the read the article but i am having issues http://pbil.univ-lyon1.fr/library/base/html/write.table.html excel-write.table(probe_gene, file = c:\foo.csv, sep = ,, col.names = NA) Error in file(file, ifelse(append, a, w)) : unable to open connection In addition: Warning message: cannot open file 'c:\foo.csv', reason 'Invalid argument' any suggestions? thanks, chris -- View this message in context: http://www.nabble.com/Newbie%3AExport-Data-into- Excel-from-R-tp15788950p15788950.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R data Export to Excel
The other respondants here have missed the point - write.table() as invoked by the OP does not produce a csv file. The default separator is (a space) in write.table(), so no wonder Excel cocked it up as it assumes that a csv file is one that has elements separated by a comma ,. We don't need to rely on extra packages or using Excel to fix-up the file written by R - just use R's tools appropriately. Kei, some points. Did you actually try to run the example you provided? It failed on line 4 for me as you use data.matrix as a name for an object and it is an R function, which R says can't be subset as data.matrix[x, ] in the call to apply. Instead of being able to step through your code to see where the problem was I spent a few minutes trying to fix it up and decipher what you intended before I spotted the call to write.table. Secondly, space out your code - it makes it much easier to read if you put spaces round -, e.g.: x - 1:2 and leave a space after the , comma separating arguments in function calls. Now to the answer (or one possible answer) To generate a proper csv file, see ?write.csv, or ?write.csv2 if you are in of those strange countries that uses a comma as the decimal separator. Because your example doesn't work, I can't test this, but this should give you a csv file that opens in Excel as you want: write.csv(cbind(data[1], Variance=apply(data[,y], 1, var)), file=c://variance.csv) HTH G On Sun, 2008-03-02 at 18:59 -0800, Keizer_71 wrote: Here is my R Code x-1:2 y-2:141 data.matrix-data.matrix(data[,y])#create data.matrix variableprobe-apply(data.matrix[x,],1,var) variableprobe #output variance across probesets hist(variableprobe) #displaying histogram of variableprobe write.table(cbind(data[1], Variance=apply(data[,y],1,var)),file='c://variance.csv') #export as a .csv file. Output in Excel all in 1 column. ProbeID Variance 1 224588_at 21.5825745738848 How do i separate them so that i can have three columns ProbeID Variance 1 224588_at 21.582. thanks, Kei -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Somer's Ordinal Association Measures
Does anybody know how one can implement the Somer's and Goodman -Kruskal ordinal measures of association in R? With regards - [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] names of data.frame variables?
One option is: head(f) A B C D E 1 0.75135094 -0.06779700 -0.2617316 -0.3701998 0.7332249 2 -0.85657366 0.27442139 -0.4291410 0.1107827 0.6942490 3 1.16125212 -0.18631979 -0.3918744 0.4804644 0.9374566 4 0.32100928 0.03773391 -0.8712896 -0.5236532 0.9064957 5 -0.24852361 -1.24139700 -0.4990958 -1.6720261 -0.8791833 6 0.00582175 -0.28361208 -0.4450383 -0.4248984 -0.7066752 head(e) AB C D E 1 -2.4420422 -0.380338676 0.2330927 -1.2107826 -1.90697224 2 -0.6070602 -0.304334094 1.0082733 2.0308774 -0.3029 3 0.8933633 1.883316570 -0.4431651 0.5203559 -2.57122258 4 -0.5415851 0.370019811 -1.7851152 0.4373462 -0.92199391 5 -0.7092424 0.003823628 -0.4314738 0.5156975 -0.19511293 6 -1.4816483 0.187447079 -1.0240595 0.1666378 -0.06966855 lapply(names(e), function(x)eval(bquote(t.test(e[.(x)], f[.(x)] On 03/03/2008, Martin Kaffanke [EMAIL PROTECTED] wrote: Hi there! I'd like to make many tests and plots, for each variables. i.E. i - 1 repeat { print (t.test(e[i], f[i])) i - i + 1 if (i == 21) break } but the output is: Welch Two Sample t-test data: e[i] and f[i] ... so I don't know which data was calculated. Is there a way to tell the t.test or I'll make the same with plotmeans (from the gplots library) but I'd like to have it like t.text(e$angststoer, f$angststoer) so I know what was calculated or plotted... Any ideas? Thanks, Martin -- Ihr Partner für Webdesign, Webapplikationen und Webspace. http://www.roomandspace.com/ Martin Kaffanke +43 650 4514224 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fatal error: you must specify '--save', '--no-save' or '--vanilla'
Andreas Maunz wrote: Hi, I get the above error when starting my program with rake (ruby make) instead of manual startup (which works as expected). It happens on R initialization with REmbeddedPostgres --gui=none --silent as arguments (this is part of my way of embedding R in a C application using libR.so). Any help would be appreciated! That message means that R thinks it is being run non-interactively, which sounds appropriate in your case. Choose one of the options. You'll also inappropriately get the message when running R in some shells that don't look like consoles to R. Then the right solution is to use --ess (which tells R that despite what it sees, it really is being run interactively.) So you have not tried to add one of the mentioned flags? I did, actually! ;-) Increasing the options to REmbeddedPostgres --no-save --gui=none --silent results in the following: Error: syntax error in: ironment - function () .Internal(environment(NULL)) mkenv - function() .Internal(new.env(TRUE, baseenv(), 29L That's because you're using an obsolete version of R, that doesn't support the integer constant 29L. Duncan Murdoch __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot using colors
On Mon, Mar 03, 2008 at 02:03:07AM -0800, mysimbaa wrote: Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab=zeit [s],ylab=Variation [%], col = ifelse(var = varstability, 'green','red')) this works well! But since I add a type=l to my plot, it will color all the plot with green!!! Please include this too. -- Hans Ekbrand (http://sociologi.cjb.net) [EMAIL PROTECTED] GPG Fingerprint: 1408 C8D5 1E7D 4C9C C27E 014F 7C2C 872A 7050 614E signature.asc Description: Digital signature __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot using colors
You want just the points with colors? var - rnorm(10) vars - rnorm(10) plot(var, type='l') points(var, col=ifelse(var vars, 'green', 'red'), pch= 16) or the lines also? for(i in 1:9)segments(i, var[i], i + 1, var[i+1], ifelse(var[i] vars[i], 'green', 'red')) On 03/03/2008, mysimbaa [EMAIL PROTECTED] wrote: Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab=zeit [s],ylab=Variation [%], col = ifelse(var = varstability, 'green','red')) this works well! But since I add a type=l to my plot, it will color all the plot with green!!! Is there any solution? I avoid to use teachingDemos. Thanks. -- View this message in context: http://www.nabble.com/Plot-using-colors-tp15799930p15799930.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Somer's Ordinal Association Measures
Does anybody know how one can implement the Somer's and Goodman -Kruskal ordinal measures of association in R? install.packages(Hmisc) library(Hmisc) ?rcorr.cens HTH, Tobias __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] silhouette plot for kmeans result
LS == Linda Smith [EMAIL PROTECTED] on Mon, 3 Mar 2008 00:57:49 -0800 writes: LS Dear All, LS Is there any existing code for plotting silhouette for kmeans clustering LS results? Yes. Have you tried at all? Anyway, here's some commented example code (with a largish data) : library(cluster) data(xclara) plot(xclara) # 3000 observations; a bit large for dissimilarity plotting km - kmeans(xclara,3) ## Now the silhouette concept builds on dissimilarities ## e.g. dissE - daisy(xclara) #- large (!) 3000 x 3000 / 2 sk - silhouette(km$cl, dissE) plot(sk) ## but kmeans is rather equivalent to work with {D_ij}^2, ## hence this better corresponds: dE2 - dissE^2 sk2 - silhouette(km$cl, dE2) plot(sk2) LS Many thanks! LS Linda you're welcome. Martin Maechler, ETH Zurich __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function to convert a number to text
Jim Lemon wrote: I got bored after the millions, but this should handle the smaller numbers, and you can always extend it. digits2text-function(x,mult=) { units-c(one,two,three,four,five, six,seven,eight,nine) teens-c(ten,eleven,twelve,thirteen,fourteen, fifteen,sixteen,seventeen,eighteen,nineteen) tens-c(ten,twenty,thirty,forty,fifty, sixty,seventy,eighty,ninety) digits-rev(as.numeric(strsplit(as.character(x),)[[1]])) digilen-length(digits) if(digilen == 2 digits[2] == 1) return(teens[digits[1]+1]) digitext-units[digits[1]] if(digilen 1) digitext-c(digitext,tens[digits[2]]) if(digilen 2) digitext-c(digitext,hundred,units[digits[3]]) if(digilen 3) digitext- c(digitext,digits2text(floor(x/1000),thousand)) if(digilen 6) digitext- c(digitext,digits2text(floor(x/100),million)) return(paste(c(rev(digitext),mult),sep=,collapse= )) } Be careful, the function does not handle empty fields: digits2text(10^6 + 10) [1] one million one thousand hundred thousand hundred ten Alberto Monteiro (today I am purely destructive) __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function to convert a number to text
check also the article by John Fox in Rnews volume 5/1, May 2005, Programmer's Niche 51-55: http://cran.r-project.org/doc/Rnews/Rnews_2005-1.pdf Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Jim Lemon [EMAIL PROTECTED] To: lin tang [EMAIL PROTECTED] Cc: r-help@r-project.org Sent: Monday, March 03, 2008 11:38 AM Subject: Re: [R] R function to convert a number to text lin tang wrote: hi, Dear R users - I wonder is there a written R function to convert a number to a text, say convert 1 to one , 100 to one hundred. I know in xls. has such a function BAHTTEXT, does anybody know is there a similar function in R ? Thanks. Hi Lin, I got bored after the millions, but this should handle the smaller numbers, and you can always extend it. digits2text-function(x,mult=) { units-c(one,two,three,four,five, six,seven,eight,nine) teens-c(ten,eleven,twelve,thirteen,fourteen, fifteen,sixteen,seventeen,eighteen,nineteen) tens-c(ten,twenty,thirty,forty,fifty, sixty,seventy,eighty,ninety) digits-rev(as.numeric(strsplit(as.character(x),)[[1]])) digilen-length(digits) if(digilen == 2 digits[2] == 1) return(teens[digits[1]+1]) digitext-units[digits[1]] if(digilen 1) digitext-c(digitext,tens[digits[2]]) if(digilen 2) digitext-c(digitext,hundred,units[digits[3]]) if(digilen 3) digitext- c(digitext,digits2text(floor(x/1000),thousand)) if(digilen 6) digitext- c(digitext,digits2text(floor(x/100),million)) return(paste(c(rev(digitext),mult),sep=,collapse= )) } Jim __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function to convert a number to text
Try RSiteSearch(numbers2words) On Sun, Mar 2, 2008 at 9:05 PM, lin tang [EMAIL PROTECTED] wrote: hi, Dear R users - I wonder is there a written R function to convert a number to a text, say convert 1 to one , 100 to one hundred. I know in xls. has such a function BAHTTEXT, does anybody know is there a similar function in R ? Thanks. Lin - [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make plots with GNUplot. Have anyone tried that?
On Fri, Feb 29, 2008 at 11:12 PM, Louise Hoffman [EMAIL PROTECTED] wrote: [snip] Seriously. Be specific if you have a problem. (read the posting guide). R can also plot. If you don't like R's plots (which I could not understand) you can export data and import them to gnuplot. So what? Okay, my post was not very good. The reason (I think) I need GNUplot, is that I would like to include the plots from R in a Latex report, where I would like to have all the text and equations in the plots with the same font as used in Latex. So when I read about opening and closing dev for making a pdf I figured that the plots that R produces are like the once Matlab makes; shows what they ought to, nothing more, nothing less. So I was wondering if anyone know of an GNUplot friendly format and the code that would produce that text file. I am new to both R and GNUplot, so I am pure ears if someone knows how to make such plots in R. Hi Louise, In addition to what Paul Murrell linked to regarding latex fonts, take a look at demo(plotmath). I really don't think you have to go outside of R to do what you want. In addition, if you aim to end up with a latex report I strongly encourage you to try out ?Sweave. It has certainly helped to streamline my workflow. Regards, Gustaf -- Gustaf Rydevik, M.Sci. tel: +46(0)703 051 451 address:Essingetorget 40,112 66 Stockholm, SE skype:gustaf_rydevik __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] unable to start device PNG and unable to open connection to X11 display
On Mon, Mar 3, 2008 at 1:25 AM, Ng Stanley [EMAIL PROTECTED] wrote: Hi, I consulted ?png, and it uses X11. is there any way to save plots into png, without using X11 ? See See also under help(png) for alternatives. Rule of thumb: If you get a reply from BR that you don't get the first time you read it, then read it again - the answer is there. See also thread '[R] jpeg in batch mode' on 2008-02-21, cf. https://stat.ethz.ch/pipermail/r-help/2008-February/155021.html /Henrik On 3/3/08, Prof Brian Ripley [EMAIL PROTECTED] wrote: Please consult the help page for png. On Mon, 3 Mar 2008, Ng Stanley wrote: Hi, I have installed R on a computational cluster, and am using putty to access R. Please help on how to solve the problem of saving png files. png(file=myplot.png, bg=transparent) Error in X11(paste(png::, filename, sep = ), width, height, pointsize, : unable to start device PNG In addition: Warning message: unable to open connection to X11 display '' [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] while loop syntax help
zack holden: I need to sort through a vector (x) and identify the point at which 2 successive values become smaller than the previous value. x - c(5,5,7,6,5,4,3) a=c(diff(x, 1) 0, FALSE) c(diff(x, 2) 0, FALSE, FALSE) a # FALSE FALSE TRUE TRUE TRUE FALSE FALSE which(a) # 3 4 5 Heikki Kaskelma __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Jpeg and margin table, second attempt
Hi R-users, Maybe my last question was not specified enough to get a lot of answers, so I'm trying to do a new attempt: I use R 2.6.2 and Windows XP. I've got the following question: I wrote a lot of text into the margin of a plot. I have to take the borders of the graphics device and enlarge the plot to get a clean image. By default the plot and the table on the right side are stacked. Because I think, that many of the readers were afraid of the long source code I won't post it again, just a link to it on the R-Help-Archive: https://stat.ethz.ch/pipermail/r-help/2008-March/155801.html When I use the jpeg-function, only a little part of the margin text is displayed in the final jpeg? Any ideas to change it? The idea of Jim (using x11) produced another bug for me: A new window was created at first, then everything was plotted into the second-one. Thx, Thomas __ Thomas Schwander KS.R Konzern-Risikocontrolling Telefon 3115 Telefax 3664 [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Imputation Packages
Dear James and Arun, The Social Sciences task view is out of date (updating it is on my to-do list), and I'm aware of at least one other package, Amelia, for multiple imputation of missing data (which isn't mentioned in the more up-to-date Multivariate task view). There are probably others as well. Regards, John John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] project.org] On Behalf Of James Reilly Sent: March-03-08 4:48 AM To: ArunPrasad Cc: r-help@r-project.org Subject: Re: [R] Imputation Packages On 3/3/08 6:42 AM, ArunPrasad wrote: Hi everyone, I am looking for a package in R which can help me in using the imputation technique to find the missing values for my regression analysis. Any help would be appreciated. Cheers Arun Have a look at the Missing data sections of the Multivariate and SocialSciences task views on CRAN: http://cran.r-project.org/web/views/ James -- James Reilly Department of Statistics, University of Auckland Private Bag 92019, Auckland, New Zealand __ 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/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make plots with GNUplot. Have anyone tried that?
LH == Louise Hoffman [EMAIL PROTECTED] on Sat, 1 Mar 2008 00:54:56 +0100 writes: If you still want to then read ?write.table, that can export your data into a spreadsheet-like ascii format which can be used from GNUplot easily. LH Very interesting. LH So if I e.g. write: LH ts.sim - arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200) LH ts.plot(ts.sim) LH How do I know the names of the rows to put in the data.frame() command? Btw, comparing the graphics capabilities of GNUplot and R, it is something like a three-wheel bicycle and a spaceship. Guess which is which. LH =) I know that I will most likely spend a lot of time on just making LH the plots, but I atleast (for now =) ) think it could be fun to try. if you make them with R, yes. I wholeheartedly support Gabor's point: I'd consider GNUplot to be clearly inferior to R -- just talking about the graphics possibilties and the quality / thoughtfulness in the high-level plotting. If you have your data / objects / functions in R, I'm very strongly convinced that using GNUplot for plotting is ``the wrong'' approach by almost all definitions of wrong. Martin Maechler, ETH Zurich __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Studdy Missing Data, differentiate between a percent with in the valid answers and with in the different missing answers
James Reilly wrote: On 3/3/08 8:21 PM, Ericka Lundström wrote: I'm trying to emigrate from SPSS to R, thou I have some problems whit getting R to distinguish between the different kind of missing. ... Is there a smart way in R to differentiate between missing and valid and at the same time treat both the categories within missing and valid as answers (like SPSS did above) The Hmisc package has some support for special missing values, for instance when reading in SAS datasets using sas.get. I don't believe spss.get offers the same facility, though. You can define special missing values for a variable manually, which might seem a bit involved, but this could easily be automated. For your example, try: special - dataFrame$TWO %in% c(?,X) attr(dataFrame$TWO, special.miss) - list(codes=as.character(dataFrame$TWO[special]), obs=(1:length(dataFrame$TWO))[special]) class(dataFrame$TWO) - c(factor, special.miss) is.na(dataFrame$TWO) - special # Then describe gives new percentages describe(dataFrame$TWO) dataFrame$TWO n missing ? X unique 3 4 2 2 2 No (2, 67%), yes (1, 33%) HTH, James Thanks for pointing out how this can be done with Hmisc, James. If the foreign package can sense SPSS special missing values in general, it would not be hard to add the special.miss mechanism to spss.get in Hmisc. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Script to start Rcmdr
Hi, anybody know any way to make a bash script to start Rcmdr directly widthout need to open R and execute library(Rcmdr)? I try to make this using R CMD BATCH somethink, but dont find the way. Thanks Ronaldo -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cox model+ROCR
Dear list, I am trying to build a cox model and then perform ROC analysis in order to retrieve some genes that are correlated with breast cancer. When I calculate the hazard score taking into account different numbers of genes and their coefficients ( I am trying to find the pest predictor number of genes), I retrieve from around 1 values (for few genes included ) to size of e+80 values (for many genes included). I am using the prediction method from the ROCR package which takes as arguments the calculated scores and the true class scores. I really don't know what to compare my values with, because the only data that I have available are the time to relapse or last follow-up (months) and the relapse score (1=TRUE, 0=FALSE) of the patients. I have never performed ROC analysis before and I am a bit lost... Any help with this is really very welcome! Thank you all, Eleni [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replace a list of values in data frame
On Friday 29 February 2008 (14:50:53), Silvia Lipski wrote: Dear R-users, I am sorry if I ask for something that has been asked before, however, I still could not solve my little problem by consulting the previous thread on this topic: I would like to replace several values in a data frame, such as in: colorful subject response 1 me black 2 me brown 3 you red 4 me black 5 you brown read in with read.table() I would like to replace both black and brown by dark. What about: colorful - within(colorful, test1 - replace(response, c(black,brown), dark ) ) or colorful - within(colorful, test1 - response test1[test1 %in% c(black,brown)] - dark ) __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Formating a zoo dataset .
Your code below changes the class of the time index from Date to character. Perhaps you want yearmon class. The following averages all values in each month producing a series with time class yearmon. See ?yearmon library(zoo) z - zoo(c(0.1423065, -0.03276228, -0.0652789, -0.04999873, -0.01447902, 0.22265729), as.Date(c(11047, 11075, 11108, 11138, 11169, 11200))) z aggregate(z, as.yearmon, mean) # Its also possible, though normally undesirable, to use character as your # index class but then for it to make sense you will need to choose a # representation which sorts appropriately under the usual rules for sorting: aggregate(z, format(time(z), %Y-%m), mean) On Mon, Mar 3, 2008 at 2:13 AM, Megh Dal [EMAIL PROTECTED] wrote: Suppose I have following dataset : head(data1) Date Return 1 03/31/00 0.14230650 2 04/28/00 -0.03276228 3 05/31/00 -0.06527890 4 06/30/00 -0.04999873 5 07/31/00 -0.01447902 6 08/31/00 0.22265729 Now I convert it to zoo object : data11 = zoo(data1[,2], as.Date(data1[,1], format=%m/%d/%y)) head(data11) 2000-03-31 2000-04-28 2000-05-31 2000-06-30 2000-07-31 2000-08-31 0.14230650 -0.03276228 -0.06527890 -0.04999873 -0.01447902 0.22265729 Clearly those are monthly data. Therefore I want to convert it to mm-yy format. I used following code : data111 = zoo(coredata(data11), format(index(data11), %m/%y)) However what I got is that : head(data111) 01/0101/0201/0301/0401/0501/06 -0.00139 -0.016274826 -0.047707664 0.001104362 -0.077961541 0.017637141 tail(data111) 12/0212/0312/0412/0512/0612/07 0.058660676 -0.018067833 -0.055569851 0.007142888 0.051162052 0.052643733 It is evident that month order has been changed. Can anyone here tell me how to get correct order like : 01/01, 02/01, 03/01.. Your help is highly appreciated Regards, - [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using 'lrm' for logistic regression
Utkarsh Singhal wrote: Hi R, I am getting this error while trying to use 'lrm' function with nine independent variables: res = lrm(y1994~WC08301+WC08376+WC08316+WC08311+WC01001+WC08221+WC08106+WC0810 1+WC08231,data=y) singular information matrix in lrm.fit (rank= 8 ). Offending variable(s): WC08101 WC08221 Error in j:(j + params[i] - 1) : NA/NaN argument Now, if I take choose only four independent variables then there is no error. res = lrm(y1994~ WC08221+WC08106+WC08101+WC08231,data=y) But strangely, if I use 'glm', with the family as binomial(logit) and with the same dataset, it is working perfectly fine. res = glm(y1994~WC08301+WC08376+WC08316+WC08311+WC01001+WC08221+WC08106+WC0810 1+WC08231,data=y,family=binomial(logit)) Any ideas..? Regards Utkarsh Design's fitting functions are not kind about ignoring parameters associated with singular covariance matrices. In glm you should see a zero for such coefficients. In design you have to delete the singular variables manually. Occasionally you have to tweak the tol argument to lrm. A new function in Hmisc called redun will run a redundancy analysis to help understand the predictor collinearities. Frank This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Script to start Rcmdr
Dear Ronaldo, You should be able to put local({ old - getOption(defaultPackages) options(defaultPackages = c(old, Rcmdr)) }) in an .Rprofile file in a directory reserved for this purpose, and have your bash script start R from that directory (untested). See ?Startup for details on how R starts. I hope this helps, John John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] project.org] On Behalf Of Ronaldo Reis Junior Sent: March-03-08 8:14 AM To: R-Help Subject: [R] Script to start Rcmdr Hi, anybody know any way to make a bash script to start Rcmdr directly widthout need to open R and execute library(Rcmdr)? I try to make this using R CMD BATCH somethink, but dont find the way. Thanks Ronaldo -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366 __ 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/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Script to start Rcmdr
On Mon, 3 Mar 2008, Ronaldo Reis Junior wrote: Hi, anybody know any way to make a bash script to start Rcmdr directly widthout need to open R and execute library(Rcmdr)? I try to make this using R CMD BATCH somethink, but dont find the way. For some reason, Rcmdr requires an interactive session: gannet% Rscript -e 'library(Rcmdr)' Loading required package: tcltk Loading Tcl/Tk interface ... done The Commander GUI is launched only in interactive sessions However, I was able to do gannet% cat foo #!/bin/sh R_DEFAULT_PACKAGES=Rcmdr R Probably you need R in interactive mode to respond to the Tcl/Tk callbacks (and not just terminate when no input is found). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Imputation Packages
Have a look at the Hmisc package Kind regards, Marco -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens John Fox Verzonden: maandag 3 maart 2008 14:05 Aan: 'James Reilly'; 'ArunPrasad' CC: r-help@r-project.org Onderwerp: Re: [R] Imputation Packages Dear James and Arun, The Social Sciences task view is out of date (updating it is on my to-do list), and I'm aware of at least one other package, Amelia, for multiple imputation of missing data (which isn't mentioned in the more up-to-date Multivariate task view). There are probably others as well. Regards, John John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] project.org] On Behalf Of James Reilly Sent: March-03-08 4:48 AM To: ArunPrasad Cc: r-help@r-project.org Subject: Re: [R] Imputation Packages On 3/3/08 6:42 AM, ArunPrasad wrote: Hi everyone, I am looking for a package in R which can help me in using the imputation technique to find the missing values for my regression analysis. Any help would be appreciated. Cheers Arun Have a look at the Missing data sections of the Multivariate and SocialSciences task views on CRAN: http://cran.r-project.org/web/views/ James -- James Reilly Department of Statistics, University of Auckland Private Bag 92019, Auckland, New Zealand __ 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/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) --Jim Rogers On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] inheritence in S4
Thanks Martin Well it works except that as seems to not like the initialize method : the following code (that is the same than yours with some initialize for A B and C) does not compile. It seems that as(c,A) does not work if we definie a initialize for A... --- 8 -- setClass(A, representation(x=numeric)) setMethod(initialize,A,function(.Object,value)[EMAIL PROTECTED] - value;return(.Object)}) a - new(A,4) setClass(B, representation(y=numeric)) setMethod(initialize,B,function(.Object,value)[EMAIL PROTECTED] - value;return(.Object)}) b - new(B,5) setClass(C, contains=c(A, B)) setMethod(initialize,C,function(.Object,valueA, valueB){ [EMAIL PROTECTED] - valueA [EMAIL PROTECTED] - valueB return(.Object) }) c - new(C,valueA=10,valueB=12) setMethod(show, A, function(object) cat(A\n)) setMethod(show, B, function(object) cat(B\n)) setMethod(show, C, function(object) { callGeneric(as(object, A)) callGeneric(as(object, B)) cat(C\n) }) c --- 8 Is there something wrong with the use of 'as' between class and father class? Christophe Hi Christophe -- I don't know whether there's a particularly elegant way. This works setClass(A, representation(x=numeric)) setClass(B, representation(y=numeric)) setClass(C, contains=c(A, B)) setMethod(show, A, function(object) cat(A\n)) setMethod(show, B, function(object) cat(B\n)) setMethod(show, C, function(object) { callGeneric(as(object, A)) callGeneric(as(object, B)) cat(C\n) }) new(C) A B C but obviously involves the developer in making explicit decisions about method dispatch when there is multiple inheritance. Martin [EMAIL PROTECTED] writes: Hi the list I define a class A (slot a and b), a class C (slot c and d) and a class E that inherit from A and B. I define print(A) and print(B). For print(C), I would like to use both of them, but I do not see how... Thanks for your help... Christophe Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) Just an example of Stigler's Law. Duncan Murdoch --Jim Rogers On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [Fwd: Re: Fatal error: you must specify '--save', '--no-save' or '--vanilla']
Well, here is the discussion I had with Duncan in the meantime... Anybody else a suggestion what might be the problem? Greetings, Andreas -- http://www.maunz.de Yoda of Borg are we: Futile is resistance. Assimilate you, we will. ---BeginMessage--- FFrom [EMAIL PROTECTED] Mon Mar 3 15:07:21 2008 Return-Path: [EMAIL PROTECTED] X-Original-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] Received: from fisher.stats.uwo.ca (fisher.stats.uwo.ca [129.100.76.201]) by yavin.mogsoft.de (Postfix) with ESMTP id E631F410C for [EMAIL PROTECTED]; Mon, 3 Mar 2008 15:07:20 +0100 (CET) Received: from [192.168.0.176] (djm.stats.uwo.ca [129.100.76.113]) by fisher.stats.uwo.ca (8.13.1/8.13.1) with ESMTP id m23E7IaF028028 for [EMAIL PROTECTED]; Mon, 3 Mar 2008 09:07:18 -0500 Message-ID: [EMAIL PROTECTED] Date: Mon, 03 Mar 2008 09:08:30 -0500 From: Duncan Murdoch [EMAIL PROTECTED] User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Andreas Maunz [EMAIL PROTECTED] Subject: Re: [R] Fatal error: you must specify '--save','--no-save' or '--vanilla' References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] In-Reply-To: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yavin.mogsoft.de X-Spam-Level: X-Spam-Status: No, score=-1.6 required=3.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.3 On 3/3/2008 8:37 AM, Andreas Maunz wrote: Duncan Murdoch wrote: On 03/03/2008 6:42 AM, Andreas Maunz wrote: Duncan Murdoch wrote: So you have not tried to add one of the mentioned flags? I did, actually! ;-) Increasing the options to REmbeddedPostgres --no-save --gui=none --silent results in the following: Error: syntax error in: ironment - function () .Internal(environment(NULL)) mkenv - function() .Internal(new.env(TRUE, baseenv(), 29L That's because you're using an obsolete version of R, that doesn't support the integer constant 29L. Are you sure? /usr/local/lib/R/bin/R --version gives: R version 2.6.0 (2007-10-03) Hmm, 2.6.0 should be able to handle that. Are you sure your C program is finding that one? I don't think it would print that error message; it would say something slightly more informative. You could get it to print the result of sessionInfo() or version to check. I incorporated a call to sessionInfo() in the startup part of my program, just after R initialization. In the case that it succeeds (manual startup) version 2.6.0 is found: R version 2.6.0 (2007-10-03) i686-pc-linux-gnu locale: LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base 2.6.0 is also definitely the only version on my system (compiled it manually). I don't know what's causing that syntax error. Perhaps it's a bug that has been fixed in 2.6.2, but I can't think of one. Duncan Murdoch ---End Message--- __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make plots with GNUplot. Have anyone tried that?
On Mon, 3 Mar 2008, Martin Maechler wrote: LH == Louise Hoffman [EMAIL PROTECTED] on Sat, 1 Mar 2008 00:54:56 +0100 writes: If you still want to then read ?write.table, that can export your data into a spreadsheet-like ascii format which can be used from GNUplot easily. LH Very interesting. LH So if I e.g. write: LH ts.sim - arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200) LH ts.plot(ts.sim) LH How do I know the names of the rows to put in the data.frame() command? Btw, comparing the graphics capabilities of GNUplot and R, it is something like a three-wheel bicycle and a spaceship. Guess which is which. LH =) I know that I will most likely spend a lot of time on just making LH the plots, but I atleast (for now =) ) think it could be fun to try. if you make them with R, yes. I wholeheartedly support Gabor's point: I'd consider GNUplot to be clearly inferior to R -- just talking about the graphics possibilties and the quality / thoughtfulness in the high-level plotting. If you have your data / objects / functions in R, I'm very strongly convinced that using GNUplot for plotting is ``the wrong'' approach by almost all definitions of wrong. In a later message Louise mentioned the desire to use TeX fonts for annotation, to match a LaTeX document. Paul Murrell has pointed out his and my article in R-News 2006-2 about how to do this. Louise almost mentioned the 'the gnuplot cvs which have pdfcairo support'. Well, R too has development versions, and I was able to do par(family=cmr10) plot(1:10) in R-devel and get annotations in Computer Modern on screen, or cairo_pdf() par(family=cmr10) plot(1:10) and get this on a PDF file. To do so you would need /usr/share/fonts/mathml/cmr10.ttf installed, at least on F8 (part of the mathml-fonts RPM). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem plotting curve on survival curve (something silly?)
Calum wrote: Also is it possible to get an R-squared type value for the fit of this curve from someplace? Finally (three questions in one!) the first two censored data points (1 in each group) are actually lost to follow-ups. Should they be marked differently from censored? Customarily they are not. (I'm sure it is possible to speculate at length about it, though.) Going off topic a bit - but did you mean customarily they are not censored or customarily they are not handled differently from censored! Customarily not marked differently from other kinds of censoring. (The censoring date has to be last day known alive, of course.) Nothing spectacularly incompetent this far... (I'm not happy with R^2 measures outside of linear models, or even within linear models, but several well-reputed people do find them useful, so who am I to bicker?) I'm not competent to argue. But are you suggesting there is a better way to assess fit of the line to the data? Thats what I want - Not being a statistician I'm not fussed how its done. But If I'm going to extrapolate a line I'd like to know its a reasonable fit first (is that purely by eye?) There is a p value reported by survreg but no idea how to interpret it ;-) Now there's the first problem... For survival models, the R^2 measures which I have heard of, measure the predictability of the outcome, rather than the discrepancy between observed and expected survival curves. I'm not aware of nice goodness of fit procedures for survival curves (others on the list might be) . -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to make a break on y-axis of a histogram chart using R?
It is possible to do this with R, but I really don't think it is desirable because it can produce a very misleading graphic. Why do you want to introduce a break in the axis? Hadley On Mon, Mar 3, 2008 at 8:03 AM, HongSheng Liao [EMAIL PROTECTED] wrote: Attached is a histogram chart with a break on y-axis which my friend made for me using phot shop. Do anyone know how to make such a break using R? Thanks in advance. (See attached file: 2007 age distribution.doc) Hongsheng (Hank) Liao, Ph.D. Lab Manager Center for Quantitative Fisheries Ecology 800 West 46th Street Old Dominion University Norfolk, Virginia 23508 Phone:757.683.4571 Fax:757.683.5293 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- http://had.co.nz/ __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem plotting curve on survival curve
Calum had a long question about drawing survival curves after fitting a Weibull model, using pweibull, which I have not reproduced. It is easier to get survival curves using the predict function. Here is a simple example: library(survival) tfit - survreg(Surv(time, status) ~ factor(ph.ecog), data=lung) table(lung$ph.ecog) 0123 NA 63 113 5011 tdata - data.frame(ph.ecog=factor(0:3)) qpred - predict(tfit, newdata= tdata, type='quantile', p=1:99/100) matplot(t(qpred), 99:1/100, type='l') The result of predict is a matrix with one row per group and one column per quantile. The final plot uses 99:1 so as to show 1-F(t) = S(t) rather than F. Don't ask for the 1.0 quantile BTW -- it is infinity and I doubt you want the plot to stretch out that far. The 0.0 quantile can also have issues due to the implicit log transform used in many distributions. If I had not used the newdata argument, we would get 227 rows in the result, one for each subject. That is, 63 copies of the ph.ecog==0 curve, 113 of the ph.ecog==1 curve, ... The above fit assumed a common shape for the 4 groups, you can add a + strata(ph.ecog) term to have a separate scale for each group; this would give the same curves as 4 separate fits to the subgroups. There are several advantages to using the predict function. The first is that the code does not need to change if you decide to use a different distribution. The second is that you can add the se.fit=T argument to get confidence bounds for the curves. (A couple more lines for your matplot call of course). Terry Therneau Mayo Clinic __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Script to start Rcmdr
On Mon, Mar 03, 2008 at 10:13:53AM -0300, Ronaldo Reis Junior wrote: Hi, anybody know any way to make a bash script to start Rcmdr directly widthout need to open R and execute library(Rcmdr)? I try to make this using R CMD BATCH somethink, but dont find the way. $ r -lRcmdr -e'while(TRUE) Sys.sleep(1)' where r is the binary from our littler tool. This loads the Rmcdr package with the -l | --library switch abnd then evals a simple loop to keep running. You need to kill that loop with Crtrl-c at the end. Dirk -- Three out of two people have difficulties with fractions. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Studdy Missing Data, differentiate between a percent with in the valid answers and with in the different missing answers
On Mon, 03 Mar 2008 22:02:17 +1300, James Reilly wrote On 3/3/08 8:21 PM, Ericka Lundström wrote: I'm trying to emigrate from SPSS to R, thou I have some problems whit getting R to distinguish between the different kind of missing. ... Is there a smart way in R to differentiate between missing and valid and at the same time treat both the categories within missing and valid as answers (like SPSS did above) The Hmisc package has some support for special missing values, for instance when reading in SAS datasets using sas.get. I don't believe spss.get offers the same facility, though. You can define special missing values for a variable manually, which might seem a bit involved, but this could easily be automated. For your example, try: special - dataFrame$TWO %in% c(?,X) attr(dataFrame$TWO, special.miss) - list(codes=as.character(dataFrame$TWO[special]), obs=(1:length(dataFrame$TWO))[special]) class(dataFrame$TWO) - c(factor, special.miss) is.na(dataFrame$TWO) - special # Then describe gives new percentages describe(dataFrame$TWO) dataFrame$TWO n missing ? X unique 3 4 2 2 2 No (2, 67%), yes (1, 33%) Dear James Reilly Tanks a for your answer, now I can get - or make - metacategories for my data, which is wonderful! Thou I actually only needed two metacategories. One for missing answers and one for valid answers, anyhow it looks like R are treating X and ? as missing, or subcategorise of missing. One thing I still need R to give me a percent with in the valid answers (or unique) and a percent over all. Is that in anyway possible? Whit the special.miss I doesnt get percentages I only get distribution with in n [No (2, 67%), yes (1, 33%)]. I dont get an percent over all [? (2, 29%), No (2, 29%), X (2, 29%), yes (1, 14%)]. Isnt there someone who has developed a Package for this feature? Karsten Mueller asked about this 10 years ago https://stat.ethz.ch/pipermail/r-help/1998-October/002942.html Hope some one have the time to help me. And again, thanks to James Reilly for his answer! All the best Ericka Lujndström __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot using colors
On Mon, Mar 3, 2008 at 4:03 AM, mysimbaa [EMAIL PROTECTED] wrote: Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab=zeit [s],ylab=Variation [%], col = ifelse(var = varstability, 'green','red')) this works well! But since I add a type=l to my plot, it will color all the plot with green!!! Is there any solution? I avoid to use teachingDemos. You might want to look at ggplot2, http://had.co.nz/ggplot2, which provides many tools to make this type of mapping easy. For example, library(ggplot2) qplot(tvar, var, colour=varstability, geom=line) might be sufficient in your case (although without a minimal reproducible example it's impossible to know) Hadley -- http://had.co.nz/ __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help needed in R
Dear ALL: How I can find the number of observations less than each value in column one with indicator 1 in column two. Please see the data below. For example: number of observations less than 1 with indicator 1 (including those 1 with indicator 1) =2 number of observations less than 2 with indicator 1 (including those 2 with indicator 1) =11 number of observations less than 5 with indicator 1 (including those 5 with indicator 1) =33 number of observations less than 10 with indicator 1 (including those 10 with indicator 1) =43 number of observations less than 15 with indicator 1 (including those 15 with indicator 1) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. With many thanks. Abou Here is the data: === Consider the following matrix: data-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5, 4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4, 0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2) [,1] [,2] [1,]20 [2,]20 [3,] 120 [4,]20 [5,]10 [6,] 101 [7,] 101 [8,]40 [9,] 101 [10,]11 [11,]10 [12,]21 [13,]21 [14,]10 [15,]20 [16,] 101 [17,]30 [18,]11 [19,]10 [20,]10 [21,]30 [22,]51 [23,] 170 [24,] 230 [25,]90 [26,]90 [27,]30 [28,]30 [29,] 151 [30,]51 [31,]40 [32,]51 [33,]51 [34,]51 [35,]40 [36,]80 [37,]10 [38,] 150 [39,]30 [40,]30 [41,]10 [42,]60 [43,]30 [44,]60 [45,]30 [46,]40 [47,]50 [48,] 140 [49,]40 == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Constrained regression
Dear Carlos, One approach is to use structural equation modeling (SEM). Some SEM packages, such as LISREL, Mplus and Mx, allow inequality and nonlinear constraints. Phantom variables (Rindskopf, 1984) may be used to impose inequality constraints. Your model is basically: y = b0 + b1*b1*x1 + b2*b2*x2 +...+ bp*bp*xp + e 1 = b1*b1 + b2*b2 +...+ bp*bp Alternatively, you can set some condition bounds on the parameter estimates. Then you only have to impose the second constraint. Rindskopf, D. (1984). Using phantom and imaginary latent variables to parameterize constraints in linear structural models. Psychometrika, 49, 37-47. Regards, Mike -- - Mike W.L. Cheung Phone: (65) 6516-3702 Department of Psychology Fax: (65) 6773-1843 National University of Singapore http://courses.nus.edu.sg/course/psycwlm/internet/ - On Mon, Mar 3, 2008 at 11:52 AM, Carlos Alzola [EMAIL PROTECTED] wrote: Dear list members, I am trying to get information on how to fit a linear regression with constrained parameters. Specifically, I have 8 predictors , their coeffiecients should all be non-negative and add up to 1. I understand it is a quadratic programming problem but I have no experience in the subject. I searched the archives but the results were inconclusive. Could someone provide suggestions and references to the literature, please? Thank you very much. Carlos Carlos Alzola [EMAIL PROTECTED] (703) 242-6747 [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Latex (computer modern) fonts, pdfcairo etc. {was ... GNUplot}
BDR == Prof Brian Ripley [EMAIL PROTECTED] on Mon, 3 Mar 2008 14:16:15 + (GMT) writes: [] BDR In a later message Louise mentioned the desire to use TeX fonts for BDR annotation, to match a LaTeX document. Paul Murrell has pointed out his BDR and my article in R-News 2006-2 about how to do this. BDR Louise almost mentioned the 'the gnuplot cvs which have pdfcairo support'. BDR Well, R too has development versions, and I was able to do par(family=cmr10) plot(1:10) BDR in R-devel and get annotations in Computer Modern on screen, or cairo_pdf() par(family=cmr10) plot(1:10) BDR and get this on a PDF file. BDR To do so you would need /usr/share/fonts/mathml/cmr10.ttf installed, at BDR least on F8 (part of the mathml-fonts RPM). Aha, thank you! I found that in Ubuntu / Debian the package you need is called latex-xft-fonts {i.e. in a shell you install via sudo apt-get install latex-xft-fonts } Martin __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with lme4 use and installation
Dear all, I've been trying to install the lme4 package from http://r-forge.r-project.org/projects/lme4/. However, when wanting to load the package, I get an message saying that x-tabs are masked (see pasted code). Can anyone point to what has gone wrong? Kind regards, Andreas Nord Sweden utils:::menuInstallLocal() package 'lme4' successfully unpacked and MD5 sums checked updating HTML package descriptions library(lme4) Loading required package: Matrix Loading required package: lattice Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs -- View this message in context: http://www.nabble.com/Problem-with-lme4-use-and-installation-tp15806404p15806404.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with lme4 use and installation
Nothing's wrong. It just means that the package or one of its dependencies, has its own xtabs function, which hides the default xtabs function, since it comes first in the search path. So when you next write xtabs(...), it is this new xtabs that is being loaded. If you want to call the original xtabs, you can still do it I think with stats::xtabs(...). This is a warning, not an error. It warns you that something you perhaps did not expect has just happened. Haris Skiadas Department of Mathematics and Computer Science Hanover College On Mar 3, 2008, at 10:33 AM, Andreas Nord wrote: Dear all, I've been trying to install the lme4 package from http://r-forge.r-project.org/projects/lme4/. However, when wanting to load the package, I get an message saying that x-tabs are masked (see pasted code). Can anyone point to what has gone wrong? Kind regards, Andreas Nord Sweden utils:::menuInstallLocal() package 'lme4' successfully unpacked and MD5 sums checked updating HTML package descriptions library(lme4) Loading required package: Matrix Loading required package: lattice Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs -- View this message in context: http://www.nabble.com/Problem-with- lme4-use-and-installation-tp15806404p15806404.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help needed in R
Dear Ellison: it did not do it. I edited my previous email to make my question more clear. The out put should be: (2,11,33,43,46) For example: number of all observations less than 1 with indicator 1 (including those 1 with indicator 1 but not 1 with indicator 0) =2 number of all observations less than 2 with indicator 1 (including those 2 with indicator 1 but not 2 with indicator 0) =11 number of all observations less than 5 with indicator 1 (including those 5 with indicator 1 but not 5 with indicator 0) =33 number of all observations less than 10 with indicator 1 (including those 10 with indicator 1 but not 10 with indicator 0) =43 number of all observations less than 15 with indicator 1 (including those 15 with indicator 1 but not 15 with indicator 0) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith S Ellison [EMAIL PROTECTED] 3/3/2008 10:36 AM table(data[data[,2]==1,1]) AbouEl-Makarim Aboueissa [EMAIL PROTECTED] 03/03/2008 15:20:21 Dear ALL: How I can find the number of observations less than each value in column one with indicator 1 in column two. Please see the data below. For example: number of observations less than 1 with indicator 1 (including those 1 with indicator 1) =2 number of observations less than 2 with indicator 1 (including those 2 with indicator 1) =11 number of observations less than 5 with indicator 1 (including those 5 with indicator 1) =33 number of observations less than 10 with indicator 1 (including those 10 with indicator 1) =43 number of observations less than 15 with indicator 1 (including those 15 with indicator 1) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. With many thanks. Abou Here is the data: === Consider the following matrix: data-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5, 4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4, 0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2) [,1] [,2] [1,]20 [2,]20 [3,] 120 [4,]20 [5,]10 [6,] 101 [7,] 101 [8,]40 [9,] 101 [10,]11 [11,]10 [12,]21 [13,]21 [14,]10 [15,]20 [16,] 101 [17,]30 [18,]11 [19,]10 [20,]10 [21,]30 [22,]51 [23,] 170 [24,] 230 [25,]90 [26,]90 [27,]30 [28,]30 [29,] 151 [30,]51 [31,]40 [32,]51 [33,]51 [34,]51 [35,]40 [36,]80 [37,]10 [38,] 150 [39,]30 [40,]30 [41,]10 [42,]60 [43,]30 [44,]60 [45,]30 [46,]40 [47,]50 [48,] 140 [49,]40 == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.zoo problem reading in date time
On Mar 3, 2008, at 11:12 AM, stephen sefick wrote: x-read.zoo(SC2.csv, sep=, , format=%m%m/%d%d/%y%y%y%y %h%h:%m% m) #Error in read.zoo(SC2.csv, sep = ,, format = %m%m/%d%d/%y%y%y%y %h%h:%m%m) : index contains NAs Error message You need header=TRUE in there, since your dataset has a header. what am I doing wrong SC2.csv is a comma seperated file. The above data is right out out of the csv file, which is more like 30,000 rows. There are some NA for all of the variables except DateTime for a week here and a week there, but I can not find any missing dates. thanks stephen Haris Skiadas Department of Mathematics and Computer Science Hanover College __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] FW: ANNOUNCE: one day workshop on user interfaces and interactive graphics in R
Workshop on user interfaces and interactive graphics in R == Tuesday, 1st April 10.00-16.30 Postgraduate Statistics Centre, Department of Maths and Statistics, Lancaster University, UK = This one-day workshop is for users of R who wish to find out more about user-friendly web based interfaces to R, and about recent developments in the area of interactive graphics. The workshop will be of interest to those seeking to use these ideas in their teaching, to R users and statisticians wanting to provide simple interfaces and animations for consultancy clients, and for any non-expert R user interested in graphics and the web. The format of the day will be a mix of presentations and workshop sessions. The speakers will include Richard Newton (MRC Biostatistics unit), Adrian Bowman and Ewan Crawford (Glasgow) and Barry Rowlingson (Lancaster) . The meeting is free of charge, and is co-sponsored by the Lancaster Postgraduate Statistics Centre and the HEA Maths, Statistics and OR network. Lunch, teas and coffee will be provided, together with a presentation pack. There are a limited number of places available so early booking is advised. Please view the timetable and register for the event using the following link: http://www.maths.lancs.ac.uk/department/specialistGroups/psc/r __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] esercizio
Ciao a tutti! ho un problema con un esercizio in R. In una lista devo trovare tutte le parole che si differenziano per una lettera da un'altra parola. Esempio: per casa: cosa, rosa... C'è una formula generale da applicare a tutte le parole? Grazie dell'aiuto, Flo - - [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help needed in R
For me is not very clear, but if I understand: sapply(sort(unique(data[data[,2]==1,1])), function(x)sum(data[data[,2]==1 data[,1] = x, 1])) But the output is: 2 6 31 71 86 On 03/03/2008, AbouEl-Makarim Aboueissa [EMAIL PROTECTED] wrote: Dear Ellison: it did not do it. I edited my previous email to make my question more clear. The out put should be: (2,11,33,43,46) For example: number of all observations less than 1 with indicator 1 (including those 1 with indicator 1 but not 1 with indicator 0) =2 number of all observations less than 2 with indicator 1 (including those 2 with indicator 1 but not 2 with indicator 0) =11 number of all observations less than 5 with indicator 1 (including those 5 with indicator 1 but not 5 with indicator 0) =33 number of all observations less than 10 with indicator 1 (including those 10 with indicator 1 but not 10 with indicator 0) =43 number of all observations less than 15 with indicator 1 (including those 15 with indicator 1 but not 15 with indicator 0) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith S Ellison [EMAIL PROTECTED] 3/3/2008 10:36 AM table(data[data[,2]==1,1]) AbouEl-Makarim Aboueissa [EMAIL PROTECTED] 03/03/2008 15:20:21 Dear ALL: How I can find the number of observations less than each value in column one with indicator 1 in column two. Please see the data below. For example: number of observations less than 1 with indicator 1 (including those 1 with indicator 1) =2 number of observations less than 2 with indicator 1 (including those 2 with indicator 1) =11 number of observations less than 5 with indicator 1 (including those 5 with indicator 1) =33 number of observations less than 10 with indicator 1 (including those 10 with indicator 1) =43 number of observations less than 15 with indicator 1 (including those 15 with indicator 1) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. With many thanks. Abou Here is the data: === Consider the following matrix: data-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5, 4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4, 0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2) [,1] [,2] [1,]20 [2,]20 [3,] 120 [4,]20 [5,]10 [6,] 101 [7,] 101 [8,]40 [9,] 101 [10,]11 [11,]10 [12,]21 [13,]21 [14,]10 [15,]20 [16,] 101 [17,]30 [18,]11 [19,]10 [20,]10 [21,]30 [22,]51 [23,] 170 [24,] 230 [25,]90 [26,]90 [27,]30 [28,]30 [29,] 151 [30,]51 [31,]40 [32,]51 [33,]51 [34,]51 [35,]40 [36,]80 [37,]10 [38,] 150 [39,]30 [40,]30 [41,]10 [42,]60 [43,]30 [44,]60 [45,]30 [46,]40 [47,]50 [48,] 140 [49,]40 == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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/posting-guide.html and provide commented, minimal, self-contained,
[R] Unsubscribe!!!
__ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Barplot with grouping x axis and count data
Hello, I am trying to make a barplot with nested count data which is build like this: first there are several birds (n)laying 3 clutches composed of 2 eggs half of the second and third clutch received treatment and this treatment was tested to influence sex of offspring. I want a barplot showing counts for male and female for every egg of every clutch. can someone tell me what to do? I drew a table of how i wanted it to look with: ftable(sex,clutch,egg,treat) giving: clutch egg treat#females #males 1 1014 21 1 5 2 2025 24 13 43 2 1023 43 123 5 2 0436 1541 3 etc I would want to have clutch egg and treat all on the xaxis but not in separate bars but nested within eachother just like the table. Can someone tell me how to deal with this problem? thank you, Linda -- View this message in context: http://www.nabble.com/Barplot-with-grouping-x-axis-and-count-data-tp15808379p15808379.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help needed in R
Dear ALL: Please see below. I hope this will make it more clear. [1,]11 [2,]11 number of all observations less than 1 with indicator 1 (including those 1 with indicator 1 but not 1 with indicator 0)=2 [3,]10 [4,]10 [5,]10 [6,]10 [7,]10 [8,]10 [9,]10 [10,]21 [11,]21number of all observations less than 2 with indicator 1 (including those 2 with indicator 1 but not 2 with indicator 0)=11 [12,]20 [13,]20 [14,]20 [15,]20 [16,]30 [17,]30 [18,]30 [19,]30 [20,]30 [21,]30 [22,]30 [23,]30 [24,]40 [25,]40 [26,]40 [27,]40 [28,]40 [29,]51 [30,]51 [31,]51 [32,]51 [33,]51 number of all observations less than 5 with indicator 1 (including those 5 with indicator 1 but not 5 with indicator 0)=33 [34,]50 [35,]60 [36,]60 [37,]80 [38,]90 [39,]90 [40,] 101 [41,] 101 [42,] 101 [43,] 101 number of all observations less than 10 with indicator 1 (including those 10 with indicator 1 but not 10 with indicator 0)=43 [44,] 120 [45,] 140 [46,] 151 number of all observations less than 15 with indicator 1 (including those 15 with indicator 1 but not 15 with indicator 0)=46 [47,] 150 [48,] 170 [49,] 230 How I can write an R code to do this. Thanks Abou == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith Henrique Dallazuanna [EMAIL PROTECTED] 3/3/2008 11:38 AM For me is not very clear, but if I understand: sapply(sort(unique(data[data[,2]==1,1])), function(x)sum(data[data[,2]==1 data[,1] = x, 1])) But the output is: 2 6 31 71 86 On 03/03/2008, AbouEl-Makarim Aboueissa [EMAIL PROTECTED] wrote: Dear Ellison: it did not do it. I edited my previous email to make my question more clear. The out put should be: (2,11,33,43,46) For example: number of all observations less than 1 with indicator 1 (including those 1 with indicator 1 but not 1 with indicator 0) =2 number of all observations less than 2 with indicator 1 (including those 2 with indicator 1 but not 2 with indicator 0) =11 number of all observations less than 5 with indicator 1 (including those 5 with indicator 1 but not 5 with indicator 0) =33 number of all observations less than 10 with indicator 1 (including those 10 with indicator 1 but not 10 with indicator 0) =43 number of all observations less than 15 with indicator 1 (including those 15 with indicator 1 but not 15 with indicator 0) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith S Ellison [EMAIL PROTECTED] 3/3/2008 10:36 AM table(data[data[,2]==1,1]) AbouEl-Makarim Aboueissa [EMAIL PROTECTED] 03/03/2008 15:20:21 Dear ALL: How I can find the number of observations less than each value in column one with indicator 1 in column two. Please see the data below. For example: number of observations less than 1 with indicator 1 (including those 1 with indicator 1) =2 number of observations less than 2 with indicator 1 (including those 2 with indicator 1) =11 number of observations less than 5 with indicator 1 (including those 5 with indicator 1) =33 number of observations less than 10 with indicator 1 (including those 10 with indicator 1) =43 number of observations less than 15 with indicator 1 (including those 15 with indicator 1) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. With many thanks. Abou Here is the data: === Consider the following matrix: data-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5, 4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4, 0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2) [,1] [,2] [1,]
[R] Calculating the t-test for each row
Hi Everyone, I need some simple help. Here are my codes ##will give me 1 probesets data.sub = data.matrix[order(variableprobe,decreasing=TRUE),][1:1,] dim(data.sub) data_output-write.table(data.sub, file = c://data_output.csv, sep = ,, col.names = NA) When i export to excel, it shows me this. This is just a short version. There are 1000 rows and 140 columns Sample_1_D Sample_1_C Sample_2_D Sample_2_C 1 2.425509867 11.34031409 11.46868531 11.75741478 Here is my question: How do create a new row and calculate the t-test so that it will give me the p-value Here is what i am looking for. The p-value is not correct but just an example. It needs to calculate the entire each row. There are 1 rows and 140 columns. thanks Kei Sample_1_D Sample_1_C Sample_2_D Sample_2_Cp-value 1 2.425509867 11.34031409 11.46868531 11.75741478 .0034 I tried something like this. t.test(data.sub,mu=0) I am pretty new to R. I think it is showing me the entire p-value. -- View this message in context: http://www.nabble.com/Calculating-the-t-test-for-each-row-tp15808716p15808716.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] inheritence in S4
Hi Christophe -- This is a variant of the problem that Jim Regetz is having in a thread in R-devel. Here's where the trouble is as(c, A) Error in .local(.Object, ...) : argument value is missing, with no default By default, 'as(c, A)' will create a new instance of it's second argument using new(A), and then fill the slots of A with appropriate values from C. We can see that creating a new A without any additional arguments causes the same error: new(A) Error in .local(.Object, ...) : argument value is missing, with no default Jim has gone down the path of creating coercion methods ('setAs') for his classes. A different solution is to ensure that 'new' works with no additional arguments (typically requiring that a prototype, if present, prodcues valid objects). So for instance setMethod(initialize,A,function(.Object, value=numeric(0)){ [EMAIL PROTECTED] - value return(.Object) }) and then new(A) A I find it easier to keep track of prototype and initialize methods, rather than setAs, so I use a solution like the above. But a couple of other quick points. I would have written setMethod(initialize, A, function(.Object, ..., xValue=numeric(0)){ callNextMethod(.Object, ..., x=xValue) }) Why? this allows the built-in object creation methods to create .Object, so there's less code for me to maintain (even if it's just object assignment [EMAIL PROTECTED] - value here). Importantly, when I create a derived class, the derived class does not have to know in detail about what the initilalize method for A does, e.g., setMethod(initialize,B, function(.Object, ..., yValue=numeric(0)){ callNextMethod(.Object, ..., y=yValue) }) Here 'initialize' for B just deals with it's slots, and doesn't have to worry about what to do with A's slots. Also [EMAIL PROTECTED] - value makes a copy of .Object, which can be expensive if .Object is large. There is some hope that the default method (eventually reached by callNextMethod) does things relatively efficiently in terms of copies. Note that each initialize method only deals with its own slots. And finally, the position of 'xValue' and 'yValue' means that the arugment has to be named, e.g., new(B, yValue=12). This seems a little awkward at first, but seems like a best practice when creating objects with complicated inheritance -- not quite so much need to follow the method dispatch / argument assignment rules through a complicated inheritance hierarchy. And finally, in Jim's thread I mention using a constructor. So in practice for a case like the above I would not define any initialize methods, and instead write B - function(xValue=numeric(0), yValue=numeric(0)) { new(B, x=xValue, y=yValue) } All my slot coercion is in the constructor. The user can figure out from the signature of the constructor what the appropriate arguments and their types are, and does not have to know about the details of the class definition. I can catch common errors and provide user-friendly messages, rather than getting cryptic messages from the internals of S4. Hope that helps. Martin Christophe Genolini [EMAIL PROTECTED] writes: Thanks Martin Well it works except that as seems to not like the initialize method : the following code (that is the same than yours with some initialize for A B and C) does not compile. It seems that as(c,A) does not work if we definie a initialize for A... --- 8 -- setClass(A, representation(x=numeric)) setMethod(initialize,A,function(.Object,value)[EMAIL PROTECTED] - value;return(.Object)}) a - new(A,4) setClass(B, representation(y=numeric)) setMethod(initialize,B,function(.Object,value)[EMAIL PROTECTED] - value;return(.Object)}) b - new(B,5) setClass(C, contains=c(A, B)) setMethod(initialize,C,function(.Object,valueA, valueB){ [EMAIL PROTECTED] - valueA [EMAIL PROTECTED] - valueB return(.Object) }) c - new(C,valueA=10,valueB=12) setMethod(show, A, function(object) cat(A\n)) setMethod(show, B, function(object) cat(B\n)) setMethod(show, C, function(object) { callGeneric(as(object, A)) callGeneric(as(object, B)) cat(C\n) }) c --- 8 Is there something wrong with the use of 'as' between class and father class? Christophe Hi Christophe -- I don't know whether there's a particularly elegant way. This works setClass(A, representation(x=numeric)) setClass(B, representation(y=numeric)) setClass(C, contains=c(A, B)) setMethod(show, A, function(object) cat(A\n)) setMethod(show, B, function(object) cat(B\n)) setMethod(show, C, function(object) { callGeneric(as(object, A)) callGeneric(as(object, B)) cat(C\n) }) new(C) A B C but obviously involves the developer in making explicit decisions about method dispatch when there is multiple inheritance. Martin [EMAIL PROTECTED] writes: Hi the list I define a class A (slot a and b), a
Re: [R] Help needed in R
I believe I wrote too hastily and that what you want is sum(X 1) which will sum the indicator (T/F) function. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of AbouEl-Makarim Aboueissa Sent: Monday, March 03, 2008 11:55 AM To: Henrique Dallazuanna Cc: r-help@r-project.org; S Ellison Subject: Re: [R] Help needed in R Dear ALL: Please see below. I hope this will make it more clear. [1,]11 [2,]11 number of all observations less than 1 with indicator 1 (including those 1 with indicator 1 but not 1 with indicator 0)=2 [3,]10 [4,]10 [5,]10 [6,]10 [7,]10 [8,]10 [9,]10 [10,]21 [11,]21number of all observations less than 2 with indicator 1 (including those 2 with indicator 1 but not 2 with indicator 0)=11 [12,]20 [13,]20 [14,]20 [15,]20 [16,]30 [17,]30 [18,]30 [19,]30 [20,]30 [21,]30 [22,]30 [23,]30 [24,]40 [25,]40 [26,]40 [27,]40 [28,]40 [29,]51 [30,]51 [31,]51 [32,]51 [33,]51 number of all observations less than 5 with indicator 1 (including those 5 with indicator 1 but not 5 with indicator 0)=33 [34,]50 [35,]60 [36,]60 [37,]80 [38,]90 [39,]90 [40,] 101 [41,] 101 [42,] 101 [43,] 101 number of all observations less than 10 with indicator 1 (including those 10 with indicator 1 but not 10 with indicator 0)=43 [44,] 120 [45,] 140 [46,] 151 number of all observations less than 15 with indicator 1 (including those 15 with indicator 1 but not 15 with indicator 0)=46 [47,] 150 [48,] 170 [49,] 230 How I can write an R code to do this. Thanks Abou == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith Henrique Dallazuanna [EMAIL PROTECTED] 3/3/2008 11:38 AM For me is not very clear, but if I understand: sapply(sort(unique(data[data[,2]==1,1])), function(x)sum(data[data[,2]==1 data[,1] = x, 1])) But the output is: 2 6 31 71 86 On 03/03/2008, AbouEl-Makarim Aboueissa [EMAIL PROTECTED] wrote: Dear Ellison: it did not do it. I edited my previous email to make my question more clear. The out put should be: (2,11,33,43,46) For example: number of all observations less than 1 with indicator 1 (including those 1 with indicator 1 but not 1 with indicator 0) =2 number of all observations less than 2 with indicator 1 (including those 2 with indicator 1 but not 2 with indicator 0) =11 number of all observations less than 5 with indicator 1 (including those 5 with indicator 1 but not 5 with indicator 0) =33 number of all observations less than 10 with indicator 1 (including those 10 with indicator 1 but not 10 with indicator 0) =43 number of all observations less than 15 with indicator 1 (including those 15 with indicator 1 but not 15 with indicator 0) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two. which means I need to create a vector(2,11,33,43,46) for the data in column one. == AbouEl-Makarim Aboueissa, Ph.D. Assistant Professor of Statistics Department of Mathematics Statistics University of Southern Maine 96 Falmouth Street P.O. Box 9300 Portland, ME 04104-9300 Tel: (207) 228-8389 Fax: (207) 780-5607 Email: [EMAIL PROTECTED] [EMAIL PROTECTED] Office: 301C Payson Smith S Ellison [EMAIL PROTECTED] 3/3/2008 10:36 AM table(data[data[,2]==1,1]) AbouEl-Makarim Aboueissa [EMAIL PROTECTED] 03/03/2008 15:20:21 Dear ALL: How I can find the number of observations less than each value in column one with indicator 1 in column two. Please see the data below. For example: number of observations less than 1 with indicator 1 (including those 1 with indicator 1) =2 number of observations less than 2 with indicator 1 (including those 2 with indicator 1) =11 number of observations less than 5 with indicator 1 (including those 5 with indicator 1) =33 number of observations less than 10 with indicator 1 (including those 10 with indicator 1) =43 number of observations less than 15 with indicator 1 (including those 15 with indicator 1) =46 (1, 2,5,10,15) are the values in column one with indicator 1 in column two.
Re: [R] Constrained regression
G'day Carlos, On Mon, Mar 3, 2008 at 11:52 AM Carlos Alzola [EMAIL PROTECTED] wrote: I am trying to get information on how to fit a linear regression with constrained parameters. Specifically, I have 8 predictors , their coeffiecients should all be non-negative and add up to 1. I understand it is a quadratic programming problem but I have no experience in the subject. I searched the archives but the results were inconclusive. Could someone provide suggestions and references to the literature, please? A suggestion: library(MASS) ## to access the Boston data designmat - model.matrix(medv~., data=Boston) Dmat - crossprod(designmat, designmat) dvec - crossprod(designmat, Boston$medv) Amat - cbind(1, diag(NROW(Dmat))) bvec - c(1, rep(0,NROW(Dmat)) meq - 1 library(quadprog) res - solve.QP(Dmat, dvec, Amat, bvec, meq) The solution seems to contain values that are, for all practical purposes, actually zero: res$solution [1] 4.535581e-16 2.661931e-18 1.016929e-01 -1.850699e-17 [5] 1.458219e-16 -3.892418e-15 8.544939e-01 0.00e+00 [9] 2.410742e-16 2.905722e-17 -5.700600e-20 -4.227261e-17 [13] 4.381328e-02 -3.723065e-18 So perhaps better: zapsmall(res$solution) [1] 0.000 0.000 0.1016929 0.000 0.000 0.000 [7] 0.8544939 0.000 0.000 0.000 0.000 0.000 [13] 0.0438133 0.000 So the estimates seem to follow the constraints. And the unconstrained solution is: res$unconstrainted.solution [1] 3.645949e+01 -1.080114e-01 4.642046e-02 2.055863e-02 [5] 2.686734e+00 -1.776661e+01 3.809865e+00 6.922246e-04 [9] -1.475567e+00 3.060495e-01 -1.233459e-02 -9.527472e-01 [13] 9.311683e-03 -5.247584e-01 which seems to coincide with what lm() thinks it should be: coef(lm(medv~., Boston)) (Intercept) crimzn indus chas 3.645949e+01 -1.080114e-01 4.642046e-02 2.055863e-02 2.686734e+00 noxrm age dis rad -1.776661e+01 3.809865e+00 6.922246e-04 -1.475567e+00 3.060495e-01 tax ptratio black lstat -1.233459e-02 -9.527472e-01 9.311683e-03 -5.247584e-01 So there seem to be no numeric problems. Otherwise we could have done something else (e.g calculate the QR factorization of the design matrix, say X, and give the R factor to solve.QP, instead of calculating X'X and giving that one to solve.QP). If the intercept is not supposed to be included in the set of constrained estimates, then something like the following can be done: Amat[1,] - 0 res - solve.QP(Dmat, dvec, Amat, bvec, meq) zapsmall(res$solution) [1] 6.073972 0.00 0.109124 0.00 0.00 0.00 0.863421 [8] 0.00 0.00 0.00 0.00 0.00 0.027455 0.00 Of course, since after the first command in that last block the second column of Amat contains only zeros Amat[,2] [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 we might as well have removed it (and the corresponding entry in bvec) Amat - Amat[, -2] bvec - bvec[-2] before calling solve.QP(). Note, the Boston data set was only used to illustrate how to fit such models, I do not want to imply that these models are sensible for these data. :-) Hope this helps. Cheers, Berwin === Full address = Berwin A TurlachTel.: +65 6516 4416 (secr) Dept of Statistics and Applied Probability+65 6516 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] Singapore 117546http://www.stat.nus.edu.sg/~statba __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating the t-test for each row
You can try this: cbind(data.sub, p.value=apply(data.sub, 1, function(x)t.test(x)$p.value)) On 03/03/2008, Keizer_71 [EMAIL PROTECTED] wrote: Hi Everyone, I need some simple help. Here are my codes ##will give me 1 probesets data.sub = data.matrix[order(variableprobe,decreasing=TRUE),][1:1,] dim(data.sub) data_output-write.table(data.sub, file = c://data_output.csv, sep = ,, col.names = NA) When i export to excel, it shows me this. This is just a short version. There are 1000 rows and 140 columns Sample_1_D Sample_1_C Sample_2_D Sample_2_C 1 2.425509867 11.34031409 11.46868531 11.75741478 Here is my question: How do create a new row and calculate the t-test so that it will give me the p-value Here is what i am looking for. The p-value is not correct but just an example. It needs to calculate the entire each row. There are 1 rows and 140 columns. thanks Kei Sample_1_D Sample_1_C Sample_2_D Sample_2_Cp-value 1 2.425509867 11.34031409 11.46868531 11.75741478 .0034 I tried something like this. t.test(data.sub,mu=0) I am pretty new to R. I think it is showing me the entire p-value. -- View this message in context: http://www.nabble.com/Calculating-the-t-test-for-each-row-tp15808716p15808716.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help for the first poster- a simple question
Hi, there, I cannot get accurate value for calculation. for example: ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. xj. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] So far so good except importing data
HI, Thanks for your help previously. I can go around R and scilab now, except import my research data. This is an example dataset (below) of radon radiation levels. How can I import this txt file using Rcmdr? How do I import .xls files? My alpha guard radon monitors output .dvd files that can be converted into .xls files by adjusting may parameters. A big earthquake struck last Thursday morning and need to anaylise the data of radon levels from it by means of correlation, mean, standard deviation and to produce relevant graphs/ charts. As meeting one of my PhD project aims. Thanks if you can help. Here it is, I am using R on windows. 030,08,01,28,10,28, 47., 28.1,10.7, 4.3, 4.3, 0.0,2236,11, 21.9,21, 1,6.82, 60,005, 22.98137, 25.13785,254 031,08,01,28,10,58, 51., 28.2,11.8, 2.0, 5.9, 0.0,2218,11, 23.4,13, 1,6.12, 50,005, 29.52128, 27.30572,254 032,08,01,28,11,28, 53., 28.2, 9.4, 1.9,11.3, 1.9,2218,11, 24.6, 7, 0,6.36, 10,005, 36.08156, 29.28577,254 033,08,01,28,11,58, 56., 28.2,17.9, 3.6, 7.2, 0.0,2218,10, 25.2, 3, 1,6.21, 40,005, 45.92199, 31.96815,254 034,08,01,28,12,28, 57., 28.2, 8.8, 0.0,17.6, 0.0,2218,11, 25.5, 0, 1,6.30, 50,005, 49.20213, 32.80142,254 035,08,01,28,12,58, 84., 28.1, 9.5, 2.4, 9.5, 1.2,2236,11, 25.8, 0, 1,6.42, 60,005, 49.24579, 33.63885,254 036,08,01,28,13,29, 44., 28.2,22.7, 0.0,15.9, 0.0,2201,11, 26.1, 0, 1,6.36, 50,005, 55.76242, 34.39321,254 037,08,01,28,13,59, 65., 28.2,10.8, 0.0,18.5, 3.1,2218,11, 26.1, 0, 1,6.45, 50,005, 59.04255, 35.89877,254 038,08,01,28,14,29, 64., 28.2,15.6, 0.0,15.6, 0.0,2218,11, 26.4, 0, 1,6.52, 60,005, 65.60285, 36.62328,254 039,08,01,28,14,59, 57., 28.2,10.5, 1.8,10.5, 0.0,2218,11, 26.8, 0, 1,6.36, 50,005, 39.3617, 30.21372,254 040,08,01,28,15,29, 53., 28.2, 9.4, 3.8,13.2, 0.0,2236,11, 26.8, 0, 1,6.39, 50,005, 39.3617, 30.21372,254 041,08,01,28,15,59, 67., 28.3, 6.0, 0.0,14.9, 1.5,2218,11, 27.1, 0, 1,6.48, 60,005, 45.75972, 31.85519,254 042,08,01,28,16,29, 55., 28.5,14.6, 0.0,10.9, 0.0,2236,11, 27.1, 0, 1,6.36, 50,005, 45.4386, 31.63164,254 043,08,01,28,16,59, 53., 28.5,11.3, 0.0,15.1, 0.0,2218,11, 27.4, 0, 1,6.45, 60,005, 45.4386, 31.63164,254 044,08,01,28,17,29, 70., 28.4,21.4, 0.0, 7.2, 0.0,2236,11, 27.1, 0, 1,6.39, 50,005, 64.96927, 36.26958,254 045,08,01,28,17,59, 74., 28.4,12.2, 0.0,14.9, 0.0,2236,11, 27.4, 0, 1,6.48, 50,005, 64.96927, 36.26958,254 046,08,01,28,18,29, 78., 28.4,18.0, 0.0,14.1, 0.0,2218,11, 26.8, 0, 1,6.58, 60,005, 81.21159, 39.62489,254 047,08,01,28,18,59, 78., 28.4,14.1, 1.3,16.7, 1.3,2218,11, 26.8, 0, 1,6.52, 50,005, 77.96313, 38.98157,254 048,08,01,28,19,29, 74., 28.4,14.9, 1.4,13.5, 1.4,2218,11, 26.4, 0, 0,6.55, 50,005, 68.21775, 36.97021,254 049,08,01,28,19,59, 74., 28.4,13.5, 1.4,20.3, 2.7,2218,11, 26.1, 0, 0,6.88, 60,005, 77.96313, 40.25595,254 050,08,01,28,20,29, 72., 28.4,18.1, 1.4,18.1, 0.0,2236,11, 25.8, 0, 1,6.82, 50,005, 84.46005, 40.25595,254 051,08,01,28,20,59, 77., 28.4,24.7, 0.0,10.4, 1.3,2218,10, 25.8, 0, 1,6.91, 50,005, 87.70853, 40.87544,254 052,08,01,28,21,29, 63., 28.4,14.3, 0.0,19.1, 0.0,2218,10, 25.5, 0, 0,6.85, 50,005, 68.21775, 36.97021,254 053,08,01,28,21,59, 74., 28.4,18.9, 0.0,14.9, 0.0,2201,11, 25.2, 0, 0,7.03, 70,005, 81.21159, 39.62489,254 054,08,01,28,22,29, 64., 28.4,23.5, 1.6,21.9, 1.6,2218,11, 25.2, 0, 0,7.03, 60,005, 94.20546, 42.08207,254 055,08,01,28,22,59, 59., 28.5,17.0, 0.0,18.7, 0.0,2218,11, 24.9, 0, 1,7.03, 60,005, 68.1579, 36.93778,254 056,08,01,28,23,29, 74., 28.4,21.6, 0.0,23.0, 1.4,2218,11, 24.9, 0, 0,7.00, 70,005, 107.1993, 44.3802,254 057,08,01,28,23,59, 72., 28.4, 7.0, 4.2,22.2, 0.0,2218,10, 24.9, 0, 0,7.00, 60,005, 68.21775, 36.97021,254 058,08,01,29,00,29, 70., 28.4,18.6, 1.4,17.2, 0.0,2236,11, 24.6, 0, 0,7.00, 60,005, 81.21159, 39.62489,254 059,08,01,29,00,59, 65., 28.4,20.0, 0.0,18.5, 0.0,2218,11, 24.9, 0, 0,6.94, 50,005, 81.21159, 39.62489,254 060,08,01,29,01,29, 88., 28.4,13.6, 0.0,17.1, 0.0,2236,11, 24.9, 0, 0,7.03, 60,005, 87.70853, 40.87544,254 061,08,01,29,01,59, 69., 28.4,18.9, 1.5,23.2, 0.0,2218,10, 25.2, 0, 0,7.03, 60,005, 94.20546, 42.08207,254 062,08,01,29,02,29, 65., 28.4,16.9, 1.6,16.9, 1.6,2218,10, 25.5, 0, 0,6.88, 50,005, 68.21775, 37.6551,254 063,08,01,29,02,59, 78., 28.4,10.3, 1.3,14.1, 1.3,2201,10, 25.8, 0, 1,6.91, 60,005, 61.72082, 35.55207,254 064,08,01,29,03,29, 59., 28.4,10.2, 0.0,17.0, 0.0,2218,11, 26.1, 0, 0,6.94, 60,005, 51.97542, 33.28445,254 065,08,01,29,03,59, 81., 28.4,18.5, 0.0,12.4, 2.5,2236,11, 26.4, 0, 0,6.97, 60,005, 77.96313, 39.62489,254 066,08,01,29,04,29, 60., 28.5,15.0, 1.7,15.0, 1.7,2218,11, 26.4, 0, 0,6.76, 60,005, 58.42105, 34.78584,254 067,08,01,29,04,59, 52., 28.5, 9.6, 0.0,26.9, 1.9,2218,11, 26.8, 0, 1,6.73, 50,005, 61.7, 35.52089,254 068,08,01,29,05,29, 74., 28.4,17.6, 1.4,18.9, 0.0,2218,11, 26.8, 0, 1,6.48, 50,005, 87.70853, 40.87544,254 069,08,01,29,05,59, 62., 28.4,12.9, 0.0,21.0, 1.6,2218,11, 26.8, 0, 0,6.42, 50,005, 68.21775, 36.97021,254 070,08,01,29,06,29, 70., 28.4,
[R] ICANN 2008 Deadline Extended to March 10
ICANN 2008EXTENDED SUBMISSION DEADLINE MARCH 10 2008 Dear Colleague Due to numerous requests we decided to extend the submission deadline for ICANN 2008 to March 10, 2008 for regular papers and to March 20, 2008 for papers intended for special sessions and workshops. Papers in LNCS style of maximal length 10 pages can be submitted at http://www.icann2008.org/submit The conference proceedings will be published in Springer's Lecture Notes in Computer Science series. The 18th International Conference on Artificial Neural Networks, ICANN 2008, will be held on September 3-6 at the Diplomat hotel, Prague, Czech Republic. ICANN - International Conference on Artificial Neural Networks is an annual conference organized since 1998 by the ENNS - European Neural Network Society in co-operation with the International Neural Network Society and the Japanese Neural Network Society and it is a premier event in all topics related to neural networks. ICANN 2008 welcomes contributions on the theory od neurocomputing, algorithms and applications. Papers can be either submitted as regular papers or to special sessions: * Coupling, Synchronies and Firing Patterns: from Cognition to Disease * Constructive Neural Networks or workshops: * New Trends in Self-organization and Optimization of Artificial Neural Networks * Adaptive Mechanisms of the Perception-Action Cycle For more information please visit http://www.icann2008.org Sincerely, Vera Kurkova Chair of the Program Committee of ICANN 2008 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help for the first poster- a simple question
FAQ 7.31 (You need to understand what floating point numbers are) On 3/3/08, Xuejun Qin [EMAIL PROTECTED] wrote: Hi, there, I cannot get accurate value for calculation. for example: ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. xj. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help for the first poster- a simple question
On Mon, 2008-03-03 at 12:52 -0500, Xuejun Qin wrote: Hi, there, I cannot get accurate value for calculation. for example: ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. Answer 1: Read FAQ 7.31 - http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Answer 2: Use all.equal() ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld [1] -6.938894e-18 0.05*0.95-ld==0 [1] FALSE all.equal(0.05*0.95-ld, 0) [1] TRUE xj. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] looking for some reading on accuracy of binary computers and all.equal(); was: help for the first poster- a simple question
Xuejun Qin wrote: Hi, there, I cannot get accurate value for calculation. for example: ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. xj. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Yes, PLEASE do read the posting guide, first poster! There you will find that there are FAQs where your first poster's question is already answered. And that the subject line can be used in a sensible manner. Best, Uwe Ligges __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
On Mon, Mar 3, 2008 at 8:25 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) Just an example of Stigler's Law. Taking this to a whole new level of off topic, I wonder if Stigler's Law is self-referential? That is, should Stigler's Law more correctly be attributed to someone else? On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating the t-test for each row
If I understand you correctly what you want to do is do t-test (mu=0) for each column of the data. Treating the data as a data.frame rather than a matrix you can do something like this and then pick out the p-values but with 140 t-tests I don't know what you'll get in terms of anything meaninful. == aa - data.frame(a=rnorm(25, 5, 2), b=rnorm(1:25, 0,1)) mytea - apply(aa, 2, t.test) tresults - lapply(mytea, function(.tres) { data.frame(t.value=.tres[1],dfs=.tres[2],conf.int1=.tres$conf.int[1],conf.int2= .tres$conf.int[2],p.value=.tres[3]) }) finalresults - do.call(rbind, tresults) = (Thanks to Mark Leeds for the lapply approach) --- Keizer_71 [EMAIL PROTECTED] wrote: Hi Everyone, I need some simple help. Here are my codes ##will give me 1 probesets data.sub = data.matrix[order(variableprobe,decreasing=TRUE),][1:1,] dim(data.sub) data_output-write.table(data.sub, file = c://data_output.csv, sep = ,, col.names = NA) When i export to excel, it shows me this. This is just a short version. There are 1000 rows and 140 columns Sample_1_D Sample_1_C Sample_2_D Sample_2_C 1 2.425509867 11.34031409 11.46868531 11.75741478 Here is my question: How do create a new row and calculate the t-test so that it will give me the p-value Here is what i am looking for. The p-value is not correct but just an example. It needs to calculate the entire each row. There are 1 rows and 140 columns. thanks Kei Sample_1_D Sample_1_C Sample_2_D Sample_2_C p-value 1 2.425509867 11.34031409 11.46868531 11.75741478 .0034 I tried something like this. t.test(data.sub,mu=0) I am pretty new to R. I think it is showing me the entire p-value. -- View this message in context: http://www.nabble.com/Calculating-the-t-test-for-each-row-tp15808716p15808716.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help for the first poster- a simple question
R FAQ 7.31. G. On Mon, Mar 03, 2008 at 12:52:43PM -0500, Xuejun Qin wrote: Hi, there, I cannot get accurate value for calculation. for example: ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. xj. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] esercizio
Hey Flo, I'm not entirely sure what you're problem is -- due to the language thing, probably -- but I think you want a function that will give you (or computes in an intermediate step) the edit distance between strings. There is the sdists function in the cba package that might help (it can give you the pairwise distances between a bunch of strings easily), or you can use the agrep function to find approximate matches: max.edits - list(all=1, substitutions=1, insertions=0, deletions=0) words - c(casa, cosa, rosa) agrep(pattern=casa, x=words, max.distance=max.edits) [1] 1 2 i.e. casa matches (within 1 letter substitution) the 1st and 2nd elements of the words vector. casa is an approximate match to casa and to cosa but not rosa because that's two substitutions and we chose a max of one. - Mose On Mon, Mar 3, 2008 at 8:47 AM, Flo [EMAIL PROTECTED] wrote: Ciao a tutti! ho un problema con un esercizio in R. In una lista devo trovare tutte le parole che si differenziano per una lettera da un'altra parola. Esempio: per casa: cosa, rosa... C'è una formula generale da applicare a tutte le parole? Grazie dell'aiuto, Flo - - [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating the t-test for each row
apparently you want to check the genefilter package... it defines functions like: rowttests colttests rowFtests colFtests rowVars rowSds moreover, a quick look at Biobase is recommended... that would save you lots of time as you wouldn't have to reinvent the wheel. b On Mar 3, 2008, at 12:42 PM, Henrique Dallazuanna wrote: You can try this: cbind(data.sub, p.value=apply(data.sub, 1, function(x)t.test(x) $p.value)) On 03/03/2008, Keizer_71 [EMAIL PROTECTED] wrote: Hi Everyone, I need some simple help. Here are my codes ##will give me 1 probesets data.sub = data.matrix[order(variableprobe,decreasing=TRUE),] [1:1,] dim(data.sub) data_output-write.table(data.sub, file = c://data_output.csv, sep = ,, col.names = NA) When i export to excel, it shows me this. This is just a short version. There are 1000 rows and 140 columns Sample_1_D Sample_1_C Sample_2_D Sample_2_C 1 2.425509867 11.34031409 11.46868531 11.75741478 Here is my question: How do create a new row and calculate the t- test so that it will give me the p-value Here is what i am looking for. The p-value is not correct but just an example. It needs to calculate the entire each row. There are 1 rows and 140 columns. thanks Kei Sample_1_D Sample_1_C Sample_2_D Sample_2_Cp-value 1 2.425509867 11.34031409 11.46868531 11.75741478 .0034 I tried something like this. t.test(data.sub,mu=0) I am pretty new to R. I think it is showing me the entire p-value. -- View this message in context: http://www.nabble.com/Calculating-the-t-test-for-each-row-tp15808716p15808716.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
Yes, the sociologist Robert Merton. url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 On Mar 3, 2008, at 12:17 PM, Douglas Bates wrote: On Mon, Mar 3, 2008 at 8:25 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) Just an example of Stigler's Law. Taking this to a whole new level of off topic, I wonder if Stigler's Law is self-referential? That is, should Stigler's Law more correctly be attributed to someone else? On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with lme4 use and installation
On Mon, Mar 3, 2008 at 9:57 AM, Charilaos Skiadas [EMAIL PROTECTED] wrote: Nothing's wrong. It just means that the package or one of its dependencies, has its own xtabs function, which hides the default xtabs function, since it comes first in the search path. So when you next write xtabs(...), it is this new xtabs that is being loaded. If you want to call the original xtabs, you can still do it I think with stats::xtabs(...). This is a warning, not an error. It warns you that something you perhaps did not expect has just happened. Exactly. The warning actually comes from loading the Matrix package, a package is required by the lme4 package. Martin Maechler and I define an extended xtabs function as an S4 generic in the Matrix package. This version allows an optional argument sparse. When sparse = TRUE the new version produces a cross-tabulation in the form of a sparse matrix. As you might expect, this is particularly useful for sparse cross-tabulations. When sparse = FALSE, the default value, this version reverts to the xtabs function from the stats package. Thus the substitution should be benign except that it will make xtabs run infinitesimally slower because it requires an extra level of dispatch. Unless you are making thousands of calls to xtabs you shouldn't notice this. On Mar 3, 2008, at 10:33 AM, Andreas Nord wrote: Dear all, I've been trying to install the lme4 package from http://r-forge.r-project.org/projects/lme4/. However, when wanting to load the package, I get an message saying that x-tabs are masked (see pasted code). Can anyone point to what has gone wrong? Kind regards, Andreas Nord Sweden utils:::menuInstallLocal() package 'lme4' successfully unpacked and MD5 sums checked updating HTML package descriptions library(lme4) Loading required package: Matrix Loading required package: lattice Attaching package: 'Matrix' The following object(s) are masked from package:stats : xtabs -- View this message in context: http://www.nabble.com/Problem-with- lme4-use-and-installation-tp15806404p15806404.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
Dear Doug, As I recall, according to Stigler, yes -- he wasn't the first to formulate Stigler's law of eponymy (but I don't recall to whom he attributed it). Regards, John On Mon, 3 Mar 2008 12:17:59 -0600 Douglas Bates [EMAIL PROTECTED] wrote: On Mon, Mar 3, 2008 at 8:25 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) Just an example of Stigler's Law. Taking this to a whole new level of off topic, I wonder if Stigler's Law is self-referential? That is, should Stigler's Law more correctly be attributed to someone else? On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] using 'lrm' for logistic regression
Hi R, I am getting this error while trying to use 'lrm' function with nine independent variables: res = lrm(y1994~WC08301+WC08376+WC08316+WC08311+WC01001+WC08221+WC08106+WC0810 1+WC08231,data=y) singular information matrix in lrm.fit (rank= 8 ). Offending variable(s): WC08101 WC08221 Error in j:(j + params[i] - 1) : NA/NaN argument Now, if I take choose only four independent variables then there is no error. res = lrm(y1994~ WC08221+WC08106+WC08101+WC08231,data=y) But strangely, if I use 'glm', with the family as binomial(logit) and with the same dataset, it is working perfectly fine. res = glm(y1994~WC08301+WC08376+WC08316+WC08311+WC01001+WC08221+WC08106+WC0810 1+WC08231,data=y,family=binomial(logit)) Any ideas..? Regards Utkarsh This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 1D classifier and 2D classifier
Hi, Is there any package which provides the functions of create one dimensional and/or Two dimensional classifiers? Thanks much. -- Waverley @ Palo Alto __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help for the first poster- a simple question
On 03/03/08 12:52, Xuejun Qin wrote: Hi, there, I cannot get accurate value for calculation. for example: ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. I think what you are experiencing is this: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f (R FAQ 7.31 Why doesn't R think these numbers are equal?) Maybe handle it using round(). HTH m. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
--- John Fox [EMAIL PROTECTED] wrote: Dear Doug, As I recall, according to Stigler, yes -- he wasn't the first to formulate Stigler's law of eponymy (but I don't recall to whom he attributed it). Possibly a disgruntles M. de Moivre? Regards, John On Mon, 3 Mar 2008 12:17:59 -0600 Douglas Bates [EMAIL PROTECTED] wrote: On Mon, Mar 3, 2008 at 8:25 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) Just an example of Stigler's Law. Taking this to a whole new level of off topic, I wonder if Stigler's Law is self-referential? That is, should Stigler's Law more correctly be attributed to someone else? On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make plots with GNUplot. Have anyone tried that?
The gp.plot function has a type option that can either be 'p' for points or 'l' for lines, the function is not that complicated, you could easily add additional options. I don't know why your code is not creating the pdf file, you could try plotting to the screen first (don't change the output and terminal), make sure that the plot is there, then change the output and terminal and do a replot to see if that works. Given that, I agree with the others that gnuplot is probably not the best tool for this. Others have mentioned how to use cmr and other fonts within R, or I mentioned the tool for converting a .eps file to a .pgf file that when input into LaTeX will use the current fonts. Gnuplot is a fine program for what it was designed for, but as you want more and more sophisticated statistical plots it will become more and more frustrating to do them using gnuplot. Gnuplot was not really designed as a statistical tool (more a mathematical one). I once heard that the difference between a mathematician and a statistician is that one knows the difference between a variable and a constant and the other one doesn't. I think the difference between mathematicians and statisticians can be seen in the response to the mean value theorem: the mathematician sees it and says cool, I can compute averages using integrals, the statistician sees it and says cool, I can compute integrals using averages. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: Louise Hoffman [mailto:[EMAIL PROTECTED] Sent: Sunday, March 02, 2008 8:48 AM To: Greg Snow Cc: Gabor Csardi; r-help@r-project.org Subject: Re: [R] Make plots with GNUplot. Have anyone tried that? There is a very basic interface between R and gnuplot in the TeachingDemos package. Look at the help for gp.plot. [snip] This looks mighty interesting =) Is it possible to plot with lines (gnuplot syntex) so all the data points are connected? Also is it possible to make it write the output to a pdf file? (I using the gnuplot cvs which have pdfcairo support) When I try this, it doesn't write the pdf file. it works with gnuplot cvs. library(TeachingDemos) fuelData-read.table('fuel.csv',header=TRUE, sep=',') attach(fuelData) gp.open(where='/usr/local/bin/gnuplot') gp.send('set terminal pdfcairo font 'cmr10' size 8cm,4.6cm') gp.send('set output '../figures/q1-raw-data-gp.pdf'') gp.send('unset key') gp.send('set xlabel 'rtime'') gp.send('set ylabel 'FPI'') gp.send('set xrange [1979:2005]') gp.plot(rtime,fpi) gp.send('unset output') gp.close() __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help for the first poster- a simple question
Thanks for all response. Here is more closer to my question, p-0.05 f-0.05 ld-sqrt(f* (1 - f) * p * (1 - p)) D - (p * (1 - f) - ld)/p d - ((1 - p) * f - ld)/(1 - p) haplo-data.frame(D,d) haplo D d 1 -1.387779e-16 -7.304099e-18 cond1-pmin(haplo[,1],haplo[,2]) haplo[cond1=0,] But the program cannot get right one, because -1.387779e-16=0 is FALSE -7.304099e-18=0 is FALSE Thank you! xj. - Original Message - From: Gavin Simpson [EMAIL PROTECTED] To: Xuejun Qin [EMAIL PROTECTED] Cc: r-help@r-project.org Sent: Monday, March 03, 2008 12:57 PM Subject: Re: [R] help for the first poster- a simple question On Mon, 2008-03-03 at 12:52 -0500, Xuejun Qin wrote: Hi, there, I cannot get accurate value for calculation. for example: ld- 0.05*0.95-ld=-6.938894e-18 0.05*0.95-ld==0 is False. I met this problem in my program, how can I handle it. Thanks. Answer 1: Read FAQ 7.31 - http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Answer 2: Use all.equal() ld-sqrt(1*0.05*0.95*0.05*0.95) 0.05*0.95-ld [1] -6.938894e-18 0.05*0.95-ld==0 [1] FALSE all.equal(0.05*0.95-ld, 0) [1] TRUE xj. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make plots with GNUplot. Have anyone tried that?
There was some discussion a while back of an R pgf driver for latex. Is anyone working on that? On Mon, Mar 3, 2008 at 2:09 PM, Greg Snow [EMAIL PROTECTED] wrote: The gp.plot function has a type option that can either be 'p' for points or 'l' for lines, the function is not that complicated, you could easily add additional options. I don't know why your code is not creating the pdf file, you could try plotting to the screen first (don't change the output and terminal), make sure that the plot is there, then change the output and terminal and do a replot to see if that works. Given that, I agree with the others that gnuplot is probably not the best tool for this. Others have mentioned how to use cmr and other fonts within R, or I mentioned the tool for converting a .eps file to a .pgf file that when input into LaTeX will use the current fonts. Gnuplot is a fine program for what it was designed for, but as you want more and more sophisticated statistical plots it will become more and more frustrating to do them using gnuplot. Gnuplot was not really designed as a statistical tool (more a mathematical one). I once heard that the difference between a mathematician and a statistician is that one knows the difference between a variable and a constant and the other one doesn't. I think the difference between mathematicians and statisticians can be seen in the response to the mean value theorem: the mathematician sees it and says cool, I can compute averages using integrals, the statistician sees it and says cool, I can compute integrals using averages. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: Louise Hoffman [mailto:[EMAIL PROTECTED] Sent: Sunday, March 02, 2008 8:48 AM To: Greg Snow Cc: Gabor Csardi; r-help@r-project.org Subject: Re: [R] Make plots with GNUplot. Have anyone tried that? There is a very basic interface between R and gnuplot in the TeachingDemos package. Look at the help for gp.plot. [snip] This looks mighty interesting =) Is it possible to plot with lines (gnuplot syntex) so all the data points are connected? Also is it possible to make it write the output to a pdf file? (I using the gnuplot cvs which have pdfcairo support) When I try this, it doesn't write the pdf file. it works with gnuplot cvs. library(TeachingDemos) fuelData-read.table('fuel.csv',header=TRUE, sep=',') attach(fuelData) gp.open(where='/usr/local/bin/gnuplot') gp.send('set terminal pdfcairo font 'cmr10' size 8cm,4.6cm') gp.send('set output '../figures/q1-raw-data-gp.pdf'') gp.send('unset key') gp.send('set xlabel 'rtime'') gp.send('set ylabel 'FPI'') gp.send('set xrange [1979:2005]') gp.plot(rtime,fpi) gp.send('unset output') gp.close() __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [OT] normal (as in Guassian)
Douglas Bates wrote: On Mon, Mar 3, 2008 at 8:25 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/3/2008 9:10 AM, Rogers, James A [PGRD Groton] wrote: As someone of partly French heritage, I would also ask how this distribution came to be called Gaussian. It seems very unfair to de Moivre, who discovered the distribution at least half a century earlier. :-) Just an example of Stigler's Law. Taking this to a whole new level of off topic, I wonder if Stigler's Law is self-referential? That is, should Stigler's Law more correctly be attributed to someone else? No. If Stigler's Law were named after some prior person, then it wouldn't be an example of itself. Pat On Mar 2, 2008, at 7:33 AM, (Ted Harding) wrote: Hi Folks, Apologies to anyone who'd prefer not to see this query on this list; but I'm asking because it is probably the forum where I'm most likely to get a good answer! I'm interested in the provenance of the name normal distribution (for what I'd really prefer to call the Gaussian distribution). According to Wikipedia, The name normal distribution was coined independently by Charles S. Peirce, Francis Galton and Wilhelm Lexis around 1875. So be it, if that was the case -- but I would like to know why they chose the name normal: what did they intend to convey? As background: I'm reflecting a bit on the usage in statistics of everyday language as techincal terms, as in significantly different. This, for instance, is likely to be misunderstood by the general publidc when they encounter statements in the media. Likewise, normally distributed would probably be interpreted as distributed in the way one would normally expect or, perhaps, there was nothing unusual about the distribution. Comments welcome! With thanks, Ted. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] exercise
Hi, How can I solve this problem? I have to find in a list all the words which have the same letters, but one must be different. Ex pain: rain, pine... I hope you will understand my poor english! Thank you, Flo - - [[alternative HTML version deleted]] __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] I need to buy a book in R
Hi All, I am a new user in R and I would like to buy a book that teaches me how to use R. In addition, I may nees to do some advanced statistical analysis. Does anyone recommend some books or websites where I can learn R. Thanks -- View this message in context: http://www.nabble.com/I-need-to-buy-a-book-in-R-tp15811699p15811699.html Sent from the R help mailing list archive at Nabble.com. __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] I need to buy a book in R
On 3/3/2008 2:27 PM, kayj wrote: Hi All, I am a new user in R and I would like to buy a book that teaches me how to use R. In addition, I may nees to do some advanced statistical analysis. Does anyone recommend some books or websites where I can learn R. I would start with An Introduction to R, which is available here: http://cran.r-project.org/manuals.html You might find some of the contributed documentation (organized by language and length) useful: http://cran.r-project.org/other-docs.html Depending on what your background and interests are, one of the books on this list may meet your needs: http://www.r-project.org/doc/bib/R-books.html Thanks -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ 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/posting-guide.html and provide commented, minimal, self-contained, reproducible code.