Re: [R] Error message with nmds
On Tue, 2006-05-16 at 13:25 -0700, Jonathan Hughes wrote: I am trying to apply nmds to a data matrix but I receive the following error message: Error in isoMDS(dis, y = y, k = k, maxit = maxit) : zero or negative distance between objects 5 and 7 The data are in a vegetation cover-class matrix (species in columns, plots in rows, classes 1-8 with lots of zero values) converted to a dissimilarity matrix (bray curtis). I assumed that objects 5 and 7 refer to rows of my original data; and they do have the same species with the same cover classes. I deleted one of these rows but I received the same error message with a rerun of nmds. As it turns out, the new rows 5 and 7 are the same. How do I avoid this problem? Jonathan, this is a FAQ in the proper sense of the word: this is frequently asked. Last thread was on April, 2006. See https://stat.ethz.ch/pipermail/r-help/2006-April/092598.html and answers. You may also use RSiteSearch with keyword isoMDS to find other (and older) threads. cheers, jari oksanen -- Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland email [EMAIL PROTECTED], homepage http://cc.oulu.fi/~jarioksa/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] what does it mean when lm.gls says that the weight matrix has wrong dimension?
Michael [EMAIL PROTECTED] writes: If first fit my data column V1 to column V2 using normal lm fitting, call it fit1, then I used acf(fit1$residuals, type='cov', 40) function to obtain the autocovariance of the residuals, and then constructed a autocovariance matrix, I chose it to be 40x40. Call this autocovariance matrix B, I then use the following lm.gls function to fit using the above weight matrix: But what's wrong with my weight matrix? fit8=lm.gls(V1~V2, data=data1, W=B, inverse=TRUE); Error in lm.gls(V1 ~ V2, data = data1, W = B, inverse = TRUE) : dim(W) is not correct (That's in the MASS package, and the authors of the book it supports like you to say so. The rest of us would like to be spared the help.search step...) I would guess that either V1 does not have length 40 or dim(B) isn't 40x40 even though you intended it to 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Interrater and intrarater variability (intraclass correlationcoefficients)
Dear Harold, Thanks! I searched for Hoyt's Anova in R - but without success. Do you know if there is something available in R? Karl - Ursprüngliche Mail Von: Doran, Harold [EMAIL PROTECTED] An: Karl Knoblick [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Gesendet: Dienstag, den 16. Mai 2006, 13:52:00 Uhr Betreff: RE: [R] Interrater and intrarater variability (intraclass correlationcoefficients) It sounds as thought you are interested in Hoyt's Anova which is a form of generalizability theory. This is usually estimated using by getting the variance components from ANOVA. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Karl Knoblick Sent: Tuesday, May 16, 2006 6:10 AM To: r-help@stat.math.ethz.ch Subject: [R] Interrater and intrarater variability (intraclass correlationcoefficients) Hello! I want to calculate the intra- and interrater reliability of my study. The design is very simple, 5 raters rated a diagnostic score 3 times for 19 patients. Are there methods/funtions in R? I only found packages to calculate interrater variability and intraclass correlation coefficients for matrices of n*m (n subjects, m raters) - I have n subjects, m raters and r repetitions. Can anybody help? Thanks! Karl __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sparklines
Hi Sweave can be used to produce some very nice sparkline-type plots very easily. I'll send you some examples offline. best wishes Robin On 16 May 2006, at 23:56, Robert M. Ullrey wrote: I am fairly new to R so I don;t know much about manipulating it yet. I would like to make some sparklines http://www.edwardtufte.com/ bboard/q-and-a-fetch-msg?msg_id=0001ORtopic_id=1 using R. I have th pre-compiled R for MacOS on intel. Any help would be greatly appreciated. Thanks Robert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Fitting usual distributions.
Prof Brian Ripley a écrit : On Mon, 15 May 2006, Pair Pierre-Matthieu wrote: Hello, I am currently writing a program whose goal is to fit usual distributions (estimating parameters and confidence intervals for a given distribution). After some research in R, R-help and google I have found most of what I was looking for (especially thanks to MASS - fitdistr() ), however there are still a few distributions I could not find R code for: Multinormal, Truncated normal, Triangular, Uniform, Binomial, Multinomial. If there are any packages to fit these, a pointer in the right direction would be most appreciated. You don't need R code for most of these. Binomial, Multinomial: the MLEs are the sample proportions, and the se's are textbook formulae. Can also be done in fitdistr. Triangular, Uniform: non-standard estimation problems, but the MLEs of the support are the sample maximum and minimum. For a CI, you will need a profile likelihood interval, or some such. Truncated normal: pretty easy to do in fitdistr, provided the truncation point is known (is it?). Multinormal: the MLEs are the sample mean and the sample covariance (divisor n). Thank you for your help, this will be useful. To answer your question, in the case of the truncated normal, the the truncation point is unfortunately not necessarily known. I am currently trying to figure out how to estimate the distribution parameters in this case. If you are interested, I will post the answer when I have it. Thanks again, Pierre-Matthieu Pair Softia Ingénierie [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help
Dear Sir, Iam a French Student. Iam a new user of the « R » Software. I dont success to import data from Excel spreadsheet either using the function (read.table) and the function (Rodbc). In addition, I dont understand very well the help of the R Software. Could you please help me and give a simple numerical example using this procedure : read.table(file, header = FALSE, sep = , quote = \', dec = ., row.names, col.names, as.is = FALSE, na.strings = NA, colClasses = NA, nrows = -1, skip = 0, check.names = TRUE, fill = !blank.lines.skip, strip.white = FALSE, blank.lines.skip = TRUE, comment.char = #, allowEscapes = FALSE, flush = FALSE) read.csv(file, header = TRUE, sep = ,, quote=\, dec=., fill = TRUE, ...) read.csv2(file, header = TRUE, sep = ;, quote=\, dec=,, fill = TRUE, ...) read.delim(file, header = TRUE, sep = \t, quote=\, dec=., fill = TRUE, ...) read.delim2(file, header = TRUE, sep = \t, quote=\, dec=,, fill = TRUE, ...) This is my e-mail: [EMAIL PROTECTED] Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help
Hi as you are raised on Excel probably the best way for you would be: Start R Select the reagion in Excel you want to copy, preferably with a line of column headers Press Ctrl-C In R write my.first.data-read.delim(clipboard) and you transferred your data to do analysis. However I recommend you to read some tutorials mentioned on CRAN or elsewhere and start with examples from these tutorials. As regarding the help pages (or man pages) they usually have some examples which you can copy to R console and see the results. Don't be afraid, you probably will not harm yourself or your computer by such trial and error attempts. ;-) HTH Petr On 17 May 2006 at 9:59, karim99.karim wrote: Date sent: Wed, 17 May 2006 09:59:32 +0200 From: karim99.karim [EMAIL PROTECTED] To: R-help R-help@stat.math.ethz.ch Subject:[R] help Dear Sir, Iam a French Student. Iam a new user of the Ť R ť Software. I dont success to import data from Excel spreadsheet either using the function (read.table) and the function (Rodbc). In addition, I dont understand very well the help of the R Software. Could you please help me and give a simple numerical example using this procedure : read.table(file, header = FALSE, sep = , quote = \', dec = ., row.names, col.names, as.is = FALSE, na.strings = NA, colClasses = NA, nrows = -1, skip = 0, check.names = TRUE, fill = !blank.lines.skip, strip.white = FALSE, blank.lines.skip = TRUE, comment.char = #, allowEscapes = FALSE, flush = FALSE) read.csv(file, header = TRUE, sep = ,, quote=\, dec=., fill = TRUE, ...) read.csv2(file, header = TRUE, sep = ;, quote=\, dec=,, fill = TRUE, ...) read.delim(file, header = TRUE, sep = \t, quote=\, dec=., fill = TRUE, ...) read.delim2(file, header = TRUE, sep = \t, quote=\, dec=,, fill = TRUE, ...) This is my e-mail: [EMAIL PROTECTED] Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn) [[alternative HTML version deleted]] Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] mc nemar test
Hello R users, I would like to perform a mc nemar test. There is my data : __ x - matrix(4:1,2,2) x [,1] [,2] [1,]42 [2,]31 __ My population is too small for normal approximation. __ library(concord) mcnemar.mh(x) $statistic [1] 0.2 $p [1] 0.6547208 Warning message: low cell counts - consider binomial test in: mcnemar.mh(x) ___ Do you have an advice to perform this test ? Is there a non-parametric one ? Thank you very much. -- David [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Can't there be a cd command?
Duncan Murdoch wrote: On 5/16/2006 5:46 AM, Joerg van den Hoff wrote: Manuel López-Ibáñez wrote: Jan T. Kim wrote: That's an idea I like very much too -- much better than the currently popular idea of protecting users from the unfriendliness of programming, anyway... It is just my opinion that the amount of mail in R-help speaks volumes about the current friendliness [1], or lack thereof, of R. Perhaps I am just the only one who thinks this way... [1] http://en.wikipedia.org/wiki/Usability I think you are 100% right: the r-help list says it all. needless to say, R is a great achievment without any doubt, but claiming that it's easy to use (beyond the most basic arithmetics) is really wishful thinking. This is sloppy thinking. The volume of mail here shows that there are a lot of questions, perhaps because there are a lot of users. well, as far as my english goes, 'sloppy' is a strong word (and apart from mathematicians physicists (my background) probably are the people who are most allergic to being accused of it :-)) and it's an overhasty conclusion on your side, I'd say. I want to make clear beforehand, that I do _not_ think this a very important discussion, but rather an informal exchange of opinions, so maybe this takes us all a bit to far, but anyway: for one, I myself (and I think manuel, too) was not talking of the shear volume of mails (this obviously would have to be 'calibrated' against the total number of R users and the resulting quantity had to be compared to other help-lists). at least my impression is, that there are a number of reoccuring difficulties in the mail, which are rather specific to R's design (whether this situation could or should be altered: that would be a different topic). certainly, among these are the subsetting/indexing issues, certainly lazy evaluation, certainly anything related to environments, namespaces, computing on the language (substitute, eval, ...). You're also misquoting Jan: he didn't say R was easy to use, he said that the idea of urging people to program is better than trying to be too friendly and protecting them from it. I did'nt quote anyone AFAIKS, so I can't have misquoted anyone (having misinterpreted someone I cannot rule out). the 'easy to use' did not refer to a special statement from this thread, but to the general impression one can get from the list and contributed as well as official manuals (I only checked now: the 'what is R?' section on the homepage contains one 'ease', one 'easy', one 'easily' within a total of two or three paragraphs...). it is pointless to dwell on this to long: what is easy for you might be difficult for me or vice versa, depending on the question to answer/ problem to solve. _if_ I take the freedom to interpret it as 'easy for the pedestrians', the statements are simply not true (easily extended via packages??). with reference to the idea of urging people to programm: well, the idea in itself is not objectionable, the question is how realistic the approach is (i.e. how large will be the success rate of getting people to programm, which otherwise would'nt have done _and_ is this rate larger in R than in the other packages?). I don't think programming R is easier than programming C, for example. I do both, and I think R programming is easier. It has a more sensible idea of scoping, it doesn't have the preprocessor doing bizarre transformations to the text, it doesn't have pointers writing to random memory locations, it can handle strings much more sensibly. this is all very well, though I only partly agree, but this a very technical assessment anyway and seems to indicate that a non-programmer will not be much better off with R as a 'starting language' than with C (since your criteria mostly will not be initially 'operational'). I _bet_ this starting phase would be easier with MATLAB/octave (but I'm not arguing for pushing beginners to MATLAB!). On the negative side, the vector orientation of R encourages people to come up with clever APL-style one-liners that are unreadable; the lack of type declarations, the weird handling of indexing, the strange object oriented programming models all make R programming hard. yepp. and cascaded apply/lapply calls, I'd add. So R is not easy, but it's easier than C. by a margin, maybe, though I have people in my group who definitely do object (making especially a point of the fact that they have difficulties to rapidly read/understand their own R code after a few month which they do not experience with their C++ stuff...) This is not to say that it takes the same time to solve the same problem in both languages, since in R many, many things are already there (either in the language (vectorized computations) or in the packages). but the quantity 'number of new lines of working code per hour' should be about the same. I have used MATLAB/octave previously. in comparison to R, the MATLAB language sure
Re: [R] sparklines
Hi everyone well, quite a few people were interested in my little sparklines example, and one suggestion was to post it on a webpage. What would be a good place to post it? [at this point, I'm becoming a little self conscious: the example was written for my amusement and probably could use some improvements] On 16 May 2006, at 23:56, Robert M. Ullrey wrote: I am fairly new to R so I don;t know much about manipulating it yet. I would like to make some sparklines http://www.edwardtufte.com/ bboard/q-and-a-fetch-msg?msg_id=0001ORtopic_id=1 using R. I have th pre-compiled R for MacOS on intel. Any help would be greatly appreciated. Thanks Robert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] trellis backround color
I am working in trellis package. I want to make backround white with lattice.options(default.theme = col.whitebg) it is still gray. what can I do to make bacground white ? regards -- Ahmet Temiz Jeoloji Müh. Afet İşleri Genel Müdürlüğü Deprem Araştırma Dairesi Tel: (312) 287 89 51 veya (312) 287 26 80/1547 Faks: (312) 287 89 51 E. Posta: [EMAIL PROTECTED] www.deprem.gov.tr Ahmet Temiz Geological Eng. General Directorate of Disaster Affairs Earthquake Research Department Phone: +90 (312) 287 89 51 or (312) 287 26 80/1547 Fax: +90 (312) 287 89 51 E. Mail: [EMAIL PROTECTED] www.deprem.gov.tr -- This message has been scanned for viruses and\ dangerous con...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Engel curve
That gave me a good start! Thanks a lot for your help, Werner --- roger koenker [EMAIL PROTECTED] schrieb: You could look at example(rq) in the quantreg package which uses the original Engel data 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 May 16, 2006, at 10:24 AM, Werner Wernersen wrote: Hi, has anybody an example of an Engel curve analysis in R or does there exist a package to estimate and plot Engel curves from expenditure / income data in R? Thanks a million for your hints, Werner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] mc nemar test
David Hajage [EMAIL PROTECTED] writes: Hello R users, I would like to perform a mc nemar test. There is my data : __ x - matrix(4:1,2,2) x [,1] [,2] [1,]42 [2,]31 __ My population is too small for normal approximation. __ library(concord) mcnemar.mh(x) $statistic [1] 0.2 $p [1] 0.6547208 Warning message: low cell counts - consider binomial test in: mcnemar.mh(x) ___ Do you have an advice to perform this test ? Is there a non-parametric one ? Thank you very much. The advice would seem to be rather precise: binom.test(2,5) Exact binomial test data: 2 and 5 number of successes = 2, number of trials = 5, p-value = 1 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.05274495 0.85336720 sample estimates: probability of success 0.4 -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Fix for augPred/gsummary problem (nlme library)
Dear R-users, I am a newbie to this site and a relative new-comer to S/R, so please tread lightly, for you tread... There have been several posting relating to problems with augPred() from the nlme library. Here is a fix for one of these problems which may lie at the root of others. In my case the problem with augPred() lay in gsummary(), which augPred() uses, causing it to fail. [From mucking around c using getAnywhere(augPred.lme), and setting: debug(gsummary).] Further ferreting around showed that the data structures within gsummary() are fine, but that any (numeric only?) variable that has a label attached to it (in my case from using Harrell's Hmisc library) causes the following sub-routine in gsummary() to fail: debug: if (dClass == numeric) { value[[nm]] - as.vector(tapply(object[[nm]], groups, FUN[[numeric]], ...)) } else { value[[nm]] - as.vector(tapply(as.character(object[[nm]]), groups, FUN[[dClass]])) if (inherits(object[, nm], ordered)) { value[[nm]] - ordered(value[, nm], levels = levels(object[, nm]))[drop: TRUE] } else { value[[nm]] - factor(value[, nm], levels = levels(object[, nm]))[drop: TRUE] } } Error Message: Error in [[-.data.frame(`tmp`, nm, value = c(1, 1, 1, 1, 1, 1, 1, : replacement has 170 rows, data has 5 The immediate problem is that dClass comes through as labeled rather than as numeric, and the object is erroneously passed through to the else{} group. In fact, the problem is general: any variable that carries the class labeled will cause the sub-routine to choke, as will any variable with a class attribute other than ' ordered' , e.g. POSIXt. This is true even if the variable carrying this 'other' class attribute isn't used in any lme() formula c. Code-wise the fix for this should be straight-forward. Though I've never coded in R/S, it's clear that the authors of the package should be using different conditional tests, something along the lines of is.numeric(obj)/is.factor(obj), if that's possible. Until a fix is posted, here is a work-around for groupedData() objects (and for raw data frames). You need to do this for all variables in the groupedData() object, even if you are not using them in your lme() call: 1) Use contents(obj) from the Hmisc package to look for variables with class attributes and labels. [You can also use str(obj); then look (i) for names in quotes immediately after the colon, e.g. DateTime: 'POSIXct'), or (ii) Class 'labeled' after the colon.] Remove these, or change them, using, e.g.: class(obj$DateTime) - NULL class(obj$AnyVariable) - 'numeric' ## leaves the actual labels/units intact so that you can later restore them. 2) Execute your lme() statement c on the object, e.g.: test.1 - lme(Chla ~ PO4, random=~1|Site, data=obj)## or simply: lme(obj) augPred(test.1) plot(augPred(test.1)) (Note that if you are using a data.frame() as your data object you will need to supply a 'primary' statement to augPred(), e.g. augPred(test.1, primary=~PO4). Regards, Mark Difford. - Ph.D. candidate, Botany Department, Nelson Mandela Metropolitan University, Port Elizabeth, SA. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] No output in sourced R program
Hi, If I type it in the command line I get, as expected: 1:30 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 q() Save workspace image? [y/n/c]: n If I create a program 02e451444d6a46acf551996579092c911b90aa8e.R and run it I get R : Copyright 2006, The R Foundation for Statistical Computing Version 2.3.0 (2006-04-24) source(02e451444d6a46acf551996579092c911b90aa8e.R) Save workspace image? [y/n/c]: n mars:/srv/www/htdocs/mediawiki/teachwiki/Rfiles # more 02e451444d6a46acf551996579092c911b90aa8e.R rfiles-/srv/www/htdocs/mediawiki/teachwiki/Rfiles 1:30 q() No output from 1:30 to the screen. Any idea what I do wrong ? Thanks Sigbert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] No output in sourced R program
G'day Sigbert, SK == Sigbert Klinke [EMAIL PROTECTED] writes: SK Hi, If I type it in the command line I get, as expected: 1:30 SK [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 SK 23 24 25 [26] 26 27 28 29 30 q() SK Save workspace image? [y/n/c]: n SK If I create a program SK 02e451444d6a46acf551996579092c911b90aa8e.R and run it I get SK R : Copyright 2006, The R Foundation for Statistical Computing SK Version 2.3.0 (2006-04-24) source(02e451444d6a46acf551996579092c911b90aa8e.R) SK Save workspace image? [y/n/c]: n SK mars:/srv/www/htdocs/mediawiki/teachwiki/Rfiles # more SK 02e451444d6a46acf551996579092c911b90aa8e.R SK rfiles-/srv/www/htdocs/mediawiki/teachwiki/Rfiles 1:30 q() SK No output from 1:30 to the screen. Any idea what I do wrong ? Autoprint of objects is only enabled on the command line, on all other levels you have to explictly call the print() command. So your script should be: print(1:30) q() BTW, interesting name for the file. How do you select that one? ;-) Cheers, Berwin PS: I heard rumours that Wiwi had HU-Berlin was using R instead of XploRe for some tasks. Slowly I start to believe it... :-)) == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australiahttp://www.maths.uwa.edu.au/~berwin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Bootstrap replicate estimates
Dear R People I´m student of master in statistic and data analysis. I did use R (SURVEY Package) to estimate sampling variance. The data is come from Incoming and Expendure Survey in Maputo City (Mozambique) careout by National Statistic Institute of Mozambique, from June 2002 to July 2003 . That is a stratified multi stage sampling design, with four strata (H=1, 2, 3 and 4). Within is strata an independent sample of PSU was selected and, in each sample PSU, one SSU (Enumeration Area-EA) was selected with PPS. Within each SSU 12 household was selected with igual probability. In the Mozambican context, the PSU is a group of 3-5 EA´s; one EA is a geographical area with 100-150 households. So the 2002/2003 Incoming and Expendure survey in Maputo City is a stratified multi stage sampling Survey: with 4 stratas and within each strata with three stage of selection (first, selection of PSU, second, selection of EA and third, selection of 12 household in each sample EA). I know, according to the Theory that in this kind of samples, the resample methods of variance estimation are used at the PSU level, assumpting that the PSU´s were selected with replacement. My sample size is 78 PSU, 78 EA and 936 households (936=78x12). My estimators are all Horvitz Thompson. So, with this knowledge, i did use SURVEY package: 1º I did define the stratified 2 level cluster design in Survey package; 2º From that sampling plan, i did define the replicate design for Bootstrap with 500 replicates. I would like to know, for example, in the first strata with 20 PSU how many subsamples or replicates are in default in SURVEY Package. My Regards Carlos __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] PCA with FactoMiner
Hello! I want to do Principal Component Analysis With FactoMiner package in . My data has 923 observation and 12 quantitatives variables. In data frame is there no missing values but are there Zeros as observed values for some units of analysis. When i execute the function PCA(testeff) is there one error: #error in V* poids: non-numeric argument to binary operator. Can anybody help? Thanks! Carlos __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] adding line to spinogram/histogram/etc solved
Viktor, what you said below was all correct for the specific situation you looked at, to get more of a general overview, look at some of the vignettes in the grid package vignette(package = grid) particularly grid and viewport and then maybe at vignette(package = vcd) which explains some of the ideas implemented in vcd. Best wishes, Z On Wed, 17 May 2006 01:56:02 +0100 Viktor Tron wrote: Thanks loads, extremely useful. So just for the record again. You have to get into the viewport that contains the actual graphplot with the axes. So, how you do it: 1. viewports have names. In case of histograms the relevant viewport is something like plotA.panel.X.Y.vp where A is the plot index and X, Y are the x, y indexes of the panel (as usual, starting from bottom left) but you can try out the other names shown by the current.vpTree() command in case in trouble. In case of spinograms you have to use the pop=FALSE option for the graph viewport inside the root to be retained. Then it is just called spinelot. 2. Once you figured out the name of the viewport you want to add plot to, issue seekViewport(spineplot) to get the focus on the viewport and then you can use the grid primitives the same way as you use lines, segments on normal plots. 3. If you want to use the scale of the axes (natrually what you want) you have to tell grid to use the NATIVE scale of the viewport (default.units=native). So something like this will do: grid.segments(,100,,100,gp=gpar(col=red),default.units=native) to add a 100 items cut-off line across a count type histogram. (Note the left out parameters which resolve to start/end as x1 and x2) Brilliant, cheers Achim. V On Tue, 16 May 2006 19:09:14 +0100, Achim Zeileis [EMAIL PROTECTED] wrote: On Tue, 16 May 2006 17:42:22 +0100 Viktor Tron wrote: Hello, Thanks for the hint. grid.segments seemed the closest I got. I did manage to draw (well fake) a line with it. I can only address the whole drawing frame, which means I can only adjust the position and length of the line by trial and error. I see no way to address the y axis scale of my spinogram/histogram. Is there a way? Yes, that's the wonderful thing about grid! Consider this example with data from vcd spine(Fail ~ Temperature, data = SpaceShuttle) Then you can look at the viewport tree in which you can navigate: current.vpTree() which leaves you here only with the ROOT node, hence you had troubles adjusting your lines. But looking at ?spine reveals that spine(Fail ~ Temperature, data = SpaceShuttle, pop = FALSE) does *not* pop away the viewport tree which is here relatively simple current.vpTree() just shows viewport[ROOT]-(viewport[spineplot]). So you can hop into the main picture seekViewport(spineplot) (which you can also name differently) and do more or less sensible things, e.g. grid.rect(gp = gpar(col = 2)) adds a red box around the plot or grid.lines(c(0, 1), c(0.3, 0.7), gp = gpar(col = 4)) adds a blue line. Note that both x- and y-axis are on a probability scale, i.e., it plots P(Temperature = x) vs. P(Fail = no). To see a more elaborated example how these graphics can be re-used, look at example(mob) in library(party). Best, Z Not a huge problem, but I thought someone must have thought of adding lines to their spinograms or histograms before... V On Mon, 15 May 2006 14:13:00 +0100, Prof Brian Ripley [EMAIL PROTECTED] wrote: Package vcd is built on grid, not base graphics. On Mon, 15 May 2006, Viktor Tron wrote: Dear all, I wonder what's special about spinograms {vcd} that prevents me from using it the way I do with other plots. I do: spine(f.speaker.identity ~ x.log.lengthening, data=ms,breaks=45,gp=gpar(fill=c(red,green)),xlab=length difference (log ms),ylab=speaker) curve(0*x,add=T) Error in plot.xy(xy.coords(x, y), type = type, col = col, lty = lty, ...) : plot.new has not been called yet OK, if I do curve(0*x,add=) spine(f.speaker.identity ~ x.log.lengthening, data=ms,breaks=45,gp=gpar(fill=c(red,green)),xlab=length difference (log ms),ylab=speaker) curve(0*x,add=T) then the plot is what I want, but note that I had to use y=0 to get the line put at 0.5 so it is already suspicious. But then: dev.print(pdf,mde_speakerration_by_lengthening.pdf) Error in dev.copy(device = function (file = ifelse(onefile, Rplots.pdf, : invalid graphics state Can anyone suggest a remedy? Use grid primitives to add to the plot. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list
[R] Renaming Rplots.ps from BATCH scripts.
I often use R CMD BATCH to run my files (e.g. script.R), and get the output recorded in script.Rout -- this is great. On my setup (R.2.3.0 on linux), if any plots are created, they get stored in Rplots.ps. This can get confusing if I have several batch scripts in one directory. I've written a simple shell script to rename Rplots.ps to e.g. script.Rout.ps so that later I can easily identify which script created the original postscript file. Just thought I'd share it in case others were interested, or had comments. Stephen -- #!/bin/sh ## Run R in BATCH mode. ## Usage: ## rb infile ## First (and only argument) is the R script to run in batch. in=${1} ## Check that the input file exists. if [ -r ${in} ] then ## I do not like .RData to be saved R CMD BATCH --no-save ${in} else echo File ${in} does not exist. exit -1 fi ## if Rplots.ps is readable, rename it to X.Rout.ps if [ -r Rplots.ps ] then outps=`basename ${in} .R`.Rout.ps mv Rplots.ps ${outps} fi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] No output in sourced R program
Sigbert Klinke [EMAIL PROTECTED] writes: Hi, If I type it in the command line I get, as expected: 1:30 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 q() Save workspace image? [y/n/c]: n If I create a program 02e451444d6a46acf551996579092c911b90aa8e.R and run it I get R : Copyright 2006, The R Foundation for Statistical Computing Version 2.3.0 (2006-04-24) source(02e451444d6a46acf551996579092c911b90aa8e.R) Save workspace image? [y/n/c]: n mars:/srv/www/htdocs/mediawiki/teachwiki/Rfiles # more 02e451444d6a46acf551996579092c911b90aa8e.R rfiles-/srv/www/htdocs/mediawiki/teachwiki/Rfiles 1:30 q() No output from 1:30 to the screen. Any idea what I do wrong ? Not reading the help file? (Try source(, echo=TRUE)) -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] replacement of dataframe
hello how can I replace dataframe data with another data ? something like: str(dpr2$eg) Factor w/ 8 levels 1,2,3,4,..: I want to replace 1 with 0-10 regards -- Ahmet Temiz Jeoloji Müh. Afet İşleri Genel Müdürlüğü Deprem Araştırma Dairesi Tel: (312) 287 89 51 veya (312) 287 26 80/1547 Faks: (312) 287 89 51 E. Posta: [EMAIL PROTECTED] www.deprem.gov.tr Ahmet Temiz Geological Eng. General Directorate of Disaster Affairs Earthquake Research Department Phone: +90 (312) 287 89 51 or (312) 287 26 80/1547 Fax: +90 (312) 287 89 51 E. Mail: [EMAIL PROTECTED] www.deprem.gov.tr -- This message has been scanned for viruses and\ dangerous con...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Renaming Rplots.ps from BATCH scripts.
It is easier to call postscript() explicitly in your script, as the R tests scripts do (and many of the package scripts, e.g. those under MASS). On Wed, 17 May 2006, Stephen Eglen wrote: I often use R CMD BATCH to run my files (e.g. script.R), and get the output recorded in script.Rout -- this is great. On my setup (R.2.3.0 on linux), if any plots are created, they get stored in Rplots.ps. This can get confusing if I have several batch scripts in one directory. I've written a simple shell script to rename Rplots.ps to e.g. script.Rout.ps so that later I can easily identify which script created the original postscript file. Just thought I'd share it in case others were interested, or had comments. Stephen -- #!/bin/sh ## Run R in BATCH mode. ## Usage: ## rb infile ## First (and only argument) is the R script to run in batch. in=${1} ## Check that the input file exists. if [ -r ${in} ] then ## I do not like .RData to be saved R CMD BATCH --no-save ${in} else echo File ${in} does not exist. exit -1 fi ## if Rplots.ps is readable, rename it to X.Rout.ps if [ -r Rplots.ps ] then outps=`basename ${in} .R`.Rout.ps mv Rplots.ps ${outps} fi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Interrater and intrarater variability (intraclass correlationcoefficients)
Well, depending on your design you can get the variance components from lmer or aov. Instead of looking for Hoyt's ANOVA in R, you should look at the method itself and then see how you can use the methods in R for estimating variance components. -Original Message- From: Karl Knoblick [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 17, 2006 1:50 AM To: Doran, Harold; r-help@stat.math.ethz.ch Subject: AW: [R] Interrater and intrarater variability (intraclass correlationcoefficients) Dear Harold, Thanks! I searched for Hoyt's Anova in R - but without success. Do you know if there is something available in R? Karl - Ursprüngliche Mail Von: Doran, Harold [EMAIL PROTECTED] An: Karl Knoblick [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Gesendet: Dienstag, den 16. Mai 2006, 13:52:00 Uhr Betreff: RE: [R] Interrater and intrarater variability (intraclass correlationcoefficients) It sounds as thought you are interested in Hoyt's Anova which is a form of generalizability theory. This is usually estimated using by getting the variance components from ANOVA. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Karl Knoblick Sent: Tuesday, May 16, 2006 6:10 AM To: r-help@stat.math.ethz.ch Subject: [R] Interrater and intrarater variability (intraclass correlationcoefficients) Hello! I want to calculate the intra- and interrater reliability of my study. The design is very simple, 5 raters rated a diagnostic score 3 times for 19 patients. Are there methods/funtions in R? I only found packages to calculate interrater variability and intraclass correlation coefficients for matrices of n*m (n subjects, m raters) - I have n subjects, m raters and r repetitions. Can anybody help? Thanks! Karl __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] replacement of dataframe
Hi On 17 May 2006 at 14:51, orkun wrote: Date sent: Wed, 17 May 2006 14:51:43 +0300 From: orkun [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] replacement of dataframe hello how can I replace dataframe data with another data ? something like: str(dpr2$eg) Factor w/ 8 levels 1,2,3,4,..: I want to replace 1 with 0-10 Replace levels attribute of a factor ?levels x-factor(sample(1:8,100, replace=T)) x [1] 4 6 4 3 7 2 6 1 2 2 2 1 6 8 7 7 4 4 7 5 6 3 3 8 6 2 2 4 8 5 8 6 3 4 2 1 6 1 4 6 8 4 4 2 7 4 5 2 2 5 5 1 1 6 8 5 5 5 8 5 6 5 2 3 6 [66] 4 2 6 1 7 5 5 3 4 5 2 5 1 3 2 3 8 4 7 8 4 1 3 6 3 6 7 7 4 4 8 6 6 5 8 Levels: 1 2 3 4 5 6 7 8 levels(x) [1] 1 2 3 4 5 6 7 8 levels(x)[1]-0-10 HTH Petr regards -- Ahmet Temiz Jeoloji Müh. Afet Ýţleri Genel Müdürlüđü Deprem Araţtýrma Dairesi Tel: (312) 287 89 51 veya (312) 287 26 80/1547 Faks: (312) 287 89 51 E. Posta: [EMAIL PROTECTED] www.deprem.gov.tr Ahmet Temiz Geological Eng. General Directorate of Disaster Affairs Earthquake Research Department Phone: +90 (312) 287 89 51 or (312) 287 26 80/1547 Fax: +90 (312) 287 89 51 E. Mail: [EMAIL PROTECTED] www.deprem.gov.tr -- This message has been scanned for viruses and\ dangerous con...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Combining Vectors
Hi, I'm a new R user, and struggeling with the basics (...sigh) I would like to combine 2 vectors : d1: S1 S2 S3 S4 13 5 6 and d2: S1S3 S5 3 3 2 to give a result: S1 S2 S3 S4 S5 135 6Na 3 Na3 Na 2 or better still: S1 S2 S3 S4 S5 135 6 0 3 03 0 2 Any ihelp will be appreciated Thanks Fanie Nel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Fix for augPred/gsummary problem (nlme library)
On Wed, 2006-05-17 at 09:48 +, Mark Difford wrote: Dear R-users, I am a newbie to this site and a relative new-comer to S/R, so please tread lightly, for you tread... There have been several posting relating to problems with augPred() from the nlme library. Here is a fix for one of these problems which may lie at the root of others. In my case the problem with augPred() lay in gsummary(), which augPred() uses, causing it to fail. [From mucking around c using getAnywhere(augPred.lme), and setting: debug(gsummary).] Further ferreting around showed that the data structures within gsummary() are fine, but that any (numeric only?) variable that has a label attached to it (in my case from using Harrell's Hmisc library) causes the following sub-routine in gsummary() to fail: debug: if (dClass == numeric) { value[[nm]] - as.vector(tapply(object[[nm]], groups, FUN[[numeric]], ...)) } else { value[[nm]] - as.vector(tapply(as.character(object[[nm]]), groups, FUN[[dClass]])) if (inherits(object[, nm], ordered)) { value[[nm]] - ordered(value[, nm], levels = levels(object[, nm]))[drop: TRUE] } else { value[[nm]] - factor(value[, nm], levels = levels(object[, nm]))[drop: TRUE] } } Error Message: Error in [[-.data.frame(`tmp`, nm, value = c(1, 1, 1, 1, 1, 1, 1, : replacement has 170 rows, data has 5 The immediate problem is that dClass comes through as labeled rather than as numeric, and the object is erroneously passed through to the else{} group. In fact, the problem is general: any variable that carries the class labeled will cause the sub-routine to choke, as will any variable with a class attribute other than ' ordered' , e.g. POSIXt. This is true even if the variable carrying this 'other' class attribute isn't used in any lme() formula c. Code-wise the fix for this should be straight-forward. Though I've never coded in R/S, it's clear that the authors of the package should be using different conditional tests, something along the lines of is.numeric(obj)/is.factor(obj), if that's possible. Until a fix is posted, here is a work-around for groupedData() objects (and for raw data frames). You need to do this for all variables in the groupedData() object, even if you are not using them in your lme() call: 1) Use contents(obj) from the Hmisc package to look for variables with class attributes and labels. [You can also use str(obj); then look (i) for names in quotes immediately after the colon, e.g. DateTime: 'POSIXct'), or (ii) Class 'labeled' after the colon.] Remove these, or change them, using, e.g.: class(obj$DateTime) - NULL class(obj$AnyVariable) - 'numeric' ## leaves the actual labels/units intact so that you can later restore them. 2) Execute your lme() statement c on the object, e.g.: test.1 - lme(Chla ~ PO4, random=~1|Site, data=obj)## or simply: lme(obj) augPred(test.1) plot(augPred(test.1)) (Note that if you are using a data.frame() as your data object you will need to supply a 'primary' statement to augPred(), e.g. augPred(test.1, primary=~PO4). Regards, Mark Difford. - Ph.D. candidate, Botany Department, Nelson Mandela Metropolitan University, Port Elizabeth, SA. Is this related to the same problem? I fit an intercepts-only model (both random and fixed): summary(fit.lme.1 - lme(nflnas.diff~1, + random=~1|id, + data=nfl.diff.iopec.gd,method=ML)) Linear mixed-effects model fit by maximum likelihood Data: nfl.diff.iopec.gd AIC BIC logLik 561.682 567.8112 -277.841 Random effects: Formula: ~1 | id (Intercept) Residual StdDev:20.86548 28.10644 Fixed effects: nflnas.diff ~ 1 Value Std.Error DF t-value p-value (Intercept) -26.3847.8022 47 -3.38161 0.0015 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.15240420 -0.49224313 0.06435735 0.51602333 2.78229869 Number of Observations: 57 Number of Groups: 10 plot(augPred(fit.lme.1,level=0:1),layout=c(5,2),aspect=1) Error in terms.default(formula, data = data) : no terms component If I replace: nflnas.diff~1 with something like: nflnas.diff~group where group is a dichotomous factor, augPred works as expected. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] replacement of dataframe
Or simply: sam - factor(sample(1:3,100,replace=T)) sam - factor(sam, labels=c(0-10,10-20,20-30)) Steve Miller -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Petr Pikal Sent: Wednesday, May 17, 2006 7:19 AM To: orkun; r-help@stat.math.ethz.ch Subject: Re: [R] replacement of dataframe Hi On 17 May 2006 at 14:51, orkun wrote: Date sent: Wed, 17 May 2006 14:51:43 +0300 From: orkun [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] replacement of dataframe hello how can I replace dataframe data with another data ? something like: str(dpr2$eg) Factor w/ 8 levels 1,2,3,4,..: I want to replace 1 with 0-10 Replace levels attribute of a factor ?levels x-factor(sample(1:8,100, replace=T)) x [1] 4 6 4 3 7 2 6 1 2 2 2 1 6 8 7 7 4 4 7 5 6 3 3 8 6 2 2 4 8 5 8 6 3 4 2 1 6 1 4 6 8 4 4 2 7 4 5 2 2 5 5 1 1 6 8 5 5 5 8 5 6 5 2 3 6 [66] 4 2 6 1 7 5 5 3 4 5 2 5 1 3 2 3 8 4 7 8 4 1 3 6 3 6 7 7 4 4 8 6 6 5 8 Levels: 1 2 3 4 5 6 7 8 levels(x) [1] 1 2 3 4 5 6 7 8 levels(x)[1]-0-10 HTH Petr regards -- Ahmet Temiz Jeoloji Müh. Afet Ýţleri Genel Müdürlüđü Deprem Araţtýrma Dairesi Tel: (312) 287 89 51 veya (312) 287 26 80/1547 Faks: (312) 287 89 51 E. Posta: [EMAIL PROTECTED] www.deprem.gov.tr Ahmet Temiz Geological Eng. General Directorate of Disaster Affairs Earthquake Research Department Phone: +90 (312) 287 89 51 or (312) 287 26 80/1547 Fax: +90 (312) 287 89 51 E. Mail: [EMAIL PROTECTED] www.deprem.gov.tr -- This message has been scanned for viruses and\ dangerous con...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] changing single to double backslash
Hi, all. I didn't find something like this in the faq list: I wound like build a function to substitute single backslashes in a string to double: ChangeSlash-function(dir) ... so ChangeSlash(C:\mydocs\test) returns C:\\mydocs\\test Thanks, C. ___ Abra sua conta no Yahoo! Mail: 1GB de espaço, alertas de e-mail no celular e anti-spam realmente eficaz. http://br.info.mail.yahoo.com/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problem with make install for R 2.3.0/Solaris 2.8
Building/Installing R 2.3.0 on under Solaris 2.8 make install fails in the etc directory with an /bin/bash error unexpected ; token. The following lines in the etc/Makefile appear to be the cause: EXPORTFILES = # R.exp Rlapack.exp @for f in $(EXPORTFILES); do \ $(INSTALL_DATA) $${f} $(rhome)/$(subdir); \ done EXPORTFILES is an empty variable. My temporary fix was to comment out the three lines above and repeat make install. //=\John Powell, CAPT, Ret. USPHS Phone: (301) 496-2963 \=//Building 12A, Room 2033FAX: (301) 402-2867 //=\ National Institutes of Health \=// Bethesda, MD 20892-5624Work: [EMAIL PROTECTED] //=\ Personal: [EMAIL PROTECTED] \=// //=\ BioInformatics Molecular Analysis Section-BIMAS/CBEL/CIT/NIH - __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Combining Vectors
On Wed, 2006-05-17 at 14:58 +0200, Fanie Nel wrote: Hi, I'm a new R user, and struggeling with the basics (...sigh) I would like to combine 2 vectors : d1: S1 S2 S3 S4 13 5 6 and d2: S1S3 S5 3 3 2 to give a result: S1 S2 S3 S4 S5 135 6Na 3 Na3 Na 2 or better still: S1 S2 S3 S4 S5 135 6 0 3 03 0 2 Any ihelp will be appreciated You want to use the merge() function, which will enable you to perform a match of the common columns in the two vectors. Note that the result of merge() will create a data frame and the column order will be based upon the common columns first, so in this case S1 and S3: # Set 'all = TRUE' to include all rows DF - merge(d1, d2, all = TRUE) DF S1 S3 S2 S4 S5 1 1 5 3 6 NA 2 3 3 NA NA 2 We can then reorder the columns using names(): DF - DF[, order(names(DF))] DF S1 S2 S3 S4 S5 1 1 3 5 6 NA 2 3 NA 3 NA 2 Note that NA has a specific intent in R relative to missing or undefined values. Setting NA's to 0 may have behavioral impacts that you need to be aware of depending upon what you intend to do: # Set NA's in DF to 0 DF[is.na(DF)] - 0 DF S1 S2 S3 S4 S5 1 1 3 5 6 0 2 3 0 3 0 2 See ?merge, ?order and ?is.na for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problem with make install for R 2.3.0/Solaris 2.8
This is already changed in R-patched: the issue is that your /bin/bash is not current (it was first reported for 2.05, I believe). On Wed, 17 May 2006, John Powell (NIH/CIT) [E] wrote: Building/Installing R 2.3.0 on under Solaris 2.8 make install fails in the etc directory with an /bin/bash error unexpected ; token. The following lines in the etc/Makefile appear to be the cause: EXPORTFILES = # R.exp Rlapack.exp @for f in $(EXPORTFILES); do \ $(INSTALL_DATA) $${f} $(rhome)/$(subdir); \ done EXPORTFILES is an empty variable. My temporary fix was to comment out the three lines above and repeat make install. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] changing single to double backslash
On Wed, 17 May 2006, Cézar Freitas wrote: Hi, all. I didn't find something like this in the faq list: Well, the FAQ and the rw-FAQ suggest that you need to use doubled backslashes when entering the string. I wound like build a function to substitute single backslashes in a string to double: ChangeSlash-function(dir) ... so ChangeSlash(C:\mydocs\test) returns C:\\mydocs\\test This is not possible: C:\mydocs\test is parsed with \t indicating a tab and \m indicating m. -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] script S-plus - R
Dear List, I'm trying to transfer a script that uses S-plus functions for the kernel and integration calculations to R. This it what it looks like in S-plus: qrm(cpt,don,ect,h,intctk,nbcol,nbl1,nbl2,nbl3,nlc,nlgn,overlap,Results,tdon,tdon1,tdon11,tdon2,tdon21) don-guiDisplayFileDialog() import.data (DataFrame=tdon,FileName=don,FileType=EXCEL) nbcol-length(tdon[1,]) nlc-matrix(0,1,nbcol) for (i in 1:nbcol) {nbl1-tdon[,i] nbl2-nbl1[nbl1!=NA] nbl3-numRows(nbl2) nlc[,i]-nbl3 ect-colStdevs(tdon,na.rm=T,unbiased=T) h-1.06*ect*(nlc^-0.2) cpt-0 nlgn-choose(nbcol,2) Results-matrix(*,nrow=nlgn,ncol=3,dimnames=list(NULL,c(Ech.1,Ech.2,Overlap))) for (i in 1:(nbcol-1)) {tdon1-tdon[,i] tdon11-tdon1[tdon1!=NA] fctk1-function(x) {ksmooth(tdon11,kernel=normal,bandwidth=h[i],x.points=x)$y} for (j in (i+1):nbcol) {tdon2-tdon[,j] tdon21-tdon2[tdon2!=NA] fctk2-function(x) {ksmooth(tdon21,kernel=normal,bandwidth=h[j],x.points=x)$y} diffctk-function(x) {abs(fctk1(x)-fctk2(x))} intctk-integrate(diffctk,-Inf,+Inf,subdivisions=100)$integral overlap-1-0.5*intctk cpt-cpt+1 Results[cpt,]-c(name.cols(tdon[i]),name.cols(tdon[j]),round(overlap,3)) }} ## tdont is an application example: tdont - data.frame(sp.1=c (2 ,3 ,5 ,7, 12) , sp.2=c (4, 2, 4, 8, 11, ),sp.3=c(NA, 4, 2, 6, 13 ), sp.4=c(3 ,1, 1, NA, 10), sp.5=c(2 ,NA ,2, 9, 9) I tried something like this in R: nbcol-length (tdont[1,]) nlc-matrix (0,1,nbcol) for (i in 1:nbcol) { nbl1-tdont[,i] nbl2-subset (nbl1, nbl1 != NA) nbl3-length (nbl2) nlc[,i]-nbl3 } ect - apply(tdont, 1, sd, na.rm=T) h-1.06*ect*(nlc^-0.2) cpt-0 nlgn-choose(nbcol,2) Results-matrix(*,nrow=nlgn,ncol=3,dimnames=list(NULL,c(Ech.1,Ech.2,Overlap))) for(i in 1:(nbcol-1)) { tdon1-tdont[,i] tdon11-subset(tdon1,tdon1 !=NA) fctk1-function(x) {density(tdon11,kernel=gaussian,bandwidth=h[i],x.points=x)$y} for (j in (i+1):nbcol) {tdon2-tdont[,j] tdon21-subset(tdon2,tdon2 !=NA) fctk2-function(x) {density(tdon21,kernel=gaussian,bandwidth=h[j],x.points=x)$y} diffctk-function(x) {abs(fctk1(x)-fctk2(x))} intctk-integrate(diffctk,-Inf,+Inf,subdivisions=100)$integral overlap-1-0.5*intctk cpt-cpt+1 Results[cpt,]-c(col.names(tdont[i]),row.names(tdont[j])) # round(overlap,digits= 3)) }} However, I have trouble when using it: Error in integrate(diffctk, -Inf, +Inf, subdivisions = 100) : evaluation of function gave a result of wrong length Warning messages: 1: argumentos adicionais não pareados são desconsiderados in: density.default(tdon11, kernel = gaussian, bandwidth = h[i], 2: argumentos adicionais não pareados são desconsiderados in: density.default(tdon21, kernel = gaussian, bandwidth = h[j], I'm sorry for so lengthy e-mail, so here are my apologies. But I don't know what I'm doing wrong. Thanks, Rogério -- Rogério R. Silva Laboratório de Hymenoptera Museu de Zoologia da USP Av. Nazaré 481, 04263-000 São Paulo SP GNU/Linux User # 354364 Linux-Debian Etch: 2.6.15 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] everytime I download a new version of R, need I reinstall all packages?
On Tue, 16 May 2006, Christos Hatzis wrote: The process that you outlined is described in the Windows R FAQ 2.8 What's the best way to upgrade?. The same process should apply to other platforms as well, but I don't think it is in the general R FAQ. Perhaps it should. For non-Windows systems I don't think it is a Frequently asked question. My guess is that this is because most people will not have write access to the R installation and so will use a local library directory that does not need this sort of intervention when changing R versions. -thomas -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Berton Gunter Sent: Tuesday, May 16, 2006 8:16 PM To: 'Michael' Cc: R-help@stat.math.ethz.ch Subject: Re: [R] everytime I download a new version of R,need I reinstall all packages? I think you did not answer my question... I now upgraded my main R program from 2.2.1 to 2.3.0 and I removed the 2.2.1 installation, but all the Wait until after you use update.packages() to remove your previous installation. You can keep multiple versions of R simultaneously, so this is no problem. That is: 1) Install new R version 2) Run update.packages() on old library version 3) Copy updated old library to new library location (or point new library location to old) 4) Remove old R version (and its libraries if you copied them) There are probably better ways to do this, which this message may stimulate. -- Bert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Justifying R to anti open-source management
Not precisely what you are looking for, but perhaps http://www.burns-stat.com/pages/Tutor/R_relative_statpack.pdf can help. 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) Peter Baker (CMIS, St Lucia) wrote: Hi I apologise for this question as it really must be a FAQ. Unfortunately, I can't find the answer and I'm tired of looking at endless google results A colleague of mine works for a state government department that has a policy against open source software or software tainted by open source. Other government departments in the same state use R but this particular department is driven by very non-numerate people and superficially at least it appears somewhat backward IT-wise. The department may purchase SPlus (which may be better for non programmer types anyway) or SPSS but it would nice to have the option to use R The Q: Are there any documents/reports/papers out there justifying R that comment on - quality of R - huge range of libraries available - support (via a huge and enthusiastic user base - any ideas on how many people use R) I suspect that providing existing documents would carry more weight rather than writing a case from scratch or providing people's email opinions Thanks in advance! Cheers Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question about survSplit
Dear R-users, I use the survsplit function in the survival package to change my data into counting-process format and the transformed format is as follow: (a) start stop event DP age 0 5 01 20 5 1001 20 1025 11 20 looking at the above three entries that belong to the same person, if an event happen at time 5, won't the person actually enter the risk set twice since there is another entry that start at time 5 and Cox proportional hazard model won't know that it actually belong to the same person. Shouldn't it be like this? (b) start stop event DP age 0 5 01 20 610 01 20 11 2511 20 or the R-function coxph has already take this into account when calculating its risk set although I believe (a) is actually the correct one. Your advice is greatly appreciated! regards, sing yee [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Justifying R to anti open-source management
hi, * http://www.r-project.org/ R-home * http://www.itp.phys.ethz.ch/econophysics/R/index.html R-financial * http://wiki.r-project.org/rwiki/doku.php#r_wiki_-_overview R-overview * http://addictedtor.free.fr/graphiques/index.php R-graphics should give you a piece of advice with all the links related. Best, Yves Le mer 17/05/2006 à 16:39, Patrick Burns a écrit : Not precisely what you are looking for, but perhaps http://www.burns-stat.com/pages/Tutor/R_relative_statpack.pdf can help. 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) Peter Baker (CMIS, St Lucia) wrote: Hi I apologise for this question as it really must be a FAQ. Unfortunately, I can't find the answer and I'm tired of looking at endless google results A colleague of mine works for a state government department that has a policy against open source software or software tainted by open source. Other government departments in the same state use R but this particular department is driven by very non-numerate people and superficially at least it appears somewhat backward IT-wise. The department may purchase SPlus (which may be better for non programmer types anyway) or SPSS but it would nice to have the option to use R The Q: Are there any documents/reports/papers out there justifying R that comment on - quality of R - huge range of libraries available - support (via a huge and enthusiastic user base - any ideas on how many people use R) I suspect that providing existing documents would carry more weight rather than writing a case from scratch or providing people's email opinions Thanks in advance! Cheers Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re : Large database help
Thanks for doing this Thomas, I have been thinking about what it would take to do this, but if it were left to me, it would have taken a lot longer. Back in the 80's there was a statistical package called RUMMAGE that did all computations based on sufficient statistics and did not keep the actual data in memory. Memory for computers became cheap before datasets turned huge so there wasn't much demand for the program (and it never had a nice GUI to help make it popular). It looks like things are switching back to that model now though. Here are a couple of thought that I had that maybe could help with some future development: Another function that could be helpful is bigplot which I imagine would be best based on the hexbin package, just accumulating the counts in chunks like your biglm function. Once I see the code for biglm I may be able to contribute this piece. I guess bigbarplot and bigboxplot may also be useful (accumulating counts for the barplot will be easy, but does anyone have ideas on the best way to get quantiles for the boxplots efficiently (the best approach I can think of so far is to have the database sort the variables, but sorting tends to be slow)). Another general approach that I thought of would be to read the data in in chunks, compute the statistic(s) of interest on each chunk (vector of coefficients for regression models) then average the estimates across chunks. Each chunk could be treated as a cluster in a cluster sample for the averaging and estimating variances for the estimates (if only we can get the author of the survey package involved :-). This would probably be less accurate than your biglm function for regression, but it would have the flavor of the bootstrapping routines in that it would work for many cases that don't have their own big methods written yet (logistic and other glm models, correlations, ...). Any other thoughts anyone? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Tuesday, May 16, 2006 3:40 PM To: roger koenker Cc: r-help list; Robert Citek Subject: Re: [R] Re : Large database help On Tue, 16 May 2006, roger koenker wrote: In ancient times, 1999 or so, Alvaro Novo and I experimented with an interface to mysql that brought chunks of data into R and accumulated results. This is still described and available on the web in its original form at http://www.econ.uiuc.edu/~roger/research/rq/LM.html Despite claims of future developments nothing emerged, so anyone considering further explorations with it may need training in Rchaeology. A few hours ago I submitted to CRAN a package biglm that does large linear regression models using a similar strategy (it uses incremental QR decomposition rather than accumalating the crossproduct matrix). It also computes the Huber/White sandwich variance estimate in the same single pass over the data. Assuming I haven't messed up the package checking it will appear in the next couple of day on CRAN. The syntax looks like a - biglm(log(Volume) ~ log(Girth) + log(Height), chunk1) a - update(a, chunk2) a - update(a, chunk3) summary(a) where chunk1, chunk2, chunk3 are chunks of the data. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] question about survSplit
Check the literature - an excellent article is rhDNase as an example of recurrent Event Analysis, Therneau, Hamilton, Statistics in Medicine, Vol 16, 2029-2047 Implicitly the intervals are ( ... ]. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of singyee ling Sent: Wednesday, May 17, 2006 8:01 AM To: r-help@stat.math.ethz.ch Subject:[R] question about survSplit Dear R-users, I use the survsplit function in the survival package to change my data into counting-process format and the transformed format is as follow: (a) start stop event DP age 0 5 01 20 5 1001 20 1025 11 20 looking at the above three entries that belong to the same person, if an event happen at time 5, won't the person actually enter the risk set twice since there is another entry that start at time 5 and Cox proportional hazard model won't know that it actually belong to the same person. Shouldn't it be like this? (b) start stop event DP age 0 5 01 20 610 01 20 11 2511 20 or the R-function coxph has already take this into account when calculating its risk set although I believe (a) is actually the correct one. Your advice is greatly appreciated! regards, sing yee [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Response to query re: calculating intraclass correlations
Karl, If you use one of the specialized packages to calculate your ICC, make sure that you know what you're getting. (I haven't checked the packages out myself, so I don't know either.) You might want to read David Futrell's article in the May 1995 issue of Quality Progress where he describes six different ways to calculate ICCs from the same data set, all with different interpretations. All of the inputs for these calculations come from the repeated measures analysis which is described in PB. Good luck! P. Message: 1 Date: Tue, 16 May 2006 10:09:54 + (GMT) From: Karl Knoblick [EMAIL PROTECTED] Subject: [R] Interrater and intrarater variability (intraclass correlation coefficients) To: r-help@stat.math.ethz.ch Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Hello! I want to calculate the intra- and interrater reliability of my study. The design is very simple, 5 raters rated a diagnostic score 3 times for 19 patients. Are there methods/funtions in R? I only found packages to calculate interrater variability and intraclass correlation coefficients for matrices of n*m (n subjects, m raters) - I have n subjects, m raters and r repetitions. Can anybody help? Thanks! Karl -- Paul Mathews Mathews Malnar and Bailey, Inc. 217 Third Street, Fairport Harbor, OH 44077 Phone: 440-350-0911 Fax: 440-350-7210 E-mail: Paul: [EMAIL PROTECTED], [EMAIL PROTECTED] Rebecca: [EMAIL PROTECTED], [EMAIL PROTECTED] Web: www.mmbstatistical.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] checking package dependencies
Dear all, I seem to be unable to check a source package since I upgraded R to 2.3.0 (Ubuntu Linux 5.1). I get this: * checking package dependencies ... ERROR tools:::.check_package_depends(/home/adi/Work/QCAGUI) I have even tried with R-patched, same result. My Renviron does specify the path to the installed packages (and all depending packages are installed): R_LIBS=${R_LIBS-'/home/adi/Installed/R/site-library:/usr/local/lib/R/site-library:/usr/local/lib/R/library'} Is there something changed about defining R_LIBS? Thank you in advance, Adrian -- Adrian DUSA Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] about MCMC pack
I'm not able to replicate the error. The first example in the MCMCirtKd help file worked fine for me. It ran in under 4 minutes on my computer. The plot produced several pages of output, which required manual intervention to move from one to the next. The 'summary' command also seemed to perform appropriately, without an error message. I killed the second example after about 15 minutes of compute time, so I don't know if it would have worked or not. You might get better help if you provide a simple, self-contained example that actually replicates the error message you got (as suggested in the posting guide, www.R-project.org/posting-guide.html). What have you tried to simplify the problem? For example, can you find numbers smaller than 'burnin = 1000, mcmc = 1' for which you get the same problem, e.g., burnin=2, mcmc=2 or 'burnin=100, mcmc=100'? If yes, that should substantially reduce the time required to isolate this problem. Also, if you change some of the arguments, when do you get the problem and when does it disappear? I noticed you specified 'thin=1, verbose = 1, seed = NA,alphabeta.start = NA, b0 = 0, B0=0, store.item = FALSE, store.ability=FALSE, drop.constant.items=TRUE'. All but one of these is at its default value. In R, arguments assuming their default values do not have to be provided. If dropping one of these arguments changes the behavior of the function, that's a problem. In particular, what do you get with the default value for 'item.constraints'? If the problem goes away, that suggests you need to be more careful about specifying 'item.constraints'. If this fails, my next step is 'debug': You can make local copies of MCMCirtKd (and MCMCordfactanal, which it calls to do most of the work) and follow along, step by step, until you find where it bombs -- and hopefully also in the process figure out what to change to fix it. hope this helps. Spencer Graves p.s. Please also include 'sessionInfo()'; otherwise, potential respondents don't know if you are using an obsolete version of something that might already have been fixed. My sessionInfo() is as follows: Version 2.3.0 (2006-04-24) i386-pc-mingw32 attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: MCMCpack MASS coda lattice 0.7-1 7.2-27 0.10-5 0.13-8 Mariagiulia Matteucci wrote: Hello, I tryed to use the MCMC pack, particularly the function MCMCirtKd to simulate the posterior distribution in a multidimensional IRT model. The code I used is: posterior1 - MCMCirtKd(Y, dimensions=2, item.constraints=list(V2=list(3,0)), burnin = 1000, mcmc = 1, thin=1, verbose = 1, seed = NA, alphabeta.start = NA, b0 = 0, B0=0, store.item = FALSE, store.ability=FALSE, drop.constant.items=TRUE) where Y is a matrix subjects x items (1500 x 32) of simulated response sequences. After running the program, if I ask for a plot or summary of the MCMC object posterior1, I obtain this message: Error in as.matrix.mcmc(x) : the lenght of'dimnames' [2] doesn't coincide with the array extension More: Warning message: the number of elements to replace is not a multiple of the lenght of replacement I cannot interpret this warning message, thank you for help or suggestions! Mariagiulia Mariagiulia Matteucci Dipartimento di Scienze Statistiche “Paolo Fortunati” Università di Bologna Via Belle Arti, 41 40126 Bologna (ITALY) e-mail: [EMAIL PROTECTED] TEL: +39 051 272503 FAX: +39 051 232153 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] for loops and counter interpolation
Hi I'm sorry about the triviality of my problem. I have a vector (v) of three columns (logA, logB, id). I want to compute (and plot) the correlation between logA and logB for different thresholds of id (e.g. 30, etc). So I tried: for(i in 1:100){ points(cor(v$logA[v$idi], v$logB[v$idi], use=complete.obs), i)) } (i created a plot object already) but it comes with the error: x is empty, ie it doesn't interpolate the value of i in the for loop into the vector selection. Does anyone know if there's any better way of doing this? Many Thanks Eleni Rapsomaniki Birkbeck College, UK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Can't there be a cd command?
Hi, I am afraid this discussion is going into the wrong direction. I do agree with some comments of Joerg van den Hoff, however, I cannot adhere to some things said in the last paragraphs. I was just expressing a personal observation and I was expecting many people to have disagree and perhaps very few to agree. However, it was just an opinion. Unfortunately, during the next months I am going to have little free time, so I cannot: (1) gather examples of usability issues in R, (2) support them by user cases from R-help, (3) propose solutions and put forth reasons and argue for the changes one by one.[*] In a software libre project, complaining without contributing is futile, pointless and even insulting to the people that do contribute. That is the reason why I did not send any further comments on this. Of course, I would be very happy if someone (or some group) decided to start to work on this. However, as said before, I don't consider I have the right to tell anybody that they must do it. Thus, a discussion on whether R is hard/easy or R has to be hard/easy or R is harder/easier than program/language X or R is like deciphering hieroglyphics / R is like piloting an Apache helicopter is pointless in my opinion. So please, don't quote me or mention me in such kind of discussion. Please, don't even reply to such messages: there is already enough traffic in R-help. Now, Joerg van de Hoff points out particular cases (like subsetting/indexing issues) where new users seem to always have problems. That is a better approach: focusing on actual cases. Still, more work needs to be done to identify where the problems are and how to solve them. That would imply to examine the reaction of users (from R-help or your own students), since your (my) personal experience is almost useless once you know the answer (magic syntax or workaround). Therefore, the value of I think this is hard/easy because it is hard/easy for me is close to zero. Such discussion may end up on people calling names and I don't want to be involved on that. I think working mainly off-list on particular proposals (perhaps sharing information in the R-Wiki) would be the ideal way to work on this. I am sorry I cannot invest more time on this at the present moment. Regards, Manuel López-Ibáñez. PS: by the way, I do use Perl, Emacs and LaTeX (almost everyday) and I think they are great, yet they could be improved in terms of usability. [*] A clear candidate is the cd command. cd means change directory in Windows, Unix and dozens of applications. It can be argued that ls doesn't mean list files. For me, the fact that ls has another meaning is just unfortunate and I understand that it may be problematic to change it. However, cd doesn't mean anything in R yet. Actually, there is a dir command. Could you guess what dir() does? If still you are not convinced, let it be, I cannot discuss this further (perhaps after summer). Joerg van den Hoff wrote: Duncan Murdoch wrote: On 5/16/2006 5:46 AM, Joerg van den Hoff wrote: Manuel López-Ibáñez wrote: Jan T. Kim wrote: That's an idea I like very much too -- much better than the currently popular idea of protecting users from the unfriendliness of programming, anyway... It is just my opinion that the amount of mail in R-help speaks volumes about the current friendliness [1], or lack thereof, of R. Perhaps I am just the only one who thinks this way... [1] http://en.wikipedia.org/wiki/Usability I think you are 100% right: the r-help list says it all. needless to say, R is a great achievment without any doubt, but claiming that it's easy to use (beyond the most basic arithmetics) is really wishful thinking. This is sloppy thinking. The volume of mail here shows that there are a lot of questions, perhaps because there are a lot of users. well, as far as my english goes, 'sloppy' is a strong word (and apart from mathematicians physicists (my background) probably are the people who are most allergic to being accused of it :-)) and it's an overhasty conclusion on your side, I'd say. I want to make clear beforehand, that I do _not_ think this a very important discussion, but rather an informal exchange of opinions, so maybe this takes us all a bit to far, but anyway: for one, I myself (and I think manuel, too) was not talking of the shear volume of mails (this obviously would have to be 'calibrated' against the total number of R users and the resulting quantity had to be compared to other help-lists). at least my impression is, that there are a number of reoccuring difficulties in the mail, which are rather specific to R's design (whether this situation could or should be altered: that would be a different topic). certainly, among these are the subsetting/indexing issues, certainly lazy evaluation, certainly anything related to environments, namespaces, computing on the language (substitute, eval, ...). You're also
Re: [R] for loops and counter interpolation
Hello, I think you are trying to combine too many things into one. for(i in 1:100){ points(cor(v$logA[v$idi], v$logB[v$idi], use=complete.obs), i)) } (i created a plot object already) For points() you need to have x and y, but you are giving the output of cor() This will plot your data and print the correlations on the plot (lathough maybe not in the best place): for(i in 1:100){ points(v$logA[v$idi], v$logB[v$idi], pch=i) text(0, i, cor(v$logA[v$idi], v$logB[v$idi], use=complete.obs)) } Hopefully that gives you an idea of how to get the output you actually want. Sarah -- Sarah Goslee [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Example Syntax for if - then- and - else Statements
Hello R users, I am a fairly new R user, however, one of the problems I am having is the use of applying if-, and-, then-, else- statements in R against datasets dataframe. Rtips mentions it, but without simple examples I am not quite sure what my syntax should look like. I am particularly interested in syntax that can be used with the transform function. for example if foo[,1] == 'n', foo[,2] == 4, else foo[,2] == 6 Could someone please share simple example codes with different variants on the theme. thanks. -- Lanre Okusanya, Pharm.D.,BCPS UB/Pfizer Pharmacometrics Fellow University at Buffalo School of Pharmacy and Pharmaceutical Sciences 237 Cooke Hall Buffalo, NY 14260 Email: [EMAIL PROTECTED] Tel: (716)645-2828 x 275 Fax: (716)645-2886 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Justifying R to anti open-source management
Yves Magliulo ym at climpact.com writes: * http://www.itp.phys.ethz.ch/econophysics/R/index.html R-financial Not that I want to discourage you, but be warned, on the download page it says; Download ... IMPORTANT WARNING: NOTE, THAT THE RMETRICS PACKAGES ARE NOT COMPLETE, IN MANY CASES UNTESTED, AND UNFORTUNATELY CONTAIN STILL SOME BUGS. THUS, USE RMETRICS AT YOUR OWN RISK! FOR COMMERCIAL AND BUSINESS APPLICATIONS WE RECOMMEND TO USE SPLUS FROM WWW.INSIGHTFUL.COM. Ahem... Dieter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sparklines
Robin Hankin r.hankin at noc.soton.ac.uk writes: Hi everyone well, quite a few people were interested in my little sparklines example, and one suggestion was to post it on a webpage. What would be a good place to post it? on the wiki? http://wiki.r-project.org Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Column notation
Dear Anjali, This should work: mymat - matrix(rnorm(4*136), ncol=136) i - 2 while(i =121){ print(cor(t(mymat[1:2, i:(i+14)]))) i - i+15 } Best, Dave. -- Dave Armstrong University of Maryland Dept of Government and Politics 3140 Tydings Hall College Park, MD 20742 Office: 2103L Cole Field House Phone: 301-405-9735 e-mail: [EMAIL PROTECTED] web: www.davearmstrong-ps.com On 5/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I would like to run a correlation on values in a table that has 4 rows and 136 columns. However, I am only interested in correlating the values in alternating blocks of 15 columns. For example, I would like to correlate the values in row 1, columns 2-16:31-46:61-76:91-106 with values in row 2, columns 2-16:31-46:61-76:91-106. Is there a way to notate this in the cor command so that the function will specify nonsequential values from the table? Thanks for any help. Sincerely, Anjali __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Justifying R to anti open-source management
Hello Peter, I am working on a related problem--getting R acceptable within division and project QA. Unfortunately, it seems to keep getting put on the back-burner as I address time sensitive needs. I did some googling and made a few phone calls. I'm expect that there is much more to be found but below is an US agency oriented compilation of what I got in my brief search. It seems I ran into a number of USDOE (National Labs HPC stuff) reports but I seem to have lost track of that info. QA in non-academic circles can be an anti-quality driver someyimes can't it. Oh, let's give this thread some irrelevant legs...EXCEL You all know what I am talking about ;O) Regards, Michael Grant My little but serious list (HTH): 1.) US Environmental Protection Agency -- Dr.R. Woodrow Setzer of the USEPA and a contributor to this list pointed out this comment in an EPA FIFRA Scientific Advisory Review Panel report : The Panel also commends the EPA on the use of R (see the main EPA report for references), as it is the best way to ensure portable, open code that is freely available to all interested users, with state-of-the art algorithms for statistical calculation. -- FIFRA Scientific Advisory Panel , http://www.epa.gov/scipoly/sap/2001/september/finalreport.htm A Set of Scientific Issues Being Considered by the Environmental Protection Agency Regarding: Preliminary Cumulative Hazard and Dose-Response Assessment for Organophosphorus Pesticides: Determination of Relative Potency and Points of Departure for Cholinesterase R was also used in the N-methyl Carbamates cumulative risk assessmentlink at http://www.epa.gov/oscpmont/sap/2005/index.htm#august 2.) US National Institute of Standards and Techno logy (NIST), Statistical Engineering Division http://www.itl.nist.gov/div898/pubs/ar/SED2004.pdf Collaborative research between members of the Statistical Engineering Division (SED) and members of the Process Measurements Division (Chemical Sciences and Technology Laboratory) has required that SED staff investigate various statistical tools for data mining. These tools include some very powerful statistical classification/prediction methods for high-dimensional data. This article briefly summarize this ongoing effort with the goal of bringing attention to a wide array of methods in a statistical toolkit that is already easily available to NIST scientists who may need them. Most of these functions have a user-friendly interface in the open source environment R and widely available commercial product S-plus. 3.) USDOE Department of Energy, Oak Ridge National Laboratory, http://www.csm.ornl.gov/esh/aoed/ORNLTM2005ab52.htm STATISTICAL METHODS AND SOFTWARE FOR THE ANALYSIS OF OCCUPATIONAL EXPOSURE DATA WITH NON-DETECTABLE VALUES Edward L. Frome Computer Science and Mathematics Division Oak Ridge National Laboratory Paul F. Wambach U. S. Department of Energy Date Published: September 2005 All of these methods are well known but computational complexity has limited their use in routine data analysis with left censored data. The recent development of the R environment for statistical data analysis and graphics has greatly enhanced the availability of high-quality nonproprietary (open source) software that serves as the basis for implementing the methods in this paper. Numerical examples are provided and R(2004) functions are available at the analysis of occupational exposure data web site http://www.csm.ornl.gov/esh/aoed/ (AOED). 4.) Historical Evaluation of the Film Badge Dosimetry Program at the Y-12 Facility in Oak Ridge, Tennessee, Part 1 Gamma Radiation J.P. Watkins1, G.D. Kerr2, E.L. Frome3, W.G. Tankersley1, and C.M. West+ ORAU Technical Report # 2004-0888 1Center for Epidemiologic Research, Oak Ridge Associated Universities 2Kerr Consulting Company 3Computer Science and Mathematics Division, Oak Ridge National Laboratory +Deceased This work was done under Contract No. 200-2002-00593 with the National Institute for Occupational Safety and Health. 5.) US FEMA http://www.fema.gov/txt/fhm/frm_cfd43.txt Flood 4.3 Flood frequency analysis methods At the end of this section: Several open-source and commercial software packages provide tools to assist in the sorts of analyses discussed in this section. In particular, the S, S-PLUS, and R programming languages (commercial and open-source versions of a high-level statistical programming language) include comprehensive statistical tools. The R language package is available for free from the web site http://www.r-project.org/; several books discussing the use of R and S are available. Other well-known software packages include Mathematica, Matlab, SPSS, and SYSTAT. 6.) National Cancer Institute Advanced Biomedical Computing Center list R as available to staff at http://www1.ncifcrf.gov/app/htdocs/appdb/appinfo.php?appname=R-Project 7.) Weston, USACE and USEPA: MODEL VALIDATION: MODELING STUDY OF PCB CONTAMINATION IN THE HOUSATONIC RIVER ---
Re: [R] Example Syntax for if - then- and - else Statements
-Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Lanre Okusanya Sent: Wednesday, May 17, 2006 10:17 AM To: 'r-help@stat.math.ethz.ch' Subject: [R] Example Syntax for if - then- and - else Statements Hello R users, I am a fairly new R user, however, one of the problems I am having is the use of applying if-, and-, then-, else- statements in R against datasets dataframe. Rtips mentions it, but without simple examples I am not quite sure what my syntax should look like. I am particularly interested in syntax that can be used with the transform function. for example if foo[,1] == 'n', foo[,2] == 4, else foo[,2] == 6 Could someone please share simple example codes with different variants on the theme. thanks. -- Lanre Okusanya, Pharm.D.,BCPS UB/Pfizer Pharmacometrics Fellow University at Buffalo School of Pharmacy and Pharmaceutical Sciences 237 Cooke Hall Buffalo, NY 14260 Email: [EMAIL PROTECTED] Tel: (716)645-2828 x 275 Fax: (716)645-2886 Look at the help files ?'if' and ?ifelse For your particular example, try something like this: foo[,2] - ifelse(foo[,1] == 'n', 4, 6) Hope this is helpful, Dan Daniel J. Nordlund Research and Data Analysis Washington State Department of Social and Health Services Olympia, WA 98504-5204 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Response to query re: calculating intraclass correlations
Thanks Paul, I hope to get the Futrell article - but what do you mean by ... described in PB. - PB??? Regards, Karl - Ursprüngliche Mail Von: Paul Mathews [EMAIL PROTECTED] An: r-help@stat.math.ethz.ch; [EMAIL PROTECTED] Gesendet: Mittwoch, den 17. Mai 2006, 17:49:30 Uhr Betreff: Response to query re: calculating intraclass correlations Karl, If you use one of the specialized packages to calculate your ICC, make sure that you know what you're getting. (I haven't checked the packages out myself, so I don't know either.) You might want to read David Futrell's article in the May 1995 issue of Quality Progress where he describes six different ways to calculate ICCs from the same data set, all with different interpretations. All of the inputs for these calculations come from the repeated measures analysis which is described in PB. Good luck! P. Message: 1 Date: Tue, 16 May 2006 10:09:54 + (GMT) From: Karl Knoblick [EMAIL PROTECTED] Subject: [R] Interrater and intrarater variability (intraclass correlationcoefficients) To: r-help@stat.math.ethz.ch Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Hello! I want to calculate the intra- and interrater reliability of my study. The design is very simple, 5 raters rated a diagnostic score 3 times for 19 patients. Are there methods/funtions in R? I only found packages to calculate interrater variability and intraclass correlation coefficients for matrices of n*m (n subjects, m raters) - I have n subjects, m raters and r repetitions. Can anybody help? Thanks! Karl -- Paul Mathews Mathews Malnar and Bailey, Inc. 217 Third Street, Fairport Harbor, OH 44077 Phone: 440-350-0911 Fax: 440-350-7210 E-mail: Paul: [EMAIL PROTECTED], [EMAIL PROTECTED] Rebecca: [EMAIL PROTECTED], [EMAIL PROTECTED] Web: www.mmbstatistical.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re : Large database help
You might want to follow up by looking at the Data Squashing that Bill DuMouchel has done http://citeseer.ist.psu.edu/dumouchel99squashing.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] RMySQL loading error
i was able to install DBI and RMySQL cleanly. I get the error below on library('RMySQL'). The file it is complaining about is located in /usr/lib/mysql/, where is R trying to load it from? Tried a symlink into /usr/local/lib/mysql to no avail. thx. -P Loading required package: DBI Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/IT/R-2.1.0/library/RMySQL/libs/RMySQL.so': libmysqlclient.so.10: cannot open shared object file: No such file or directory Error in library(RMySQL) : .First.lib failed for 'RMySQL' q() # find / -name libmysqlclient.so.10 /usr/lib/mysql/libmysqlclient.so.10 -- Patrice Seyed Linux System Administrator - LinGA RHCE, SCSA Boston University Medical Campus __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RMySQL loading error
On Wed, 17 May 2006, Patrice Seyed wrote: i was able to install DBI and RMySQL cleanly. I get the error below on library('RMySQL'). The file it is complaining about is located in /usr/lib/mysql/, where is R trying to load it from? Tried a symlink into /usr/local/lib/mysql to no avail. thx. -P You need /usr/lib/mysql in the your ld.so load path: normally this is done via ldconfig: for example my FC3 system has in /etc/ld.so.conf: include ld.so.conf.d/*.conf /usr/lib/mysql /usr/lib64/mysql /usr/i486-linux-libc5/lib In short, mysql has not been installed completely. Loading required package: DBI Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/IT/R-2.1.0/library/RMySQL/libs/RMySQL.so': libmysqlclient.so.10: cannot open shared object file: No such file or directory Error in library(RMySQL) : .First.lib failed for 'RMySQL' q() # find / -name libmysqlclient.so.10 /usr/lib/mysql/libmysqlclient.so.10 -- 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] checking package dependencies
I am having a similar problem with Windows. I first tried R-2.3.0, then following this post, tried R-2.2.1. In both versions, I can't get anything useful with the cygwin shell inside emacs. I get valid error messages from cygwin in a standalone cygwin window and from the msdos shell, either standalone or inside emacs. Here is the messages from the cygwin shell. The ls -alF for all the files mentioned look good. I don't know where the access is denied message is coming from. Perhaps someone can help interpret them. [EMAIL PROTECTED] ~/HH-R.package $ PATH=.:/cygdrive/c/progra~1/R/tools/bin:/cygdrive/c/MinGW/bin:/cygdrive/c/Perl /bin:/cygdrive/c/texmf/miktex/bin:/cygdrive/c/progra~1/R/R-2.3.0/bin:/usr/local/ bin:/usr/bin:/cygdrive/c/gs/gs8.00/bin:/cygdrive/c/gs/gs8.00/lib:/cygdrive/c/win dows:/cygdrive/c/windows/system32 [EMAIL PROTECTED] ~/HH-R.package $ [EMAIL PROTECTED] ~/HH-R.package $ R_HOME=c:/progra~1/R/R-2.3.0 [EMAIL PROTECTED] ~/HH-R.package $ [EMAIL PROTECTED] ~/HH-R.package $ export PATH R_HOME [EMAIL PROTECTED] ~/HH-R.package $ Rcmd check HH * checking for working latex ...Access is denied. NO * using log directory 'c:/HOME/rmh/HH-R.package/HH.Rcheck' Access is denied. * using * checking for file 'HH/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'HH' version '1.0' * checking package dependencies ...Access is denied. OK * checking if this is a source package ... OK * checking whether package 'HH' can be installed ...Access is denied. Error: cannot open file 'c:/HOME/rmh/HH-R.package/HH.Rcheck/00install.out' for re ading [EMAIL PROTECTED] ~/HH-R.package $ Rcmd build HH * checking for file 'HH/DESCRIPTION' ... OK * preparing 'HH': * checking DESCRIPTION meta-information ...Access is denied. OK * cleaning src * removing junk files Access is denied. Access is denied. Access is denied. Error: cannot open file 'HH/DESCRIPTION' for reading [EMAIL PROTECTED] ~/HH-R.package $ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Outputing dataframe or vector from within a user defined function
No, simply access the components you want to get and put then into a data.frame. Let's make a nonsense lm() example that is reproducible for me: result - lapply(1:10, function(i){ x - rnorm(10) y - rnorm(10) lm(y~x) }) result Now you want to get the coefficients by applying the indexing function [[ with argument coefficients (names of the corresposning element of the returned list) to the object result: sapply(result, [[, coefficients) (in this particular case one would take the extractor function coefficients() instead, but this one was for demonstration purposes). I have not personally tried it, but there is a wonderful explanation of this kind of functionality at http://wiki.r-project.org/rwiki/doku.php?id=tips:stats-models:extr_regr_sum It appears to have been added to the Wiki the day we were having this discussion. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Off topic --- help in locating a source.
Apologies for the off-topic question; as usual I'm trying to draw upon the unparalleled knowledge and sagacity of the r-help list. Please reply off-list if you can help me out. A collaborator of mine found a formula we need, on sheets which he had photocopied out of a book, some years ago. He cannot remember which book (he's getting to be as senile and forgetful as I am, poor bloke!). He thinks it was (and it appears to have been) a large encylopedic tome devoted to extensive tables of formulae, integrals and series, and stuff like that. The formula in question is oo 1 1 1 SUM --- cos(k*x) = --- ln () 0 x 2*pi . k=1 k 2 2*(1 - cos(x)) (I.e. the right hand side is a function whose Fourier coefficients are 1/k, k 0). Note that ``oo'' is my attempt to render the infinity symbol in ASCII. Does anyone know of a source where this formula may found/cited? (It doesn't *have* to be the same source from which my collaborator originally copied it!) It must be well-known/in lots of books, mustn't it? Said he, hopefully. Thanks for any assistance. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] trellis backround color
orkun temiz at deprem.gov.tr writes: I am working in trellis package. what can I do to make bacground white ? trellis.par.set(col.whitebg()) works for me. http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-lattice Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] passing known medoids to clara() in the cluster package
Martin, Just wanted to check on the status of including known medoids into calls to the clara() function within the cluster package. Cheers, Dylan On Monday 10 April 2006 14:25, Dylan Beaudette wrote: Thanks for the reply. On Sunday 09 April 2006 11:46 pm, Martin Maechler wrote: DylanB == Dylan Beaudette [EMAIL PROTECTED] on Sun, 9 Apr 2006 19:28:44 -0700 writes: DylanB Greetings, I have had good success using the clara() DylanB function to perform a simple cluster analysis on a DylanB large dataset (1 million+ records with 9 variables). DylanB Since the clara function is a wrapper to pam(), DylanB which will accept known medoid data - I am wondering DylanB if this too is possible with clara() ... The DylanB documentation does not suggest that this is DylanB possible. indeed, it doesn't -- because it's not yet possible. I (as maintainer of cluster) had added the ``known medoid'' option to pam() a while ago last June (for cluster version 1.10.0), and had left a note my TODO file to do the same for clara(). Ah. that would explain things ! :) . I will check back periodically to see when this feature is completed. Unfortunately it's not true that clara() was a wrapper to pam() as you state above. I must have misread the manual pages... Given your wish and clear use case situation, I'm more motivated to approach this particular 'TODO' item! Martin Maechler, ETH Zurich DylanB Essentially I am trying to implement a supervised DylanB classification of numerous geographic data DylanB layers. The unsupervised approach using clara() DylanB works well, but I feel the output classes would be DylanB more meaningful if I were able to let clara() know DylanB about the classes that I have in mind. DylanB Is this at all feasible, or am I trying to DylanB accomplish something that is not possible? Thanks Martin! I will give pam() a try, and see if it can handle the large dataset that I am currently using clara() for -- usually only about 5 seconds are required for clara() to complete. -- Dylan Beaudette Soils and Biogeochemistry Graduate Group University of California at Davis 530.754.7341 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] 2 Courses in Seattle - (1) R/Splus Advanced Programming (2) R/Splus Fundamentals - June 2006
__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] RMySQL loading error
but of course; danke. -P Prof Brian Ripley wrote: On Wed, 17 May 2006, Patrice Seyed wrote: i was able to install DBI and RMySQL cleanly. I get the error below on library('RMySQL'). The file it is complaining about is located in /usr/lib/mysql/, where is R trying to load it from? Tried a symlink into /usr/local/lib/mysql to no avail. thx. -P You need /usr/lib/mysql in the your ld.so load path: normally this is done via ldconfig: for example my FC3 system has in /etc/ld.so.conf: include ld.so.conf.d/*.conf /usr/lib/mysql /usr/lib64/mysql /usr/i486-linux-libc5/lib In short, mysql has not been installed completely. Loading required package: DBI Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/IT/R-2.1.0/library/RMySQL/libs/RMySQL.so': libmysqlclient.so.10: cannot open shared object file: No such file or directory Error in library(RMySQL) : .First.lib failed for 'RMySQL' q() # find / -name libmysqlclient.so.10 /usr/lib/mysql/libmysqlclient.so.10 -- Patrice Seyed Linux System Administrator - LinGA RHCE, SCSA Boston University Medical Campus __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] nlme model specification
Hi folks, I am tearing my hair out on this one. I am using an example from Pinheiro and Bates. ### this works data(Orange) mod.lis - nlsList(circumference ~ SSlogis(age, Asymp, xmid, scal), data=Orange ) ### This works mod - nlme(circumference ~ SSlogis(age, Asymp, xmid, scal), data=Orange, fixed = Asymp + xmid + scal ~ 1, start = fixef(mod.lis) ) ### I try a slightly different model specification for the fixed effects, and it does not work. ### fixed = list(Asymp ~ 1, xmid ~ 1, scal ~ 1) ### I tried following the example on page 355. mod - nlme(circumference ~ SSlogis(age, Asymp, xmid, scal), data=Orange, fixed = list(Asymp ~ 1, xmid ~ 1, scal ~ 1), start = fixef(mod.lis) ) ### I get Error in parse(file, n, text, prompt) : syntax error in ~ nlme version 3.1-71 version _ platform powerpc-apple-darwin8.6.0 arch powerpc os darwin8.6.0 system powerpc, darwin8.6.0 status major 2 minor 3.0 year 2006 month 04 day24 svn rev37909 language R version.string Version 2.3.0 (2006-04-24) Dr. M. Hank H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] adding grid lines to an xyplot when there is only 1 panel
I've been struggling with this for a while and cannot get it to work. Is there a simple way to add grid lines I'd like to only add the horizontal ones --- when using the groups argument in xyplot? I can get the grid lines to plot, or the points/lines, but not both. Here is a simple example of the sort of thing that I'm working with. Thanks, in advance. all est STE AREA -0.229V1 V1 -1.129V1 V2 -2.084V1 V4 -2.918V1 V3 -0.548V2 V1 -0.217V2 V2 -1.937V2 V3 -1.205V2 V4 -4.126V4 V1 -1.481V4 V2 -2.070V4 V3 -0.042V4 V4 xyplot(est ~ ISITE, data = all2, groups = AREA, type = b, auto.key = list(space = right)) Ken Knoblauch -- Ken Knoblauch Inserm U371 Cerveau et Vision Dept. of Cognitive Neuroscience 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 http://www.lyon.inserm.fr/371/ [[alternative text/enriched version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Off topic --- help in locating a source.
I would check one of the following: 1. Abramowitz and Stegun's HMF 2. Jolley's Summation of Series 3. Knopp's book on Infinite Series. Ravi. -- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] -- -Original Message- From: [EMAIL PROTECTED] [mailto:r-help- [EMAIL PROTECTED] On Behalf Of Rolf Turner Sent: Wednesday, May 17, 2006 3:27 PM To: r-help@stat.math.ethz.ch Subject: [R] Off topic --- help in locating a source. Apologies for the off-topic question; as usual I'm trying to draw upon the unparalleled knowledge and sagacity of the r-help list. Please reply off-list if you can help me out. A collaborator of mine found a formula we need, on sheets which he had photocopied out of a book, some years ago. He cannot remember which book (he's getting to be as senile and forgetful as I am, poor bloke!). He thinks it was (and it appears to have been) a large encylopedic tome devoted to extensive tables of formulae, integrals and series, and stuff like that. The formula in question is oo 1 1 1 SUM --- cos(k*x) = --- ln () 0 x 2*pi . k=1 k 2 2*(1 - cos(x)) (I.e. the right hand side is a function whose Fourier coefficients are 1/k, k 0). Note that ``oo'' is my attempt to render the infinity symbol in ASCII. Does anyone know of a source where this formula may found/cited? (It doesn't *have* to be the same source from which my collaborator originally copied it!) It must be well-known/in lots of books, mustn't it? Said he, hopefully. Thanks for any assistance. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Off topic --- help in locating a source.
If a web site is suffiicent then: http://functions.wolfram.com/ElementaryFunctions/Cos/23/02/ On 5/17/06, Rolf Turner [EMAIL PROTECTED] wrote: Apologies for the off-topic question; as usual I'm trying to draw upon the unparalleled knowledge and sagacity of the r-help list. Please reply off-list if you can help me out. A collaborator of mine found a formula we need, on sheets which he had photocopied out of a book, some years ago. He cannot remember which book (he's getting to be as senile and forgetful as I am, poor bloke!). He thinks it was (and it appears to have been) a large encylopedic tome devoted to extensive tables of formulae, integrals and series, and stuff like that. The formula in question is oo 1 1 1 SUM --- cos(k*x) = --- ln () 0 x 2*pi . k=1 k 2 2*(1 - cos(x)) (I.e. the right hand side is a function whose Fourier coefficients are 1/k, k 0). Note that ``oo'' is my attempt to render the infinity symbol in ASCII. Does anyone know of a source where this formula may found/cited? (It doesn't *have* to be the same source from which my collaborator originally copied it!) It must be well-known/in lots of books, mustn't it? Said he, hopefully. Thanks for any assistance. cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] boxplot
I am running this code to produce some boxplots. I have every thing that I need except that I would like the whisker line to be solid line, not dashes. I have reviewed the lattice docs but have not seemed to come across this point. print( bwplot( group ~ lpcb_tot, data= data7, xlab=Log PCB, + ylab= + G B + S M S M ) ) -- Dean Sonneborn, MS Programmer Analyst Department of Public Health Sciences University of California, Davis (530) 754-9516 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re : Large database help
Thank you all for the discussion. I'll try to summarize the suggestions and give some partial conclusions for sake of completeness of this thread. First, I had read the I/O manual but had forgotten the function read.fwf as suggested by Roger Peng. I'm sorry. But, following manual orientation, this function is not recommended for large files and I need to discover how to read fixed-width-format files using scan function, since there isn't such an example in that manual neither in ?scan. At a glance, it seems the function read.fwf writes blank spaces among column pointers in order to read the file using a simple scan() function. I've also read the I/O manual, mainly chapter 4 about using Relational Databases. This suggestion was appointed by Uwe Ligges and Justin Bem who advocated the use of MySQL with RMySQL package. I'm still installing MySQL to try to convert my fixed-width-format file to that database but, from the I/O manual, it seems I can only calculate five descriptive statistics (aggregate functions). So I couldn't calculate medians or more advanced statistics like a cluster analysis. This point was one from Robert Citek and thus, I'm not sure that working with MySQL will help to solve my problem. RMySQL has dbApply function that apply R functions to groups (chunks) of database rows. There was a suggestion to subset the file, by Roger Peng. Almost all participants in this thread noted the need of lots of RAM to work with a few variables as suggested by Prof. Brian Ripley. The future looks promising through a collection *big* of packages specially designed to handle big data files in almost any hardwarea and OS configuration although time-demanding in some cases. It seems the first one in this collection is the biglm package by Thomas Lumley cited by Greg Snow. The obvious drawback is that one hat to re-write every package that can't handle big data files or, al least, their most memory demanding operations. This last point could be implemented by an option like big.file=TRUE to be incorporated at some functions. This point of view is one of *scaling up* the methods. Another promising way is to *scale down* the dataset. Statisticians are aware of these techniques from non-hierarquical cluster analysis and principal component analysis among others (mainly sampling). Engineers and signal processing people know them from data compression techniques. Computer scientists work with training sets and dataming wich use methods to scale down datasets. An example was given by Richard M. Heiberger who cites a paper from William DuMouchel et al. on Squashing Flat Files. Maybe could be some R functions specialized in these methods that, using DBMS, could retrieve significant data (records and variables) that could be handled by R. That's all, for a while! Rogerio. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] uniform and clumped point plots
I am trying to generate two dimensional random coordinates. For randomly distributed data I have simply used xy-cbind(runif(100),runif(100)) However I also want to generate coordinates that are more uniformly distributed, and coordinates that are more contagiously distributed than the above. Can anyone make any suggestions Thanks. Dr Terry Beutel Rangeland Scientist Animal Sciences Department of Primary Industries and Fisheries Telephone 07 4654 4282 Facsimile 07 4654 4235 Email [EMAIL PROTECTED] Address DPI Hood Street Charleville Q 4470 PO Box 282, Charleville Q 4470 Website www.dpi.qld.gov.au Call Centre 13 25 23 DISCLAIMER**...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] what's wrong with my gls? it does not allocate memory... even for the simplest AR1 model...
What are col1, ..., col6? Try the following: sapply(data2, class) Are any of these factors? If yes, how many levels? Do you still get the same error from the following: gls(col1 ~ 1, data=data2, corr=corAR1(0.3202), method='ML') If this works, I might then try a binary search to help isolate the problem, starting perhaps with something like the following: gls(col1 ~ col2+col3+col4-1, data=data2, corr=corAR1(0.3202), method='ML') gls(col1 ~ col5+col6-1, data=data2, corr=corAR1(0.3202), method='ML') Also, how many observations in data2? If data2 has many rows, how far can you small can you make data2 and still get the same error? Have you consulted Pinheiro and Bates (2000) Mixed-Effects Models in S and S-Plus (Springer)? If no, I suggest you get that book and study it carefully before doing much more in this area. Bates is one of the leading experts in this field, and the 'nlme' and 'lme4' packages are primarily his work, with the help of a number of graduate students, including Jose Pinheiro. The book is reasonably well written, and contains much wisdom that is difficult to find elsewhere. If you'd like more help from this listserve, PLEASE do read the posting guide! www.R-project.org/posting-guide.html, especially the part about providing a simple, self-contained example that illustrates your problem. Can you produce a much simpler example that produces the same error with, say, a data.frame of only 2 or 3 columns of random numbers that can be generated with only a very few lines of R code that would allow someone else to actually reproduce the error you see? If you can do that, you will much more likely get a useful reply quicker. And please include sessionInfo(). If you are NOT already on R2.3.0 with nlme 3.1-72, please get current before you complain. hope this helps. Spencer Graves Michael wrote: myfit1 - gls(col1 ~ col2+col3+col4+col5+col6-1, data=data2, corr=corAR1( 0.3202), method='ML') Error: cannot allocate vector of size 199712 Kb if I get rid of the corr=corAR1(0.3202) option, it works okay... can anybody help me? thanks a lot! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Stuck in R installation, help~~
Hi all, I'm stuck in the installation of R. When I run configure, I got the error: configure: error: --with-readline=yes (default) and headers/libs are not available I followed one answer in some post and use this: ./configure --with-prefix=/home/user/R-2.2.1 --with-readline=no It successfully configured but I encountered another problem while make: gcc -shared -L/usr/local/lib64 -o libRlapack.so dlamc.lo dlapack0.lo dlapack1.lo dlapack2.lo dlapack3.lo cmplx.lo -lf77blas -latlas -lg2c -lm -lgcc_s /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../lib64/libf77blas.a(xerbla.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../lib64/libf77blas.a: could not read symbols: Bad value collect2: ld returned 1 exit status make[4]: *** [libRlapack.so] Error 1 make[4]: Leaving directory `/home/user/R-2.2.1/src/modules/lapack' make[3]: *** [R] Error 2 make[3]: Leaving directory `/home/user/R-2.2.1/src/modules/lapack' make[2]: *** [R] Error 1 make[2]: Leaving directory `/home/user/R-2.2.1/src/modules' make[1]: *** [R] Error 1 make[1]: Leaving directory `/home/user/R-2.2.1/src' make: *** [R] Error 1 I just have no clue. I've been trying to fix this for a really long time. Any help or suggestion is highly appreciated! Thanks Selina __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Frequencies into Poisson responses
Suppose that one has several factors, all of the same length. These define a multi-way contingency table. Now suppose one wants to fit a Poisson GLM a.k.a. log-linear model to the frequencies in this table. How may we make the table into a data frame suitable for glm() ? I have an answer to my own question below, but surely more elegant solutions exist? set.seed(060518) na - nb - 3 nc - 4 n - na*nb*nc a - round(runif(1000,0.5,na+0.5)) b - round(runif(1000,0.5,nb+0.5)) cc - round(runif(1000,0.5,nc+0.5)) A - factor(a) B - factor(b) CC - factor(cc) ftabc - ftable(A,B,CC) freqs - as.vector(ftabc) A1 - gl(na,nb,n) B1 - gl(nb,1,n) C1 - gl(nc,na*nb,n) required - data.frame(A1,B1,C1,freqs) required Cheers, Murray Jorgensen -- Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand Email: [EMAIL PROTECTED]Fax 7 838 4155 Phone +64 7 838 4773 wkHome +64 7 825 0441Mobile 021 1395 862 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] create a vector
Dear R users: I have an elementary question: how to creat a vector of [A1, A2, A3.. A300]? I know c(1:300) would give 1, 2, 3, , 300 but not sure how to attch a A to each element. Thank you Yihsu Chen The Johns Hopkins University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] create a vector
paste(A, 1:300, sep=) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of YIHSU CHEN Sent: Thursday, May 18, 2006 12:56 AM To: R-help@stat.math.ethz.ch Subject: [R] create a vector Dear R users: I have an elementary question: how to creat a vector of [A1, A2, A3.. A300]? I know c(1:300) would give 1, 2, 3, , 300 but not sure how to attch a A to each element. Thank you Yihsu Chen The Johns Hopkins University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html