Re: [R] R2.1.0: X11 font at size 14 could not be loaded
On Fri, 29 Apr 2005, Patrick Connolly wrote: On Thu, 28-Apr-2005 at 05:25PM -0400, Xiang-Jun Lu wrote: | Hi, | | I have just noticed the following problem with R2.1.0 running on SuSE 9.1, | [However, version 2.0.1 (2004-11-15) on the same machine works Okay]: | | - | hist(rnorm(100)) | Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) : | X11 font at size 14 could not be loaded | version | _ | platform i686-pc-linux-gnu | arch i686 | os linux-gnu | system i686, linux-gnu | status Patched | major2 | minor1.0 | year 2005 | month04 | day 20 | language R | - | | Any insight? Works fine with mine. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R Something to do with the patch, perhaps? There is no patch on the X11 device. The dpi of the screen does come into this. It is quite possible that 2.0.1 failed to scale for the screen dpi and so was using the wrong set of fonts (it used 75dpi unless the screen was 100+/-0.5 dpi). So I think PD was correct: this does indicate a problem in the installed fonts: perhaps the 100dpi set is missing. -- 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] accuracy of test cases
Hi I have several methods for evaluating a function. The methods are algebraically identical but use different numerical techniques. The different methods work better (converge faster, etc) in different parts of the function's domain. I am compiling a test suite for a package, and would like to verify that the different methods return approximately identical results. Toy example follows: R f1 - function(x){ (x-1)*(x+1)} R f2 - function(x){x^2-1} R x - pi+100i R abs(f1(x) - f2(x)) [1] 9.298027e-12 R stopifnot(abs(f1(x)-f2(x)) 1e-11) Observe that f1() should be identically equal to f2(); any differences are due to rounding errors (needless to say, the real examples are more complex, with larger errors). My question is, I am unhappy about the numerical value of the tolerance used in the last line. The tolerance should be as small as possible, but If I make it too small, the test may fail when executed on a machine with different architecture from mine. How do I deal with this? -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre 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] how to replace text...
if I have -priceIts(,quote=Close) -priceIts(,quote=Close);plot() and then i want to do the same thing but say with IBM instead of is there an easy way like replace /ibm Thanks in advance./Jonathan __ 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] accuracy of test cases
Robin Hankin wrote: Hi I have several methods for evaluating a function. The methods are algebraically identical but use different numerical techniques. The different methods work better (converge faster, etc) in different parts of the function's domain. I am compiling a test suite for a package, and would like to verify that the different methods return approximately identical results. Toy example follows: R f1 - function(x){ (x-1)*(x+1)} R f2 - function(x){x^2-1} R x - pi+100i R abs(f1(x) - f2(x)) [1] 9.298027e-12 R stopifnot(abs(f1(x)-f2(x)) 1e-11) Observe that f1() should be identically equal to f2(); any differences are due to rounding errors (needless to say, the real examples are more complex, with larger errors). My question is, I am unhappy about the numerical value of the tolerance used in the last line. The tolerance should be as small as possible, but If I make it too small, the test may fail when executed on a machine with different architecture from mine. How do I deal with this? See ?all.equal Uwe Ligges -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre 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-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] how to replace text...
On Apr 29, 2005, at 6:11 AM, Jonathan Q. wrote: if I have -priceIts(,quote=Close) -priceIts(,quote=Close);plot() and then i want to do the same thing but say with IBM instead of is there an easy way like replace /ibm You should probably use a list instead. This is a FAQ (see 7.21): http://cran.r-project.org/doc/FAQ/R-FAQ.html Here is about how you might do it (untested): pricelist - list() pricelist[['IBM']] - pricelts('IBM',quote=Close) pricelist[['']] - pricelts('',quote=Close) par(ask=T) lapply(pricelist,plot) Does this do what you want? Sean __ 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] accuracy of test cases
On Apr 29, 2005, at 11:51 am, Uwe Ligges wrote: Robin Hankin wrote: [snip] The tolerance should be as small as possible, but If I make it too small, the test may fail when executed on a machine with different architecture from mine. How do I deal with this? See ?all.equal Uwe Ligges Hi Uwe Thanks for this. But sometimes my tests fail (right at the edge of a very wibbly wobbly function's domain, for example) even with all.equal()'s default tolerance. Maybe I should only include tests where all.equal() passes comfortably on my machine, and have done with it. Yes, this is the way to think about it: I was carrying out tests where one might expect them to fail (entrapment?). My mistake was to focus on the magnitude of tol and to blithely include tests where all.equal() failed, or came close to failing. Unfortunately, all the interesting stuff happens at the boundary. I guess (thinking about it again) that in such circumstances, there is no generic answer. best wishes rksh -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre 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] accuracy of test cases
Robin Hankin wrote: On Apr 29, 2005, at 11:51 am, Uwe Ligges wrote: Robin Hankin wrote: [snip] The tolerance should be as small as possible, but If I make it too small, the test may fail when executed on a machine with different architecture from mine. How do I deal with this? See ?all.equal Uwe Ligges Hi Uwe Thanks for this. But sometimes my tests fail (right at the edge of a very wibbly wobbly function's domain, for example) even with all.equal()'s default tolerance. Maybe I should only include tests where all.equal() passes comfortably on my machine, and have done with it. Yes, this is the way to think about it: I was carrying out tests where one might expect them to fail (entrapment?). My mistake was to focus on the magnitude of tol and to blithely include tests where all.equal() failed, or came close to failing. Unfortunately, all the interesting stuff happens at the boundary. I guess (thinking about it again) that in such circumstances, there is no generic answer. [We might want to move to R-devel for further discussion...] Yes, of course the cases at the boundary are the interesting ones. Unfortunately, it is extremely hard (even if underlying algorithms are known - and if possible at all) to calculate the expected inaccuracy, if algorithms are becoming quite complex. It would also be possible to intentional include a test that gives differences - don't know what Kurt et al. think about it (if we are talking about a CRAN package), though. Best, Uwe best wishes rksh -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre 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] Iterative process for reading in text files
Hi Meredith, When I've wanted to do this, I put all my files (group1.txt, group2.txt ...) in a separate directory. Then, running R from that directory: files-list(files) for (i in 1:length(files)) { group-read.table(files[i],header=T) do stats here } On Fri, 2005-04-29 at 15:17 +1000, Briggs, Meredith M wrote: Hello Instead of reading in group1.txt I want to read in groups1 for the first iteration of i, then groups2 for the second and so on. Obviously I can't use groups(i) but assume there is a way to do this. group-read.table(C:/Data/April 2005/group1.txt,header=T) thanks in advance Meredith __ 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] grid and ps device (bg-color)
Hello! Is it a bug or something? When I try to draw a grid-graphics on ps output background color is always transparent (with standard plot(...) this is not the case - the background is filled with ps.options()$bg color). What's wrong? Drawing a background grid.rect does not help - there is always small transparent margains along picture frame. Can this be fixed (I use R-2.0.1)? __ 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 files and vignettes
Ingmar Visser wrote: Hi all, I'm writing a vignette for my package, and I would like to include some of the package help files in there as well. Is there an easy way of doing so? I tried using R CMD Rdconv to generate latex files from .Rd files but I am not sure how to include these into a .Rnw file (ie the vignette source). The resulting file from Rdconv do not readily compile using latex ... The other option I tried is to use R CMD Rd2dvi --no-clean etc which will give me a latex'able file Rd2.tex, portions of which I can then include into the vignette source file. However, this takes quite some time given that I have 6 or so .Rd files. Especially when updating them, adding functions and so forth, this process of generating the Rd2.tex files and then copying and pasting into the vignette source is quite tedious. In short, is there a faster way of doing this? best, ingmar You can wrap the resulting LaTeX files in \documentclass[a4paper]{article} \usepackage[ae]{Rd} \begin{document} % \include{TheLaTeXFile} \end{document} Relevant files (such as Rd.sty) are available in .../pathToR/share/texmf Hence you can \input or \include it in any other LaTeX files, such as vignettes. And you can write Makefiles in order to process automatically. Uwe Ligges __ 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 strata in boot
Hello, I am new to R, and am having trouble running a stratified bootstrap. My data set consists of 38 study sites in which I recorded the number of bird pairs. Each site has been classified as burned or mowed and for each of these two strata I would like to determine the precision of an overall density estimate. I can run an unstratified bootstrap without problem, but when I specify the strata I get the same unstratified result. cswafun - function(denboot, i) sum(cswa[i])/(sum(parea[i]) attach(denboot) cswa.boot - boot(denboot, cswafun, R = 1, strata = treat) ### cswa is a vector of integers representing the number of pairs/site parea is a numeric vector of the size of each study site treat is a character vector of 'b's and 'm's. I have also coded this as a numeric vector of '1's and '2s'. R returns the following: Call: boot(data = denboot, statistic = cswafun, R = 1, strata = treat) Bootstrap Statistics : original biasstd. error t1* 1.109612 0.02641786 0.2032927 Any help would be appreciated. Thanks Richard -- Richard Chandler, M.S. Candidate Department of Natural Resources Conservation UMass Amherst (413)545-1237 __ 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] derive an AIC value of an lrm model similar to the AIC of a glm model?
Dear all, How can an AIC value of an fitted 'lrm' model be derived, similar to the AIC that is derived from a fitted 'glm' model? e.g. ? extractAIC(lrm.fit) ? AIC(lrm.fit) e.g. lrm.fit - lrm(y~rcs(x,5)) We used glm(y~rcs(x,5)), to derive the AIC but it seems that for some theoretical reasons the rcs, restricted cubic spline fun. can not be fitted by a glm function. With pentrace(), depending on the penalty, AIC values are derived but which penalty setting should we use? Thanks in advance, Regards, Jan ___ ir. Jan Verbesselt Research Associate Lab of Geomatics Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel: +32-16-329750 Fax: +32-16-329760 http://gloveg.kuleuven.ac.be/ __ 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] Automating plot labelling in custom function in lapply() ?
Dear List, Consider the following example: dat - data.frame(var1 = rnorm(100), var2 = rnorm(100), var3 = rnorm(100), var4 = rnorm(100)) oldpar - par(mfrow = c(2,2), no.readonly = TRUE) invisible(lapply(dat, function(x) { plot(density(x), main = deparse(substitute(x))) } ) ) par(oldpar) I want to the main title in each of the density plots to be var1, var2, etc. The above code produces x[[1]], x[[2]] etc. What do I need to modify to be able to use the name of x as the plot label within in the above situation? Thanks in advance, Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] How to change variables in datasets automatically
Dear R-helpers, Suppose I have a dataset, data(iris) a - data.frame(Sepal.Length=c(1:4), Sepal.Width=c(2:5), Petal.Length=c(3:6), Petal.Width=c(4:7), Species=rep(rosa,4)) b - iris[1:10,] newtest.iris - rbind(a,b) newtest.iris Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 1.0 2.0 3.0 4.0rosa 2 2.0 3.0 4.0 5.0rosa 3 3.0 4.0 5.0 6.0rosa 4 4.0 5.0 6.0 7.0rosa 11 5.1 3.5 1.4 0.2 setosa 21 4.9 3.0 1.4 0.2 setosa 31 4.7 3.2 1.3 0.2 setosa 41 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa I want to change each labels (variables) like: Sepal.Length=SL, Sepal.Width=SW, Petal.Length=PL, Petal.Width=PW, and Species=Class. Then I want to change each cell in Species variable like rosa=0 and setosa=1. The result something like this, NewIris SL SW PL PW Class 1 1.0 2.0 3.0 4.0 0 2 2.0 3.0 4.0 5.0 0 3 3.0 4.0 5.0 6.0 0 4 4.0 5.0 6.0 7.0 0 5 5.1 3.5 1.4 0.2 1 6 4.9 3.0 1.4 0.2 1 7 4.7 3.2 1.3 0.2 1 8 4.6 3.1 1.5 0.2 1 9 5.0 3.6 1.4 0.2 1 10 5.4 3.9 1.7 0.4 1 11 4.6 3.4 1.4 0.3 1 12 5.0 3.4 1.5 0.2 1 13 4.4 2.9 1.4 0.2 1 14 4.9 3.1 1.5 0.1 1 I can do it the result above like this, Class - ifelse(newtest.iris$Species==rosa, 0, 1) NewIris - data.frame(SL = newtest.iris$Sepal.Length, +SW = newtest.iris$Sepal.Width, +PL = newtest.iris$Petal.Length, +PW = newtest.iris$Petal.Width, +Class) Because I have more variables in my datasets which I must to change. Is there any way to change automatically and which library contains a function to compute that? I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ 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] How to change variables in datasets automatically
Try: a - data.frame(Sepal.Length=1:4, Sepal.Width=2:5, Petal.Length=3:6, Petal.Width=4:7, Species=rep(rosa,4)) b - iris[1:10,] newtest.iris - rbind(a,b) names(newtest.iris) - c(SL, SW, PL, PW, Class) newtest.iris$Class - as.numeric(newtest.iris$Class) - 1 HTH, Andy From: Muhammad Subianto Dear R-helpers, Suppose I have a dataset, data(iris) a - data.frame(Sepal.Length=c(1:4), Sepal.Width=c(2:5), Petal.Length=c(3:6), Petal.Width=c(4:7), Species=rep(rosa,4)) b - iris[1:10,] newtest.iris - rbind(a,b) newtest.iris Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 1.0 2.0 3.0 4.0rosa 2 2.0 3.0 4.0 5.0rosa 3 3.0 4.0 5.0 6.0rosa 4 4.0 5.0 6.0 7.0rosa 11 5.1 3.5 1.4 0.2 setosa 21 4.9 3.0 1.4 0.2 setosa 31 4.7 3.2 1.3 0.2 setosa 41 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa I want to change each labels (variables) like: Sepal.Length=SL, Sepal.Width=SW, Petal.Length=PL, Petal.Width=PW, and Species=Class. Then I want to change each cell in Species variable like rosa=0 and setosa=1. The result something like this, NewIris SL SW PL PW Class 1 1.0 2.0 3.0 4.0 0 2 2.0 3.0 4.0 5.0 0 3 3.0 4.0 5.0 6.0 0 4 4.0 5.0 6.0 7.0 0 5 5.1 3.5 1.4 0.2 1 6 4.9 3.0 1.4 0.2 1 7 4.7 3.2 1.3 0.2 1 8 4.6 3.1 1.5 0.2 1 9 5.0 3.6 1.4 0.2 1 10 5.4 3.9 1.7 0.4 1 11 4.6 3.4 1.4 0.3 1 12 5.0 3.4 1.5 0.2 1 13 4.4 2.9 1.4 0.2 1 14 4.9 3.1 1.5 0.1 1 I can do it the result above like this, Class - ifelse(newtest.iris$Species==rosa, 0, 1) NewIris - data.frame(SL = newtest.iris$Sepal.Length, +SW = newtest.iris$Sepal.Width, +PL = newtest.iris$Petal.Length, +PW = newtest.iris$Petal.Width, +Class) Because I have more variables in my datasets which I must to change. Is there any way to change automatically and which library contains a function to compute that? I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ 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] shading in line plots
Mulholland, Tom wrote: Just a little bit of trivia. The 2001 Census in Australia had a significant group of people who responded to the question of religion with the answer Jedi or Jedi Knight. Unfortunately the Australian Bureau of Statistics is a bit fuddy duddy about the issue as they see it as a trivialisation of the question rather than as a serious sociological (not necessarily religious) response by certain sections of the community, otherwise we might have had a complete profile of said ubergeeks. One small point is that the question on religion is the only voluntary (or optional as the ABS puts it) question in the form. www.abs.gov.au/websitedbs/D3110124.NSF/ 0/86429d11c45d4e73ca256a46af80?OpenDocument (you need to keep the space before the zero otherwise you end up elsewhere on the ABS site. The document is called The 2001 Census, Religion and the Jedi) Tom It's possible that my reactions are colored by living in the US with Bush et al. running the show, but my first reaction when I see a document put out by a government that states 'we haven't threatened anyone' several times makes me wonder who they have been threatening... -- James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 __ 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] How to change variables in datasets automatically
Excellent, this is exactly what I was looking for. Many thanks and best regards, Muhammad Subianto On 4/29/05, Liaw, Andy [EMAIL PROTECTED] wrote: Try: a - data.frame(Sepal.Length=1:4, Sepal.Width=2:5, Petal.Length=3:6, Petal.Width=4:7, Species=rep(rosa,4)) b - iris[1:10,] newtest.iris - rbind(a,b) names(newtest.iris) - c(SL, SW, PL, PW, Class) newtest.iris$Class - as.numeric(newtest.iris$Class) - 1 HTH, Andy From: Muhammad Subianto Dear R-helpers, Suppose I have a dataset, data(iris) a - data.frame(Sepal.Length=c(1:4), Sepal.Width=c(2:5), Petal.Length=c(3:6), Petal.Width=c(4:7), Species=rep(rosa,4)) b - iris[1:10,] newtest.iris - rbind(a,b) newtest.iris Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 1.0 2.0 3.0 4.0rosa 2 2.0 3.0 4.0 5.0rosa 3 3.0 4.0 5.0 6.0rosa 4 4.0 5.0 6.0 7.0rosa 11 5.1 3.5 1.4 0.2 setosa 21 4.9 3.0 1.4 0.2 setosa 31 4.7 3.2 1.3 0.2 setosa 41 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa I want to change each labels (variables) like: Sepal.Length=SL, Sepal.Width=SW, Petal.Length=PL, Petal.Width=PW, and Species=Class. Then I want to change each cell in Species variable like rosa=0 and setosa=1. The result something like this, NewIris SL SW PL PW Class 1 1.0 2.0 3.0 4.0 0 2 2.0 3.0 4.0 5.0 0 3 3.0 4.0 5.0 6.0 0 4 4.0 5.0 6.0 7.0 0 5 5.1 3.5 1.4 0.2 1 6 4.9 3.0 1.4 0.2 1 7 4.7 3.2 1.3 0.2 1 8 4.6 3.1 1.5 0.2 1 9 5.0 3.6 1.4 0.2 1 10 5.4 3.9 1.7 0.4 1 11 4.6 3.4 1.4 0.3 1 12 5.0 3.4 1.5 0.2 1 13 4.4 2.9 1.4 0.2 1 14 4.9 3.1 1.5 0.1 1 I can do it the result above like this, Class - ifelse(newtest.iris$Species==rosa, 0, 1) NewIris - data.frame(SL = newtest.iris$Sepal.Length, +SW = newtest.iris$Sepal.Width, +PL = newtest.iris$Petal.Length, +PW = newtest.iris$Petal.Width, +Class) Because I have more variables in my datasets which I must to change. Is there any way to change automatically and which library contains a function to compute that? I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ 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 -- Notice: This e-mail message, together with any attachment...{{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] Automating plot labelling in custom function in lapply() ?
On Fri, 2005-04-29 at 13:00 +0100, Gavin Simpson wrote: Dear List, Consider the following example: dat - data.frame(var1 = rnorm(100), var2 = rnorm(100), var3 = rnorm(100), var4 = rnorm(100)) oldpar - par(mfrow = c(2,2), no.readonly = TRUE) invisible(lapply(dat, function(x) { plot(density(x), main = deparse(substitute(x))) } ) ) par(oldpar) I want to the main title in each of the density plots to be var1, var2, etc. The above code produces x[[1]], x[[2]] etc. What do I need to modify to be able to use the name of x as the plot label within in the above situation? Thanks in advance, Gav Gavin, To paraphrase John Fox from a recent thread, this is one of those times where trying to avoid using a for() loop is counterproductive: oldpar - par(mfrow = c(2,2), no.readonly = TRUE) for (i in 1:4) { plot(density(dat[, i]), main = colnames(dat)[i]) } par(oldpar) 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] Automating plot labelling in custom function in lapply() ?
Gavin Simpson wrote on 4/29/2005 5:00 AM: Dear List, Consider the following example: dat - data.frame(var1 = rnorm(100), var2 = rnorm(100), var3 = rnorm(100), var4 = rnorm(100)) oldpar - par(mfrow = c(2,2), no.readonly = TRUE) invisible(lapply(dat, function(x) { plot(density(x), main = deparse(substitute(x))) } ) ) par(oldpar) I want to the main title in each of the density plots to be var1, var2, etc. The above code produces x[[1]], x[[2]] etc. What do I need to modify to be able to use the name of x as the plot label within in the above situation? Thanks in advance, Gav Gav, I think a `for' loop would be more useful here (not to mention, more readable): dat - data.frame(var1 = rnorm(100), var2 = rnorm(100), var3 = rnorm(100), var4 = rnorm(100)) oldpar - par(mfrow = c(2,2), no.readonly = TRUE) for(v in names(dat)) plot(density(dat[[v]]), main = v) par(oldpar) HTH, --sundar __ 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] Automating plot labelling in custom function in lapply( ) ?
From: Marc Schwartz On Fri, 2005-04-29 at 13:00 +0100, Gavin Simpson wrote: Dear List, Consider the following example: dat - data.frame(var1 = rnorm(100), var2 = rnorm(100), var3 = rnorm(100), var4 = rnorm(100)) oldpar - par(mfrow = c(2,2), no.readonly = TRUE) invisible(lapply(dat, function(x) { plot(density(x), main = deparse(substitute(x))) } ) ) par(oldpar) I want to the main title in each of the density plots to be var1, var2, etc. The above code produces x[[1]], x[[2]] etc. What do I need to modify to be able to use the name of x as the plot label within in the above situation? Thanks in advance, Gav Gavin, To paraphrase John Fox from a recent thread, this is one of those times where trying to avoid using a for() loop is counterproductive: oldpar - par(mfrow = c(2,2), no.readonly = TRUE) for (i in 1:4) { plot(density(dat[, i]), main = colnames(dat)[i]) } par(oldpar) HTH, Marc Schwartz For things like these I'd suggest using lattice; e.g., densityPlot - function(dat, xlab=deparse(substitute(dat)), ...) { stopifnot(require(lattice)) vars - rep(colnames(dat), each=nrow(dat)) densityplot(~ c(as.matrix(dat)) | vars, xlab=xlab, ...) } densityPlot(dat, layout=c(2, 2)) Cheers, Andy __ 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] Error in La.chol2inv(x, size) : lapack routines cannot be loaded
Dear all, OS: x86_64-suse-linux 9.2 CPU: Intel(R) Xeon(TM) CPU 3.20GHz R-version: R-2.1.0 I've started using a new Linux server, upgraded at the same time to R-2.1.0 (see above) and have problems with some elementary analysis that ran without a problem on my previous configuration. anova.glm gives the following error: Error in La.chol2inv(x, size) : lapack routines cannot be loaded This was with the after the following configure ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x The obvious thing to try next was: ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x --with-lapack but this gave errors at the make: make[3]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: `Makedeps' is up to date. make[4]: Leaving directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' gcc -shared -L/usr/local/lib -o lapack.so Lapack.lo -llapack -lblas -lg2c -lm -lgcc_s /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a(dgecon.i): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a: could not read symbols: Bad value collect2: ld returned 1 exit status make[4]: *** [lapack.so] Error 1 I've found some similar postings about Debian, but without a soluition. Any idea how I could proceed? Joris confidentiality notice: The information contained in this e-mail is confidential and...{{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
[R] Decimal to hexadecimal
Hello! Is there an R function that would convert decimal code to hexadecimal one? -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana Biotechnical FacultyURI: http://www.bfro.uni-lj.si/MR/ggorjan Zootechnical Department mail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzale fax: +386 (0)1 72 17 888 Slovenia, Europe -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ 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 on using read.Agilent
Hello I am new to R and am trying to read Agilent microarray files using read.Agilent in the marray library. Please see cammand line arguments below: hcc.targets - read.marrayInfo(file.path(data.dir, target.text)) hcc.layout - read.marrayLayout(fname=file.path(data.dir, layout.text), ngr=1, ngc=1, nsr=105, nsc=215, ctl.col=6, skip=0) hcc.gnames - read.marrayInfo(file.path(data.dir, layout.text), info_id=4:5, labels=4, skip=10) fnames - dir(path=data.dir, pattern=paste(*, .txt, sep=\.)) hcc - read.Agilent(fnames, path=data.dir, name.Gf=gMedianSignal, name.Gb=gBGMedianSignal, name.Rf = rMedianSignal, name.Rb = rBGMedianSignal, layout=hcc.layout, gnames=hcc.gnames, targets=hcc.targets, skip=10, sep=\t, quote=\, DEBUG=TRUE) However I am getting an error: Error in read.Agilent(fnames, path = data.dir, name.Gf = gMedianSignal , : Object descript not found I have checked the file and there doesn't appear to be any problems opening it and there are no strange characters. I am not sure what I am doing wrong or what to try next. Can you please help? Many thanks in advance. Archana Sharma-Oates __ 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 files and vignettes
Hi Uwe, Thanks for that answer. However, one thing remains unclear, which latex file do I use here, ie the one generated from Rdconv, or the one generated as an intermediate step in Rd2dvi? In the latter case, wouldn't I get a double \documentclass statement and the like? thanks in advance, ingmar On 4/29/05 7:48 AM, Uwe Ligges [EMAIL PROTECTED] wrote: Ingmar Visser wrote: Hi all, I'm writing a vignette for my package, and I would like to include some of the package help files in there as well. Is there an easy way of doing so? I tried using R CMD Rdconv to generate latex files from .Rd files but I am not sure how to include these into a .Rnw file (ie the vignette source). The resulting file from Rdconv do not readily compile using latex ... The other option I tried is to use R CMD Rd2dvi --no-clean etc which will give me a latex'able file Rd2.tex, portions of which I can then include into the vignette source file. However, this takes quite some time given that I have 6 or so .Rd files. Especially when updating them, adding functions and so forth, this process of generating the Rd2.tex files and then copying and pasting into the vignette source is quite tedious. In short, is there a faster way of doing this? best, ingmar You can wrap the resulting LaTeX files in \documentclass[a4paper]{article} \usepackage[ae]{Rd} \begin{document} % \include{TheLaTeXFile} \end{document} Relevant files (such as Rd.sty) are available in .../pathToR/share/texmf Hence you can \input or \include it in any other LaTeX files, such as vignettes. And you can write Makefiles in order to process automatically. Uwe Ligges -- Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15, 1018 WB Amsterdam The Netherlands http://users.fmg.uva.nl/ivisser/ tel: +31-20-5256735 __ 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 files and vignettes
Ingmar Visser wrote: Hi Uwe, Thanks for that answer. However, one thing remains unclear, which latex file do I use here, ie the one generated from Rdconv, or the one generated as an intermediate step in Rd2dvi? I meant the one generated from Rdconv. Uwe In the latter case, wouldn't I get a double \documentclass statement and the like? thanks in advance, ingmar On 4/29/05 7:48 AM, Uwe Ligges [EMAIL PROTECTED] wrote: Ingmar Visser wrote: Hi all, I'm writing a vignette for my package, and I would like to include some of the package help files in there as well. Is there an easy way of doing so? I tried using R CMD Rdconv to generate latex files from .Rd files but I am not sure how to include these into a .Rnw file (ie the vignette source). The resulting file from Rdconv do not readily compile using latex ... The other option I tried is to use R CMD Rd2dvi --no-clean etc which will give me a latex'able file Rd2.tex, portions of which I can then include into the vignette source file. However, this takes quite some time given that I have 6 or so .Rd files. Especially when updating them, adding functions and so forth, this process of generating the Rd2.tex files and then copying and pasting into the vignette source is quite tedious. In short, is there a faster way of doing this? best, ingmar You can wrap the resulting LaTeX files in \documentclass[a4paper]{article} \usepackage[ae]{Rd} \begin{document} % \include{TheLaTeXFile} \end{document} Relevant files (such as Rd.sty) are available in .../pathToR/share/texmf Hence you can \input or \include it in any other LaTeX files, such as vignettes. And you can write Makefiles in order to process automatically. Uwe Ligges __ 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] Error in La.chol2inv(x, size) : lapack routines cannot be loaded
Joris De Wolf [EMAIL PROTECTED] writes: Dear all, OS: x86_64-suse-linux 9.2 CPU: Intel(R) Xeon(TM) CPU 3.20GHz R-version: R-2.1.0 I've started using a new Linux server, upgraded at the same time to R-2.1.0 (see above) and have problems with some elementary analysis that ran without a problem on my previous configuration. anova.glm gives the following error: Error in La.chol2inv(x, size) : lapack routines cannot be loaded This was with the after the following configure ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x The obvious thing to try next was: ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x --with-lapack but this gave errors at the make: make[3]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: `Makedeps' is up to date. make[4]: Leaving directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' gcc -shared -L/usr/local/lib -o lapack.so Lapack.lo -llapack -lblas -lg2c -lm -lgcc_s /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a(dgecon.i): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a: could not read symbols: Bad value collect2: ld returned 1 exit status make[4]: *** [lapack.so] Error 1 I've found some similar postings about Debian, but without a soluition. Any idea how I could proceed? Which compilers are you using? What is the output from configure? Unless something drastic happened between 9.1 and 9.2, you should be able to just ./configure without further decorations (except possibly --without-x if you can't be bothered to install the xorg-x11-devel RPM). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] How to change variables in datasets automatically
On 4/29/05, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear R-helpers, Suppose I have a dataset, data(iris) a - data.frame(Sepal.Length=c(1:4), Sepal.Width=c(2:5), Petal.Length=c(3:6), Petal.Width=c(4:7), Species=rep(rosa,4)) b - iris[1:10,] newtest.iris - rbind(a,b) newtest.iris Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 1.0 2.0 3.0 4.0rosa 2 2.0 3.0 4.0 5.0rosa 3 3.0 4.0 5.0 6.0rosa 4 4.0 5.0 6.0 7.0rosa 11 5.1 3.5 1.4 0.2 setosa 21 4.9 3.0 1.4 0.2 setosa 31 4.7 3.2 1.3 0.2 setosa 41 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa 7 4.6 3.4 1.4 0.3 setosa 8 5.0 3.4 1.5 0.2 setosa 9 4.4 2.9 1.4 0.2 setosa 10 4.9 3.1 1.5 0.1 setosa I want to change each labels (variables) like: Sepal.Length=SL, Sepal.Width=SW, Petal.Length=PL, Petal.Width=PW, and Species=Class. Then I want to change each cell in Species variable like rosa=0 and setosa=1. The result something like this, NewIris SL SW PL PW Class 1 1.0 2.0 3.0 4.0 0 2 2.0 3.0 4.0 5.0 0 3 3.0 4.0 5.0 6.0 0 4 4.0 5.0 6.0 7.0 0 5 5.1 3.5 1.4 0.2 1 6 4.9 3.0 1.4 0.2 1 7 4.7 3.2 1.3 0.2 1 8 4.6 3.1 1.5 0.2 1 9 5.0 3.6 1.4 0.2 1 10 5.4 3.9 1.7 0.4 1 11 4.6 3.4 1.4 0.3 1 12 5.0 3.4 1.5 0.2 1 13 4.4 2.9 1.4 0.2 1 14 4.9 3.1 1.5 0.1 1 I can do it the result above like this, Class - ifelse(newtest.iris$Species==rosa, 0, 1) NewIris - data.frame(SL = newtest.iris$Sepal.Length, +SW = newtest.iris$Sepal.Width, +PL = newtest.iris$Petal.Length, +PW = newtest.iris$Petal.Width, +Class) Because I have more variables in my datasets which I must to change. Is there any way to change automatically and which library contains a function to compute that? I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ 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 Someone else has already indicated how to do this but as you say you have a large number of columns you might want an automated way as well. For example the following removes lower case letters and dots from the names and then changes Species to Class. Note that there is a dot after a-z # remove lower case letters and dots from column names and # change name of col5 to Class data(iris) names(iris) - gsub([a-z.], , names(iris)) names(iris)[5] - Class Another possibility might be to use abbreviate. This does not give the exact result you are looking for but its close and its very easy: data(iris) names(iris) - abbreviate(names(iris)) names(iris)[5] - Class __ 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] Error in La.chol2inv(x, size) : lapack routines cannot be loaded
Your subject line is misleading: you ignored a warning during make. The solution is not to specify all the confgure flags you can think of, and allow R to choose. Only once you have it working with the defaults try substituting other libraries. Your particular problem is that you have a non-shareable liblapack in your library path. Do see the warnings about this on 64-bit systems in the R-admin manual (you know, the one the INSTALL file asks you to read if you run into problems!). On Fri, 29 Apr 2005, Joris De Wolf wrote: Dear all, OS: x86_64-suse-linux 9.2 CPU: Intel(R) Xeon(TM) CPU 3.20GHz R-version: R-2.1.0 I've started using a new Linux server, upgraded at the same time to R-2.1.0 (see above) and have problems with some elementary analysis that ran without a problem on my previous configuration. anova.glm gives the following error: Error in La.chol2inv(x, size) : lapack routines cannot be loaded This was with the after the following configure ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x The obvious thing to try next was: ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x --with-lapack but this gave errors at the make: make[3]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: `Makedeps' is up to date. make[4]: Leaving directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' gcc -shared -L/usr/local/lib -o lapack.so Lapack.lo -llapack -lblas -lg2c -lm -lgcc_s /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a(dgecon.i): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a: could not read symbols: Bad value collect2: ld returned 1 exit status make[4]: *** [lapack.so] Error 1 I've found some similar postings about Debian, but without a soluition. I am unaware of any unresolved issues of this type that are not covered in the installation manual. 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] Decimal to hexadecimal
?sprintf, if you mean to convert a number to a hexadecimal character representation. To convert a decimal representation to a number, use as.numeric. This has been covered recently so please try the archives. On Fri, 29 Apr 2005, Gregor GORJANC wrote: Is there an R function that would convert decimal code to hexadecimal one? -- 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] Error in La.chol2inv(x, size) : lapack routines cannot be loaded
Your Linux distribution has a static Lapack library that you can't use for R because it wasn't compiled into position-independent code. That's a standard Lapack build, but won't work to make a dynamically loadable library. That's why the second attempt doesn't build. I'm not sure I can help further without knowing a little more. The first thing I would do, though, is to try a plain build without install and see what's happening. If it's the same behavior, you might try checking how R (the script that starts the executable) sets up the environment, particularly LD_LIBRARY_PATH. Does lapack.so get built? How? Do you have a BLAS on your system, or does it use R's? The output of configure would help to see what's being picked up. (I don't have a 64 bit machine handy so I can't go out and try any of these right now...) Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joris De Wolf Sent: Friday, April 29, 2005 9:54 AM To: r-help@stat.math.ethz.ch Subject: [R] Error in La.chol2inv(x, size) : lapack routines cannot be loaded Dear all, OS: x86_64-suse-linux 9.2 CPU: Intel(R) Xeon(TM) CPU 3.20GHz R-version: R-2.1.0 I've started using a new Linux server, upgraded at the same time to R-2.1.0 (see above) and have problems with some elementary analysis that ran without a problem on my previous configuration. anova.glm gives the following error: Error in La.chol2inv(x, size) : lapack routines cannot be loaded This was with the after the following configure ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x The obvious thing to try next was: ./configure --with-readline --prefix=/opt/R-2.1.0 --with-libpng --with-jpeglib --with-pcre --without-x --with-lapack but this gave errors at the make: make[3]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: `Makedeps' is up to date. make[4]: Leaving directory `/usr/local/src/R-2.1.0/src/modules/lapack' make[4]: Entering directory `/usr/local/src/R-2.1.0/src/modules/lapack' gcc -shared -L/usr/local/lib -o lapack.so Lapack.lo -llapack -lblas -lg2c -lm -lgcc_s /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../x86_64-suse-linux/bin /ld: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a(dge con.i): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/../../../../lib64/liblapack.a: could not read symbols: Bad value collect2: ld returned 1 exit status make[4]: *** [lapack.so] Error 1 I've found some similar postings about Debian, but without a soluition. Any idea how I could proceed? Joris confidentiality notice: The information contained in this e-mail is confidential and...{{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 __ 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] normality test
On 28-Apr-05 Pieter Provoost wrote: Thanks all for your comments and hints. I will try to keep them in mind. Since a number of people asked me what I'm trying to do: I want to apply Bayesian inference to a simple ecological model I wrote, and therefore I need to fit (uniform, normal or lognormal) distributions to sets of observed data (to derive mean and sd). You probably have noticed that I'm quite new to statistics, but I'm working on that... Pieter And please continue to do so! Let me try to be constructive. It is clearly established that the data you posted are far from Normally distributed. The simple qqnorm plot shows that immediately, and if you need it the shapiro.test() with p-value = 8.499e-11 settles it! Going, however, a bit further, and looking at qqnorm(log(X)) (X being what I call your data series) suggests that it departs systematically from a pure logNormal at least at the 6 highest values of X. And again, shapiro,test(log(X)) gives p-value = 0.00965 which is again a fairly strong indication. Now, going back to your statement above, that you wrote a simple ecological model, I would like to know more about that before proceeding further. The rather clear break in slope in qqnorm(log(X)) suggests to me the possibility that your data may represent a mixture of two distinct, possibly though not necessarily logNormal, distributions, one having a much longer upper tail than the other but being a relative small proportion (say 1/3). For example, with X denoting your data, compare qqnorm(log(X)) with set.seed(52341);Y1-exp(rnorm(22,-3.26,0.69)); Y2-exp(rnorm(10,-1.75,2.35)) qqnorm(log(c(Y1,Y2))) They are not dissimilar (and I have not been trying very hard). Another thing to look at is simply hist(log(X),breaks=0.5*(-12:4) This also shows some interesting features: the very high peak between -3.0 and -2.5 (and possibly an unduly high value between -3.5 and -3.0), together with a rather thin and widely spread upper tail above -2.0. This could be quite consistent with the kind of mixture described above, or could be due to observer error/bias in measurement. In any case, it is clear that there is more than a simple (uniform, normal or lognormal) distribution at play here. In a real investigation, I would at this stage be concerned to develop a realistic model of how the data are generated. You do not say what these data represent. Ths above was mostly written before you posted your second email, explaining that The Bayesian methods I (will) use are implemented in the modelling environment I'm using (FEMME). I'm supervised by the person that developed the environment, and she asked me to fit a normal or lognormal distribution to the observed data. The parameters of that distribution will then be used for the Bayesian analysis. So I suppose my supervisor knows what very well what she's doing, even though I don't (well... not yet). It may be speculated whether your supervisor has herself seriously questioned the structure of these data, since what she is asking you to do seems to presume that the above is not relevant! However, a mixture model would fit nicely into a Bayesian framework, since (from the above) I suspect a simulation or MCMC procedure will depend on the parameters to be estimated for the distribution. For the mixture (e.g. log(X) is a mixture of two normal distrbutions), you can estimate the two parameters for each normal distribution and the proportions p:(1-p) of each. Then, in sampling from the mixture you first decide on component 1 with probability p or component 2 with probability q = (1-p), then sample from the corresonding lognormal distribution. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 29-Apr-05 Time: 15:41:36 -- XFMail -- __ 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] Subarrays
Define an array v-1:256 dim(v)-rep(4,4) Subarrays can be obtained as follows: v[3,2,,2] [1] 71 87 103 119 v[3,,,2] [,1] [,2] [,3] [,4] [1,] 67 83 99 115 [2,] 71 87 103 119 [3,] 75 91 107 123 [4,] 79 95 111 127 In the general case this procedure is very tedious. Given an array A, dim(A)=(dim_1,dim_2,...,dim_d) and two vectors v1=(n_i1,...n_ik), v2=(int_1,...,int_k) ('marginals' and relevant 'interval numbers') is there a smart way to obtain A[,...,int_1,,int_2,,,int_k,] ? Best wishes Gunnar Hellmund __ 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] normality test
I looked carefully at ?shapiro.test and I did not see it state anywhere what the null hypothesis is or what a low p-value means. I understand that I can run the example shapiro.test(rnorm(100, mean = 5, sd = 3)) and deduce from its p-value of 0.0988 that the null-hypothesis must be normality, but why can't the help page explicitly state what the null hypothesis is. I also understand that the help pages are not meant to teach statistics, but stating the null hypothesis doesn't seem very difficult given the already considerable amount of time that probably went into creating these otherwise very good help pages. Many people who use this software took stats classes 10 or more years ago and this stuff is easily forgotten. Students frequently have trouble keeping the null and alternative hypothesis straight. Just my $0.02. Thanks, Roger On 4/28/05, Romain Francois [EMAIL PROTECTED] wrote: Le 28.04.2005 13:16, Pieter Provoost a écrit : Hi, I have a small set of data on which I have tried some normality tests. When I make a histogram of the data the distribution doesn't seem to be normal at all (rather lognormal), but still no matter what test I use (Shapiro, Anderson-Darling,...) it returns a very small p value (which as far as I know means that the distribution is normal). Am I doing something wrong here? Thanks Pieter Hello, You seem to know not far enougth. Null hypothesis in shapiro.test is **normality**, if your p-value is very small, then the data is **not** normal. Look carefully at ?shapiro.test and try again. Furthermore, normality tests are not very powerful. Consider using a ?qqnorm and ?qqline Romain -- ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.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-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] Subarrays
Here's one way: subarray - function(x, marginals, intervals) { + if (length(marginals) != length(intervals)) + stop(marginals and intervals must be the same length (intervals can be a list)) + if (any(marginals1 | marginalslength(dim(x + stop(marginals must contain values in 1:length(dim(x))) + ic - Quote(x[, drop=T]) + # ic has 4 elts with one empty index arg + ic2 - ic[c(1, 2, rep(3, length(dim(x))), 4)] + # ic2 has an empty arg for each dim of x + ic2[marginals+2] - intervals + eval(ic2) } subarray(v, c(1,4), c(3,2)) [,1] [,2] [,3] [,4] [1,] 67 83 99 115 [2,] 71 87 103 119 [3,] 75 91 107 123 [4,] 79 95 111 127 subarray(v, c(1,4), list(3,2)) [,1] [,2] [,3] [,4] [1,] 67 83 99 115 [2,] 71 87 103 119 [3,] 75 91 107 123 [4,] 79 95 111 127 subarray(v, c(1,3,4), list(c(1,3,4),1,2)) [,1] [,2] [,3] [,4] [1,] 65 69 73 77 [2,] 67 71 75 79 [3,] 68 72 76 80 Question for language experts: is this the best way to create and manipulate R language expressions that contain empty arguments, or are there other preferred ways? -- Tony Plate Gunnar Hellmund wrote: Define an array v-1:256 dim(v)-rep(4,4) Subarrays can be obtained as follows: v[3,2,,2] [1] 71 87 103 119 v[3,,,2] [,1] [,2] [,3] [,4] [1,] 67 83 99 115 [2,] 71 87 103 119 [3,] 75 91 107 123 [4,] 79 95 111 127 In the general case this procedure is very tedious. Given an array A, dim(A)=(dim_1,dim_2,...,dim_d) and two vectors v1=(n_i1,...n_ik), v2=(int_1,...,int_k) ('marginals' and relevant 'interval numbers') is there a smart way to obtain A[,...,int_1,,int_2,,,int_k,] ? Best wishes Gunnar Hellmund __ 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] R-2.1.0 search engine works with mozilla browser but not firefox
I'm running R-2.1.0 on a Linux box and found that the HTML search engine help would not work with Firefox 1.0.3 but would work with Mozilla 1.7.7. I have Java Runtime Environment 1.5.0_02 installed. With Firefox, when I launch help.start() and click to the search engine, it brings up the first page with Applet SearchEngine started in the status bar, but clicking on one of the contents entries or trying to search for a term does nothing. Scott Waichler Pacific Northwest National Laboratory [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] robust model selection criteria
Dear R-help-team, do you know if there is a package for R available that contains a function, which calculates a robust model selection criterium like robust AIC and has a robust selection function like step for lm-objects, for an rlm-object. Unfortunately, functions like step or stepAIC cannot be applied to rlm-objects. Moreover, these functions do not use robust AIC. Thanks for your help! With best regards, Carsten Colombier Dr. Carsten Colombier Economist Group of Economic Advisers Swiss Federal Finance Administration Bundesgasse 3 CH-3003 Bern phone +41 31 322 63 32 fax +41 31 323 08 33 email: [EMAIL PROTECTED] www.efv.admin.ch __ 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] Subarrays
You could write an R function to create an integer matrix whose rows are the coordinates of the lattice points in the box with specified lower and upper limits (code at end) makeLattice - function(lower,upper) { # generate lattice points in box from from lower to upper } for example, then you can create the index matrix via lower - rep(1,length(dim(A))) lower[v1] - v2 upper - dim(A) upper[v1] - v2 indx - makeLattice(lower,upper) and now A[indx] is the slice you want. You can dimension it as dim(A)[-v1]. Reid Huntsinger Code: makeLattice - function(lower,upper) { # generate lattice points in box from from lower to upper n - length(lower) if (n != length(upper)) stop(vectors must have same length) d - upper - lower + 1 latticePts - vector(length=n*prod(d), mode=integer) dim(latticePts) - c(prod(d), n) # create each column D - c(1,cumprod(d[-n])) for (j in 1:n) { latticePts[,j] - as.integer(rep(lower[j]:upper[j],rep(D[j],d[j]))) } latticePts } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gunnar Hellmund Sent: Friday, April 29, 2005 11:34 AM To: r-help@stat.math.ethz.ch Subject: [R] Subarrays Define an array v-1:256 dim(v)-rep(4,4) Subarrays can be obtained as follows: v[3,2,,2] [1] 71 87 103 119 v[3,,,2] [,1] [,2] [,3] [,4] [1,] 67 83 99 115 [2,] 71 87 103 119 [3,] 75 91 107 123 [4,] 79 95 111 127 In the general case this procedure is very tedious. Given an array A, dim(A)=(dim_1,dim_2,...,dim_d) and two vectors v1=(n_i1,...n_ik), v2=(int_1,...,int_k) ('marginals' and relevant 'interval numbers') is there a smart way to obtain A[,...,int_1,,int_2,,,int_k,] ? Best wishes Gunnar Hellmund __ 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] robust model selection criteria
-- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, April 29, 2005 9:26 AM To: r-help@stat.math.ethz.ch Subject: [R] robust model selection criteria Dear R-help-team, do you know if there is a package for R available that contains a function, which calculates a robust model selection criterium like robust AIC and has a robust selection function like step for lm-objects, for an rlm-object. Unfortunately, functions like step or stepAIC cannot be applied to rlm-objects. Moreover, these functions do not use robust AIC. ??? How could this be meaningful? The robust likelihood need not increase as more parameters are added because of the robust reweighting (points would be downweighted differently in the different models). How do you account for the number of parameters in a robust model given that it is in essence nonlinear? (This comment subject to correction/expansion by wiser heads than me) -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ 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] R-2.1.0 search engine works with mozilla browser but not firefox
It works with Firefox 1.0.3 for me on Fedora Core 3. Please consult the appropriate manual as linked from the search page: this is a configuration issue local to you. One irritating part of FC3's updates is that they do not (at least for me) copy the plugins across, so I had manually to fix up my Firefox 1.0.3 update yesterday. Sounds like your plugin is not set up correctly. On Fri, 29 Apr 2005, Waichler, Scott R wrote: I'm running R-2.1.0 on a Linux box and found that the HTML search engine help would not work with Firefox 1.0.3 but would work with Mozilla 1.7.7. I have Java Runtime Environment 1.5.0_02 installed. With Firefox, when I launch help.start() and click to the search engine, it brings up the first page with Applet SearchEngine started in the status bar, but clicking on one of the contents entries or trying to search for a term does nothing. -- 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] robust model selection criteria
On Fri, 29 Apr 2005, Berton Gunter wrote: -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, April 29, 2005 9:26 AM To: r-help@stat.math.ethz.ch Subject: [R] robust model selection criteria Dear R-help-team, do you know if there is a package for R available that contains a function, which calculates a robust model selection criterium like robust AIC and has a robust selection function like step for lm-objects, for an rlm-object. Unfortunately, functions like step or stepAIC cannot be applied to rlm-objects. Moreover, these functions do not use robust AIC. ??? How could this be meaningful? The robust likelihood need not increase as more parameters are added because of the robust reweighting (points would be downweighted differently in the different models). How do you account for the number of parameters in a robust model given that it is in essence nonlinear? (This comment subject to correction/expansion by wiser heads than me) More fundamentally, `AIC' is about maximum-likelihood fitting of true models. Now rlm does usually correspond to ML fitting of a non-normal linear model, so it would be possible to compute a likelihood and hence AIC. The point however is that the model is assumed to be false. There are AIC-like criteria for that situation, but they are essentially impossible to compute accurately as they depend on fine details of the unknown true error distribution (and still assume a linear model). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ 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
[R] congratulations to the JGR developers
Just want to offer my congratulations to the JGR developers as the recepient of the 2005 Chambers Award. Great job, guys!! http://stats.math.uni-augsburg.de/JGR/ [Now, could JGR be updated to work with 2.1.0 (or be made R version independent, please... 8-)] Best, Andy __ 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] normality test
On 29-Apr-05 roger bos wrote: I looked carefully at ?shapiro.test and I did not see it state anywhere what the null hypothesis is or what a low p-value means. I understand that I can run the example shapiro.test(rnorm(100, mean = 5, sd = 3)) and deduce from its p-value of 0.0988 that the null-hypothesis must be normality, but why can't the help page explicitly state what the null hypothesis is. Hi Roger, Well, the opening line is Description: Performs the Shapiro-Wilk test for normality. which does pretty strongly suggest that the hypothesis being tested by shapiro.test(X) is normality of the distribution of X. It might be just a shade more unambiguous of it were worded Performs the Shapiro-Wilk test of normality or Performs the Shapiro-Wilk test for non-normality. since testing for something, like testing for contamination tends to suggest testing for something exceptional, and testing for contamination could equally be seen as a test of purity. (Excuse me, sir. I just need to test your data for normality. And you're in trouble if they are.) But all that is on the very margin of semantic finesse! I also understand that the help pages are not meant to teach statistics, but stating the null hypothesis doesn't seem very difficult given the already considerable amount of time that probably went into creating these otherwise very good help pages. Many people who use this software took stats classes 10 or more years ago and this stuff is easily forgotten. Students frequently have trouble keeping the null and alternative hypothesis straight. Just my $0.02. I think there's a general approach in the help pages that users understand the basics of what the function is about, and it is there to specify what is necessary in order to get it to work correctly. One can take your point about stating explicitly what the null hypothesis of a test is, that it would be useful for people who are not sure about that sort of thing, and would advance their statistical understanding at the same time as their proficiency in R. However, while this might be feasible for simple matters like the null hypothesis being tested by a simple function like shapiro.test or t.test (which, by the way, does not even hint at what the null hypothesis might be: you have to infer it from the options available for the alternative hypothesis), it could get out of hand for tests applicable to more complex situations like ANOVA, mixed models, and so on. There is a dangert, if the hypotheis were to be spelled out, that the help page might become a small (or not so small) book on that aspect of statistics. A better place for such things is in documents like Introductory Statistics with R and so on. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 29-Apr-05 Time: 17:54:19 -- XFMail -- __ 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] Subarrays
Tony Plate [EMAIL PROTECTED] writes: Question for language experts: is this the best way to create and manipulate R language expressions that contain empty arguments, or are there other preferred ways? It's generally a pain anyways... One possible alternative is to use TRUE instead ix -rep(list(T),4) ix[c(1,4)] - c(3,2) do.call([,c(list(v),ix)) [,1] [,2] [,3] [,4] [1,] 67 83 99 115 [2,] 71 87 103 119 [3,] 75 91 107 123 [4,] 79 95 111 127 The alist() function can be used to generate the missing argument in a somewhat clean way. E.g., ix - as.list(dim(v)) ix[c(1,4)] - c(3,2) ix[-c(1,4)] - alist(a=) # name disappears do.call([,c(list(v),ix)) (BTW, it surprised me a little that you don't need as.list() on the right hand side of ix[c(1,4)] - c(3,2), anyone know the rationale?) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] postscript() filenames with forward slashes cause abort
My newly installed R-2.1.0 apparently doesn't like forward slashes in filenames: R.version.string [1] R version 2.1.0, 2005-04-18 plotfile - \home\mean_monthly_stl.eps postscript(plotfile) plotfile - /home/mean_monthly_stl.eps postscript(plotfile) *** glibc detected *** double free or corruption (!prev): 0x098e7180 *** Abort Does this have something to do with UTF-8 (about which I know little)? Scott Waichler Pacific Northwest National Laboratory [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] its filter
filter() returns a ts object even if x is an its. Is there a filter function that returns an its output for an its input? __ 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] its filter
Try: install.packages(zoo) # rollmean, etc. and rapply are new as of zoo 0.9-9 library(zoo) as.its(rollmean(as.zoo(x), 5)) See ?rollmean and ?rapply in the zoo package. On 4/29/05, Omar Lakkis [EMAIL PROTECTED] wrote: filter() returns a ts object even if x is an its. Is there a filter function that returns an its output for an its input? __ 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] postscript() filenames with forward slashes cause abort
Waichler, Scott R [EMAIL PROTECTED] writes: My newly installed R-2.1.0 apparently doesn't like forward slashes in filenames: R.version.string [1] R version 2.1.0, 2005-04-18 plotfile - \home\mean_monthly_stl.eps postscript(plotfile) plotfile - /home/mean_monthly_stl.eps postscript(plotfile) *** glibc detected *** double free or corruption (!prev): 0x098e7180 *** Abort Does this have something to do with UTF-8 (about which I know little)? I would conjecture that it has to do with the fact that you do not have write permission in /home! The backslashed version just creates homemean_monthly_stl.eps in the current directory. If you substitute /tmp for /home, the problem goes away (provided you're on some kind of Unix/Linux -- you didn't say). It's still a bug of course. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] Anscombe-Glynn, Bonett-Seier, D'Agostino
Dear useRs, I was searching CRAN for implementation of kurtosis and skewness tests, and found that there is some kind of lack on it. So, I have written three functions: 1. Anscombe-Glynn test for kurtosis 2. Bonett-Seier test based on Geary's kurtosis (which is not widely known, but I was inspired by original paper describing it, found coincidentally in Elsevier database) 3. D'Agostino test for skewness These three functions are not enough to make another small package, so I am waiting for ideas about implementing it in some existing package. If there is a need, I will contact maintainer and write manpages with appropriate examples and references. Regards, -- Lukasz Komsta Department of Medicinal Chemistry Medical University of Lublin 6 Chodzki, 20-093 Lublin, Poland Fax +48 81 7425165 Code: agostino.test - function (x, alternative=c(two.sided,less,greater)) { DNAME - deparse(substitute(x)) x - sort(x[complete.cases(x)]) n - length(x) s - match.arg(alternative) alter - switch(s, two.sided=0, less=1, greater=2) if ((n 8 || n 46340)) stop(sample size must be between 8 and 46340) s3 - (sum((x-mean(x))^3)/n)/(sum((x-mean(x))^2)/n)^(3/2) y - s3*sqrt((n+1)*(n+3)/(6*(n-2))) b2 - 3*(n*n+27*n-70)*(n+1)*(n+3)/((n-2)*(n+5)*(n+7)*(n+9)) w - sqrt(-1+sqrt(2*(b2-1))); d - 1/sqrt(log10(w)); a - sqrt(2/(w*w-1)); z - d*log10(y/a+sqrt((y/a)^2+1)); pval - pnorm(z, lower.tail = FALSE) if (alter == 0) { pval - 2*pval if (pval 1) pval-2-pval alt - data have a skewness } else if (alter == 1) { alt - data have positive skewness } else { pval - 1-pval alt - data have negative skewness } RVAL - list(statistic = c(g1 = s3, z = z), p.value = pval, alternative = alt, method = D'Agostino skewness test, data.name = DNAME) class(RVAL) - htest return(RVAL) } bonett.test - function (x, alternative=c(two.sided,less,greater)) { DNAME - deparse(substitute(x)) x - sort(x[complete.cases(x)]) n - length(x) s - match.arg(alternative) alter - switch(s, two.sided=0, less=1, greater=2) rho - sqrt(sum((x-mean(x))^2)/n); tau - sum(abs(x-mean(x)))/n; omega - 13.29*(log(rho)-log(tau)); z - sqrt(n+2)*(omega-3)/3.54; pval - pnorm(z, lower.tail = FALSE) if (alter == 0) { pval - 2*pval if (pval 1) pval-2-pval alt - kurtosis is not equal to 3 } else if (alter == 1) { alt - kurtosis is greater than 3 } else { pval - 1-pval alt - kurtosis is lower than 3 } RVAL - list(statistic = c(tau = tau, z = z), alternative = alt, p.value = pval, method = Bonett-Seier kurtosis test, data.name = DNAME) class(RVAL) - htest return(RVAL) } anscombe.test - function (x, alternative=c(two.sided,less,greater)) { DNAME - deparse(substitute(x)) x - sort(x[complete.cases(x)]) n - length(x) s - match.arg(alternative) alter - switch(s, two.sided=0, less=1, greater=2) b - n*sum( (x-mean(x))^4 )/(sum( (x-mean(x))^2 )^2); eb2 - 3*(n-1)/(n+1); vb2 - 24*n*(n-2)*(n-3)/ ((n+1)^2*(n+3)*(n+5)); m3 - (6*(n^2-5*n+2)/((n+7)*(n+9)))*sqrt((6*(n+3)*(n+5))/(n*(n-2)*(n-3))); a - 6+(8/m3)*(2/m3+sqrt(1+4/m3)); xx - (b-eb2)/sqrt(vb2); z - ( 1-2/(9*a)-( (1-2/a) / (1+xx*sqrt(2/(a-4))) )^(1/3))/ sqrt(2/(9*a)); pval - pnorm(z, lower.tail = FALSE) if (alter == 0) { pval - 2*pval if (pval 1) pval-2-pval alt - kurtosis is not equal to 3 } else if (alter == 1) { alt - kurtosis is greater than 3 } else { pval - 1-pval alt - kurtosis is lower than 3 } RVAL - list(statistic = c(b2 = b, z = z), p.value = pval, alternative = alt, method = Anscombe-Glynn kurtosis test, data.name = DNAME) class(RVAL) - htest return(RVAL) } __ 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] generalized matrix product ?
Is there available in R a generalized inner product or matrix product, similar to 'outer(x,y, fun)', where one can specifiy an arbitrary function in place of ordinary multiplication? Here's my application. I frequently analyze user questionnaires from our HR/training department. These have questions of the form please rate your skill in task X, and other questions of the form Have you taken course Y? (or How many years since you have taken course Y?) I look at rank correlation between the (suitably ordered) vectors of responses to a question in the first group and a question in the second group. (The two vectors have the same length, but I want to replace the standard inner product with a different operation; in this case, rank correlation) Repeat the process across all possible pairs of questions. Is there a way to accomplish this without nested 'for' statements? Hope this is clear - thanks! == George Heine, PhD Mathematical Analyst National IRM Center U.S. Bureau of Land Management voice (303) 236-0099 fax (303) 236-1974 cell (303) 905-5382 pager [EMAIL PROTECTED] ==t __ 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] postscript() filenames with forward slashes cause abort
My newly installed R-2.1.0 apparently doesn't like forward slashes in filenames: R.version.string [1] R version 2.1.0, 2005-04-18 plotfile - \home\mean_monthly_stl.eps postscript(plotfile) plotfile - /home/mean_monthly_stl.eps postscript(plotfile) *** glibc detected *** double free or corruption (!prev): 0x098e7180 *** Abort I would conjecture that it has to do with the fact that you do not have write permission in /home! The backslashed version just creates homemean_monthly_stl.eps in the current directory. If you substitute /tmp for /home, the problem goes away (provided you're on some kind of Unix/Linux -- you didn't say). It's still a bug of course. Yes, that was it. When I first came across the problem, I had a typo in my longish pathname. For the post to R Help I wanted to simplify the problem as much as possible, and as luck would have it, I picked a shorter pathname that was not writeable by me. Thanks, Scott __ 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] have to point it out again: a distribution question
Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Out of curiosity, how do you plan to use that information? What would you do if you knew that the 'body' starts here and ends there? -Original Message- From: WeiWei Shi [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 4:18 PM To: Huntsinger, Reid Cc: R-help@stat.math.ethz.ch Subject: Re: [R] have to point it out again: a distribution question Here is summary of l-qqnorm(kk) # kk is my sample l$y (which is my sample) l$x (which is therotical quantile) diff-l$y-l$x and summary(l$y) Min. 1st Qu. MedianMean 3rd Qu.Max. 0.9007 0.9942 0.9998 0. 1.0060 1.1070 summary(l$x) Min.1st Qu. Median Mean3rd Qu. Max. -4.145e+00 -6.745e-01 0.000e+00 2.383e-17 6.745e-01 4.145e+00 summary(diff) Min. 1st Qu. MedianMean 3rd Qu.Max. -3.0380 0.3311 0.9998 0. 1.6690 5.0460 Comparing diff with l$x, though the 1st Qu. and 3rd Qu. are different, diff and l$x seem similar to each other, which are proved by qqnorm(l$x) and qqnorm(diff). running the following codes: r-rnorm(1000)+1 # since my sample shift from zero to 1 qq(r[r0.9 r1.2]) # select the central part this gives me a straight line now. Thanks for the good explanation for the phenomena. Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Thanks again, Weiwei On 4/28/05, Huntsinger, Reid [EMAIL PROTECTED] wrote: Stock returns and other financial data have often found to be heavy-tailed. Even Cauchy distributions (without even a first absolute moment) have been entertained as models. Your qq function subtracts numbers on the scale of a normal (0,1) distribution from the input data. When the input data are scaled so that they are insignificant compared to 1, say, then you get essentially the theoretical quantiles ie the x component of the list back from l$x - l$y. l$x is basically a sample from a normal(0,1) distribution so they do line up perfectly in the second qqnorm(). Is that what's happening? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WeiWei Shi Sent: Thursday, April 28, 2005 1:38 PM To: Vincent ZOONEKYND Cc: R-help@stat.math.ethz.ch Subject: [R] have to point it out again: a distribution question Dear R-helpers: I pointed out my question last time but it is only partially solved. So I would like to point it out again since I think it is very interesting, at least to me. It is a question not about how to use R, instead it is a kind of therotical plus practical question, represented by R. I came with this question when I built model for some stock returns. That's the reason I cannot post the complete data here. But I would like to attach some plots here (I zipped them since the original ones are too big). The first plot qq1, is qqnorm plot of my sample, giving me some S-shape. Since I am not very experienced, I am not sure what kind of distribution my sample follows. The second plot, qq2, is obtained via qqnorm(rt(1, 4)) since I run fitdistr(kk, 't') and got m s df 9.998789e-01 7.663799e-03 3.759726e+00 (5.332631e-05) (5.411400e-05) (8.684956e-02) The second plot seems to say my sample distr follows t-distr. (not sure of this) BTW, what the commands for simulating other distr like log-norm, exponential, and so on? The third one was obtained by running the following R code: Suppose my data is read into dataset k from file f392.txt: k-read.table(f392.txt, header=F)# read into k kk-k[[1]] qq(kk) qq function is defined as below: qq-function(dataset){ l-qqnorm(dataset, plot.it=F) diff-l$y-l$x # difference b/w sample and it's therotical quantile qqnorm(diff) } The most interesting thing is (if there is not any stupid game here, and if my sample follows some kind of distribution (no matter if such distr has been found or not)), my qq function seems like a way to evaluate it. But what I am worried about, the line is too perfect, which indiates there is something goofy here, which can be proved via some mathematical inference to get it. However I used qq(rnorm(1)) qq(rt(1, 3.7) qq(rf()) None of them gave me this perfect line! Sorry for the long question but I want to make it clear to everybody about my question. I tried my best :) Thanks for your reading, Weiwei (Ed) Shi, Ph.D On 4/23/05, Vincent ZOONEKYND [EMAIL PROTECTED] wrote: If I understand your problem, you are computing the difference between your data and the quantiles of a standard gaussian variable -- in other words, the difference between the data and the red line, in the following picture. N - 100 # Sample size m - 1# Mean s - 2# dispersion x - m + s * rt(N, df=2) #
RE: [R] R-2.1.0 search engine works with mozilla browser but not firefox
I'm running R-2.1.0 on a Linux box and found that the HTML search engine help would not work with Firefox 1.0.3 but would work with Mozilla 1.7.7. I have Java Runtime Environment 1.5.0_02 installed. With Firefox, when I launch help.start() and click to the search engine, it brings up the first page with Applet SearchEngine started in the status bar, but clicking on one of the contents entries or trying to search for a term does nothing. It works with Firefox 1.0.3 for me on Fedora Core 3. Please consult the appropriate manual as linked from the search page: this is a configuration issue local to you. One irritating part of FC3's updates is that they do not (at least for me) copy the plugins across, so I had manually to fix up my Firefox 1.0.3 update yesterday. Sounds like your plugin is not set up correctly. I followed the advice posted at http://plugindoc.mozdev.org/faqs/java.html#Linux to install the JRE plugin correctly: If you installed the JRE 5.0 RPM, this plugin is /usr/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so - and to install it for Mozilla (including Mozilla Firefox), do the following: * Open a terminal * Change to your Mozilla (or Mozilla Firefox) plugins directory * Issue the following command: ln -s /usr/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so Important! If you install your JRE in a different way (self extracting package, debian package, etc), libjavaplugin_oji.so will quite likely be in a different location. Do not just blindly use the command listed above! All of this checked out for me, and Firefox still won't work with R's search engine. Yes, I understand this isn't an R issue per se, but I don't know where to turn. . . Scott Waichler __ 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] generalized matrix product ?
From: [EMAIL PROTECTED] Is there available in R a generalized inner product or matrix product, similar to 'outer(x,y, fun)', where one can specifiy an arbitrary function in place of ordinary multiplication? Here's my application. I frequently analyze user questionnaires from our HR/training department. These have questions of the form please rate your skill in task X, and other questions of the form Have you taken course Y? (or How many years since you have taken course Y?) I look at rank correlation between the (suitably ordered) vectors of responses to a question in the first group and a question in the second group. (The two vectors have the same length, but I want to replace the standard inner product with a different operation; in this case, rank correlation) Repeat the process across all possible pairs of questions. Is there a way to accomplish this without nested 'for' statements? I don't see how you can generalized inner product to get to rank correlations. Rank correlations are not computed by simply replacing the multiplication in the inner product with something else, but they replace the data values with ranks, and then compute the usual correlations on the ranks. If you want to generate rank correlation matrix, use cor(..., method=spearman). Andy Hope this is clear - thanks! == George Heine, PhD Mathematical Analyst National IRM Center U.S. Bureau of Land Management voice (303) 236-0099 fax (303) 236-1974 cell (303) 905-5382 pager [EMAIL PROTECTED] ==t __ 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] Status
ALERT! This e-mail, in its original form, contained one or more attached files that were infected with a virus, worm, or other type of security threat. This e-mail was sent from a Road Runner IP address. As part of our continuing initiative to stop the spread of malicious viruses, Road Runner scans all outbound e-mail attachments. If a virus, worm, or other security threat is found, Road Runner cleans or deletes the infected attachments as necessary, but continues to send the original message content to the recipient. Further information on this initiative can be found at http://help.rr.com/faqs/e_mgsp.html. Please be advised that Road Runner does not contact the original sender of the e-mail as part of the scanning process. Road Runner recommends that if the sender is known to you, you contact them directly and advise them of their issue. If you do not know the sender, we advise you to forward this message in its entirety (including full headers) to the Road Runner Abuse Department, at [EMAIL PROTECTED] The message cannot be represented in 7-bit ASCII encoding and has been sent as a binary attachment. __ 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] R-2.1.0 search engine works with mozilla browser but not firefox
On Fri, 2005-04-29 at 11:34 -0700, Waichler, Scott R wrote: I'm running R-2.1.0 on a Linux box and found that the HTML search engine help would not work with Firefox 1.0.3 but would work with Mozilla 1.7.7. I have Java Runtime Environment 1.5.0_02 installed. With Firefox, when I launch help.start() and click to the search engine, it brings up the first page with Applet SearchEngine started in the status bar, but clicking on one of the contents entries or trying to search for a term does nothing. It works with Firefox 1.0.3 for me on Fedora Core 3. Please consult the appropriate manual as linked from the search page: this is a configuration issue local to you. One irritating part of FC3's updates is that they do not (at least for me) copy the plugins across, so I had manually to fix up my Firefox 1.0.3 update yesterday. Sounds like your plugin is not set up correctly. I followed the advice posted at http://plugindoc.mozdev.org/faqs/java.html#Linux to install the JRE plugin correctly: If you installed the JRE 5.0 RPM, this plugin is /usr/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so - and to install it for Mozilla (including Mozilla Firefox), do the following: * Open a terminal * Change to your Mozilla (or Mozilla Firefox) plugins directory * Issue the following command: ln -s /usr/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so I believe the problem is related to the change in the installation directory for the updated JVM from Sun. If you use the jre1.5.0_02 from java.sun.com, then the plugin is installed in: /usr/java/jre1.5.0_02/plugin/i386/ns7/libjavaplugin_oji.so I just downloaded the updated RPM binary installer from java.sun.com. A key step here is that you need to remove the old 1.5 version: rpm -e jre-1.5.0-fcs With both versions installed, there appear to be conflicts. The new installer appears to use rpm -i rather than rpm -U, which leaves both versions in place. Testing at the site below with both versions installed fails. Once you have properly done the above, then go here: http://www.java.com/en/download/help/testvm.xml to test your java plug-in installation. Important! If you install your JRE in a different way (self extracting package, debian package, etc), libjavaplugin_oji.so will quite likely be in a different location. Do not just blindly use the command listed above! All of this checked out for me, and Firefox still won't work with R's search engine. Yes, I understand this isn't an R issue per se, but I don't know where to turn. . . One more thing. In the Firefox URL bar, enter the following: about:plugins and then hit return. That will tell you which plugins have been enabled for Firefox. Needless to say, be sure that both Java and Javascript are enabled in the Edit - Preferences - Web Features dialogue for Firefox. 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] have to point it out again: a distribution question
discretization from continuous domain to categorical one so that some data mining algorithm can be applied on it. Maybe there should be more than 3 categories, I don't know. I googled some papers in financial field, and any more suggestions or references will be helpful. Ed On 4/29/05, bogdan romocea [EMAIL PROTECTED] wrote: Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Out of curiosity, how do you plan to use that information? What would you do if you knew that the 'body' starts here and ends there? -Original Message- From: WeiWei Shi [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 4:18 PM To: Huntsinger, Reid Cc: R-help@stat.math.ethz.ch Subject: Re: [R] have to point it out again: a distribution question Here is summary of l-qqnorm(kk) # kk is my sample l$y (which is my sample) l$x (which is therotical quantile) diff-l$y-l$x and summary(l$y) Min. 1st Qu. MedianMean 3rd Qu.Max. 0.9007 0.9942 0.9998 0. 1.0060 1.1070 summary(l$x) Min.1st Qu. Median Mean3rd Qu. Max. -4.145e+00 -6.745e-01 0.000e+00 2.383e-17 6.745e-01 4.145e+00 summary(diff) Min. 1st Qu. MedianMean 3rd Qu.Max. -3.0380 0.3311 0.9998 0. 1.6690 5.0460 Comparing diff with l$x, though the 1st Qu. and 3rd Qu. are different, diff and l$x seem similar to each other, which are proved by qqnorm(l$x) and qqnorm(diff). running the following codes: r-rnorm(1000)+1 # since my sample shift from zero to 1 qq(r[r0.9 r1.2]) # select the central part this gives me a straight line now. Thanks for the good explanation for the phenomena. Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Thanks again, Weiwei On 4/28/05, Huntsinger, Reid [EMAIL PROTECTED] wrote: Stock returns and other financial data have often found to be heavy-tailed. Even Cauchy distributions (without even a first absolute moment) have been entertained as models. Your qq function subtracts numbers on the scale of a normal (0,1) distribution from the input data. When the input data are scaled so that they are insignificant compared to 1, say, then you get essentially the theoretical quantiles ie the x component of the list back from l$x - l$y. l$x is basically a sample from a normal(0,1) distribution so they do line up perfectly in the second qqnorm(). Is that what's happening? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WeiWei Shi Sent: Thursday, April 28, 2005 1:38 PM To: Vincent ZOONEKYND Cc: R-help@stat.math.ethz.ch Subject: [R] have to point it out again: a distribution question Dear R-helpers: I pointed out my question last time but it is only partially solved. So I would like to point it out again since I think it is very interesting, at least to me. It is a question not about how to use R, instead it is a kind of therotical plus practical question, represented by R. I came with this question when I built model for some stock returns. That's the reason I cannot post the complete data here. But I would like to attach some plots here (I zipped them since the original ones are too big). The first plot qq1, is qqnorm plot of my sample, giving me some S-shape. Since I am not very experienced, I am not sure what kind of distribution my sample follows. The second plot, qq2, is obtained via qqnorm(rt(1, 4)) since I run fitdistr(kk, 't') and got m s df 9.998789e-01 7.663799e-03 3.759726e+00 (5.332631e-05) (5.411400e-05) (8.684956e-02) The second plot seems to say my sample distr follows t-distr. (not sure of this) BTW, what the commands for simulating other distr like log-norm, exponential, and so on? The third one was obtained by running the following R code: Suppose my data is read into dataset k from file f392.txt: k-read.table(f392.txt, header=F)# read into k kk-k[[1]] qq(kk) qq function is defined as below: qq-function(dataset){ l-qqnorm(dataset, plot.it=F) diff-l$y-l$x # difference b/w sample and it's therotical quantile qqnorm(diff) } The most interesting thing is (if there is not any stupid game here, and if my sample follows some kind of distribution (no matter if such distr has been found or not)), my qq function seems like a way to evaluate it. But what I am worried about, the line is too perfect, which indiates there is something goofy here, which can be proved via some mathematical inference to get it. However I used qq(rnorm(1)) qq(rt(1, 3.7) qq(rf()) None of them gave me this perfect line! Sorry for the long question but I want to make it clear to everybody about my question. I tried my best :) Thanks for
RE: [R] R-2.1.0 search engine works with mozilla browser but notfirefox
I believe the problem is related to the change in the installation directory for the updated JVM from Sun. If you use the jre1.5.0_02 from java.sun.com, then the plugin is installed in: /usr/java/jre1.5.0_02/plugin/i386/ns7/libjavaplugin_oji.so Ok, the above pathname is the exact one. Yes, this is the one I used. I just downloaded the updated RPM binary installer from java.sun.com. A key step here is that you need to remove the old 1.5 version: rpm -e jre-1.5.0-fcs This is not installed on my machine. With both versions installed, there appear to be conflicts. The new installer appears to use rpm -i rather than rpm -U, which leaves both versions in place. Testing at the site below with both versions installed fails. Once you have properly done the above, then go here: http://www.java.com/en/download/help/testvm.xml to test your java plug-in installation. Yes, this test page works fine in my Firefox, and about:plugins shows the Java stuff is present and enabled. And the boxes under Preferences are checked. Java is working in my Firefox, but there is something about the R search engine it doesn't like. Just to be really clear, this is the page that appears, but the links and search box inside it don't work: file:///tmp/RtmpB32234/.R/doc/html/search/SearchEngine.html Scott __ 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] assign to an element of a vector
Fernando Saldanha [EMAIL PROTECTED] wrote: I am trying to find a way to assign values to elements of a vector that will be defined by a user. a - c(1,2,3) get('a')[1] - 0 Error: Target of assignment expands to non-language object Try this function: g.assign - function(i, pos=1, ..., value) { x - if (pos 0) get(i, pos) else get(i, , parent.frame()) x[...] - value if (pos 0) assign(i, x, pos) else assign(i, x, , parent.frame()) } Your example becomes: R a - c(1,2,3) R g.assign(a, pos=1, 1, value=0) Note you use a positive pos (usually pos=1) for global variables, and pos=0 for local variables inside a function. The ... construction allows this function to work for arrays too, but the downside is that you must type value= explicitly. -- David Brahm ([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] have to point it out again: a distribution question
There are many ways to discretize data. That's one way of looking at clustering (vector quantization). You might also look into modelling approaches which don't require it: splines, trees, etc. What sort of data mining are you trying to do? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WeiWei Shi Sent: Friday, April 29, 2005 3:22 PM To: bogdan romocea Cc: R-help@stat.math.ethz.ch Subject: Re: [R] have to point it out again: a distribution question discretization from continuous domain to categorical one so that some data mining algorithm can be applied on it. Maybe there should be more than 3 categories, I don't know. I googled some papers in financial field, and any more suggestions or references will be helpful. Ed On 4/29/05, bogdan romocea [EMAIL PROTECTED] wrote: Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Out of curiosity, how do you plan to use that information? What would you do if you knew that the 'body' starts here and ends there? -Original Message- From: WeiWei Shi [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 4:18 PM To: Huntsinger, Reid Cc: R-help@stat.math.ethz.ch Subject: Re: [R] have to point it out again: a distribution question Here is summary of l-qqnorm(kk) # kk is my sample l$y (which is my sample) l$x (which is therotical quantile) diff-l$y-l$x and summary(l$y) Min. 1st Qu. MedianMean 3rd Qu.Max. 0.9007 0.9942 0.9998 0. 1.0060 1.1070 summary(l$x) Min.1st Qu. Median Mean3rd Qu. Max. -4.145e+00 -6.745e-01 0.000e+00 2.383e-17 6.745e-01 4.145e+00 summary(diff) Min. 1st Qu. MedianMean 3rd Qu.Max. -3.0380 0.3311 0.9998 0. 1.6690 5.0460 Comparing diff with l$x, though the 1st Qu. and 3rd Qu. are different, diff and l$x seem similar to each other, which are proved by qqnorm(l$x) and qqnorm(diff). running the following codes: r-rnorm(1000)+1 # since my sample shift from zero to 1 qq(r[r0.9 r1.2]) # select the central part this gives me a straight line now. Thanks for the good explanation for the phenomena. Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Thanks again, Weiwei On 4/28/05, Huntsinger, Reid [EMAIL PROTECTED] wrote: Stock returns and other financial data have often found to be heavy-tailed. Even Cauchy distributions (without even a first absolute moment) have been entertained as models. Your qq function subtracts numbers on the scale of a normal (0,1) distribution from the input data. When the input data are scaled so that they are insignificant compared to 1, say, then you get essentially the theoretical quantiles ie the x component of the list back from l$x - l$y. l$x is basically a sample from a normal(0,1) distribution so they do line up perfectly in the second qqnorm(). Is that what's happening? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WeiWei Shi Sent: Thursday, April 28, 2005 1:38 PM To: Vincent ZOONEKYND Cc: R-help@stat.math.ethz.ch Subject: [R] have to point it out again: a distribution question Dear R-helpers: I pointed out my question last time but it is only partially solved. So I would like to point it out again since I think it is very interesting, at least to me. It is a question not about how to use R, instead it is a kind of therotical plus practical question, represented by R. I came with this question when I built model for some stock returns. That's the reason I cannot post the complete data here. But I would like to attach some plots here (I zipped them since the original ones are too big). The first plot qq1, is qqnorm plot of my sample, giving me some S-shape. Since I am not very experienced, I am not sure what kind of distribution my sample follows. The second plot, qq2, is obtained via qqnorm(rt(1, 4)) since I run fitdistr(kk, 't') and got m s df 9.998789e-01 7.663799e-03 3.759726e+00 (5.332631e-05) (5.411400e-05) (8.684956e-02) The second plot seems to say my sample distr follows t-distr. (not sure of this) BTW, what the commands for simulating other distr like log-norm, exponential, and so on? The third one was obtained by running the following R code: Suppose my data is read into dataset k from file f392.txt: k-read.table(f392.txt, header=F)# read into k kk-k[[1]] qq(kk) qq function is defined as below: qq-function(dataset){ l-qqnorm(dataset, plot.it=F) diff-l$y-l$x # difference b/w sample and it's therotical quantile qqnorm(diff) } The most interesting thing is (if there is not any stupid game here, and if my sample follows some kind of
RE: [R] generalized matrix product ?
Say you have a function FUN of two vector arguments which operates columnwise on arrays. E.g., if FUN(v,w) is to be the inner product, then instead of v%*%t(w) write something like colSums(v*w). Now you can do something like vectorOuterProd - function(A,B,FUN) { da - dim(A)[-1] na - prod(da) db - dim(B)[-1] nb - prod(db) result - matrix(nrow=na,ncol=nb) dim(B) - c(dim(B)[1],nb) for (j in 1:nb) { result[,j] - FUN(A,B[,j]) } dim(result) - c(da,db) result } which loops over the columns of B rather than replicate A and B as in outer() to save space. Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, April 29, 2005 2:24 PM To: r-help@stat.math.ethz.ch Subject: [R] generalized matrix product ? Is there available in R a generalized inner product or matrix product, similar to 'outer(x,y, fun)', where one can specifiy an arbitrary function in place of ordinary multiplication? Here's my application. I frequently analyze user questionnaires from our HR/training department. These have questions of the form please rate your skill in task X, and other questions of the form Have you taken course Y? (or How many years since you have taken course Y?) I look at rank correlation between the (suitably ordered) vectors of responses to a question in the first group and a question in the second group. (The two vectors have the same length, but I want to replace the standard inner product with a different operation; in this case, rank correlation) Repeat the process across all possible pairs of questions. Is there a way to accomplish this without nested 'for' statements? Hope this is clear - thanks! == George Heine, PhD Mathematical Analyst National IRM Center U.S. Bureau of Land Management voice (303) 236-0099 fax (303) 236-1974 cell (303) 905-5382 pager [EMAIL PROTECTED] ==t __ 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] have to point it out again: a distribution question
In general, I have been trying tree algorithms, which include many variates of course. I did some clustering (like EM, K-mean, K-median, etc). But since the original distr is not normal, IMHO, those methods might not work. Weiwei On 4/29/05, Huntsinger, Reid [EMAIL PROTECTED] wrote: There are many ways to discretize data. That's one way of looking at clustering (vector quantization). You might also look into modelling approaches which don't require it: splines, trees, etc. What sort of data mining are you trying to do? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WeiWei Shi Sent: Friday, April 29, 2005 3:22 PM To: bogdan romocea Cc: R-help@stat.math.ethz.ch Subject: Re: [R] have to point it out again: a distribution question discretization from continuous domain to categorical one so that some data mining algorithm can be applied on it. Maybe there should be more than 3 categories, I don't know. I googled some papers in financial field, and any more suggestions or references will be helpful. Ed On 4/29/05, bogdan romocea [EMAIL PROTECTED] wrote: Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Out of curiosity, how do you plan to use that information? What would you do if you knew that the 'body' starts here and ends there? -Original Message- From: WeiWei Shi [mailto:[EMAIL PROTECTED] Sent: Thursday, April 28, 2005 4:18 PM To: Huntsinger, Reid Cc: R-help@stat.math.ethz.ch Subject: Re: [R] have to point it out again: a distribution question Here is summary of l-qqnorm(kk) # kk is my sample l$y (which is my sample) l$x (which is therotical quantile) diff-l$y-l$x and summary(l$y) Min. 1st Qu. MedianMean 3rd Qu.Max. 0.9007 0.9942 0.9998 0. 1.0060 1.1070 summary(l$x) Min.1st Qu. Median Mean3rd Qu. Max. -4.145e+00 -6.745e-01 0.000e+00 2.383e-17 6.745e-01 4.145e+00 summary(diff) Min. 1st Qu. MedianMean 3rd Qu.Max. -3.0380 0.3311 0.9998 0. 1.6690 5.0460 Comparing diff with l$x, though the 1st Qu. and 3rd Qu. are different, diff and l$x seem similar to each other, which are proved by qqnorm(l$x) and qqnorm(diff). running the following codes: r-rnorm(1000)+1 # since my sample shift from zero to 1 qq(r[r0.9 r1.2]) # select the central part this gives me a straight line now. Thanks for the good explanation for the phenomena. Then, Reid, or other r-gurus, is there a good way to descritize the sample into 3 category: 2 tails and the body? Thanks again, Weiwei On 4/28/05, Huntsinger, Reid [EMAIL PROTECTED] wrote: Stock returns and other financial data have often found to be heavy-tailed. Even Cauchy distributions (without even a first absolute moment) have been entertained as models. Your qq function subtracts numbers on the scale of a normal (0,1) distribution from the input data. When the input data are scaled so that they are insignificant compared to 1, say, then you get essentially the theoretical quantiles ie the x component of the list back from l$x - l$y. l$x is basically a sample from a normal(0,1) distribution so they do line up perfectly in the second qqnorm(). Is that what's happening? Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of WeiWei Shi Sent: Thursday, April 28, 2005 1:38 PM To: Vincent ZOONEKYND Cc: R-help@stat.math.ethz.ch Subject: [R] have to point it out again: a distribution question Dear R-helpers: I pointed out my question last time but it is only partially solved. So I would like to point it out again since I think it is very interesting, at least to me. It is a question not about how to use R, instead it is a kind of therotical plus practical question, represented by R. I came with this question when I built model for some stock returns. That's the reason I cannot post the complete data here. But I would like to attach some plots here (I zipped them since the original ones are too big). The first plot qq1, is qqnorm plot of my sample, giving me some S-shape. Since I am not very experienced, I am not sure what kind of distribution my sample follows. The second plot, qq2, is obtained via qqnorm(rt(1, 4)) since I run fitdistr(kk, 't') and got m s df 9.998789e-01 7.663799e-03 3.759726e+00 (5.332631e-05) (5.411400e-05) (8.684956e-02) The second plot seems to say my sample distr follows t-distr. (not sure of this) BTW, what the commands for simulating other distr like log-norm, exponential, and so on? The third one was obtained by running the following R code: Suppose my data is read
RE: [R] R-2.1.0 search engine works with mozilla browser but notfirefox
On Fri, 2005-04-29 at 13:04 -0700, Waichler, Scott R wrote: I believe the problem is related to the change in the installation directory for the updated JVM from Sun. If you use the jre1.5.0_02 from java.sun.com, then the plugin is installed in: /usr/java/jre1.5.0_02/plugin/i386/ns7/libjavaplugin_oji.so Ok, the above pathname is the exact one. Yes, this is the one I used. I just downloaded the updated RPM binary installer from java.sun.com. A key step here is that you need to remove the old 1.5 version: rpm -e jre-1.5.0-fcs This is not installed on my machine. OK. That was just in case you have a prior version installed. Though you might want to check in /usr/java to be sure that there are no other versions present. With both versions installed, there appear to be conflicts. The new installer appears to use rpm -i rather than rpm -U, which leaves both versions in place. Testing at the site below with both versions installed fails. Once you have properly done the above, then go here: http://www.java.com/en/download/help/testvm.xml to test your java plug-in installation. Yes, this test page works fine in my Firefox, and about:plugins shows the Java stuff is present and enabled. And the boxes under Preferences are checked. Java is working in my Firefox, but there is something about the R search engine it doesn't like. Just to be really clear, this is the page that appears, but the links and search box inside it don't work: file:///tmp/RtmpB32234/.R/doc/html/search/SearchEngine.html That is correct. R uses dynamically created pages, which will be in /tmp. Scott, do you have a lot of CRAN/BioC packages installed? If the list of your installed packages is not overly long, why don't you post it back here, or if it is, send it to me offlist. I am wondering if there is an installed package causing problems for the search engine. I am not sure of other possible issues. I did find that there seems to be at least four CRAN packages: 1. PHYLOGR 2. sfsmisc 3. survrec 4. vardiag that seem to have problems with UTF-8 locales. If I run help.start() in my default locale of en_US.UTF-8, I get the following for each of the above packages: help.start() Making links in per-session dir ... Error in gsub(pattern, replacement, x, ignore.case, extended, fixed) : input string 28 is invalid in this locale The number of the input string does change. I believe that the above error occurs within make.packages.html(). If I change to LANG=C, the above packages do not cause problems, so perhaps they need to be updated for R 2.1.0. I'll drop a separate e-mail to each of the package authors above. Marc __ 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] Windows List of Folders?
For windows, how can I list only the folders in some folder? I was thinking that dir() and file.info() with isdir==TRUE being something that might work. These folders or directories are numerically named with no dot extension names or other characters. Typically, these are 3132, 3334, ... Here is what I tried. The last line is where I need more work. pData=C:/Myfiles/R/Data/ setwd (pData) x - dir(pData, all.files=F) y - file.info(x, x$isdir==T) TIA Kenneth Ray Hobson, P.E. Oklahoma DOT - QA IAS Manager 200 N.E. 21st Street Oklahoma City, OK 73105-3204 __ 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] Snow sockets
Greetings all. I am trying to run some stuff using the SNOW library on RH EL3 intel x86_64 and I am running into this error: Error in unserialize(node$con) : error reading from connection I am using sockets (not preferred but I can't seem to get rpvm or Rmpi either one to work on x86_64 for different reasons) and it seems to work well when the jobs are small, but it seems that they are timing out after only a short while if the work takes longer than a couple of minutes. Is there a way to adjust the timeout for the socket without doing so in the snow source (which I am not entirely comfortable with)? J. Cowan Yale University School of Medicine Core Tissue Microarray Facility 310 Cedar St., PO Box 208023 New Haven, CT 06520-8023 ph 203-785-6532 email: [EMAIL PROTECTED] /**/ To understand recursion, one must first understand recursion. Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them you're a mile away and you have their shoes. // __ 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] na.action
Hi, I had the following code: testp - rcorr(t(datcm1),type = pearson) mat1 - testp[[1]][,] 0.6 mat2 - testp[[3]][,] 0.05 mat3 - mat1 + mat2 The resulting mat3 (smaller version) matrix looks like: NA 000 0 NA0 NA 0 0 NA2 0 02 NA To get to the number of times a '2' appears in the rows, I was trying to run the following code: numrow = nrow(mat3) counter - matrix(nrow = numrow,ncol =1) for(i in 1:numrow){ count = 0; for(j in 1:numrow){ if(mat3[i,j] == 2){ count = count + 1 } } counter[i,1] = count } However, I get the following error: 'Error in if (mat3[i, j] == 2) { : missing value where TRUE/FALSE needed' I also tried to use the na.action, but couldn't get anything. I'm sure there must be a relatively easy fix to this. Is there a workaround this problem? thanks, Tim __ [[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] log-rank when var 5 and power
I would like to determine whether there's a difference between survival data for two groups. I have been using the survival package and survdiff() with rho=0 and rho=1. Survdiff() with rho=0 is a non-continuity-corrected version of the log-rank test set forth in Fundamentals of Biostatistics by Bernard Rosner. On page 722 of the 5th edition, Rosner states, This test should be used only if Var_LR = 5. For my data with rho=0 or rho=1, survdiff()$var[1,1] is much less than 5. Can anyone suggest what to do in this case? Also, can anyone suggest a reference or software for doing power calculations regarding tests for difference between survival data for two groups. Thanks very much. -Ben __ 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] na.action
Maybe this does what you want: x - as.matrix(read.table(clipboard)) x V1 V2 V3 V4 1 NA 0 0 0 2 0 NA 0 NA 3 0 0 NA 2 4 0 0 2 NA rowSums(x==2, na.rm=T) 1 2 3 4 0 0 1 1 There's probably at least 5 or 6 other quite sensible ways of doing this, but this is probably the fastest (and the least versatile). A more general building block is the sum() function, as in: sum(x[3,]==2, na.rm=T) [1] 1 The key is the use of the 'na.rm=T' argument value. hope this helps, Tony Plate Tim Smith wrote: Hi, I had the following code: testp - rcorr(t(datcm1),type = pearson) mat1 - testp[[1]][,] 0.6 mat2 - testp[[3]][,] 0.05 mat3 - mat1 + mat2 The resulting mat3 (smaller version) matrix looks like: NA 000 0 NA0 NA 0 0 NA2 0 02 NA To get to the number of times a '2' appears in the rows, I was trying to run the following code: numrow = nrow(mat3) counter - matrix(nrow = numrow,ncol =1) for(i in 1:numrow){ count = 0; for(j in 1:numrow){ if(mat3[i,j] == 2){ count = count + 1 } } counter[i,1] = count } However, I get the following error: 'Error in if (mat3[i, j] == 2) { : missing value where TRUE/FALSE needed' I also tried to use the na.action, but couldn't get anything. I'm sure there must be a relatively easy fix to this. Is there a workaround this problem? thanks, Tim __ [[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
Re: [R] grid and ps device (bg-color)
Hi mkondrin wrote: Hello! Is it a bug or something? When I try to draw a grid-graphics on ps output background color is always transparent (with standard plot(...) this is not the case - the background is filled with ps.options()$bg color). What's wrong? Drawing a background grid.rect does not help - there is always small transparent margains along picture frame. Can this be fixed (I use R-2.0.1)? Yes, it's a bug. Grid does not take appropriate notice of some important initial device settings. A fix is on my todo list. In the meantime, is the following workaround adequate (draw a filled rectangle much larger than the device)? grid.rect(width=2, height=2, gp=gpar(fill=ps.options()$bg.color)) Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ 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] R2.1.0: X11 font at size 14 could not be loaded
Hi, Many thanks to Prof. Ripley, Peter Dalgaard, and Patrick Connolly for responding to my message. I tried several things, but the problem still exists. [1] I tried Version 2.1.0 (2005-04-18), Version 2.1.0 Patched (2005-04-20), and Version 2.1.0 Patched (2005-04-28) Compiled with/without option --disable-mbcs (and/or --disable-nls), the result is the same: hist(rnorm(100)) Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) : X11 font at size 14 could not be loaded Interesting, plot(rnorm(100)) works just fine. [2] Using YaST, I installed XFree86-fonts-100dpi - 100dpi Bitmaps fonts for X11 which originally was not there, but still have the same error. As stated previously, this error does not occur with R2.0.1 on the same machine. Any clue re what could be wrong with my setting? For my purpose, R2.0.1 is sufficient, but it would be nice to get this problem solved. Thanks and have a good weekend. Xiang-Jun On Fri, 29 Apr 2005, Prof Brian Ripley wrote: On Fri, 29 Apr 2005, Patrick Connolly wrote: On Thu, 28-Apr-2005 at 05:25PM -0400, Xiang-Jun Lu wrote: | Hi, | | I have just noticed the following problem with R2.1.0 running on SuSE 9.1, | [However, version 2.0.1 (2004-11-15) on the same machine works Okay]: | | - | hist(rnorm(100)) | Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) : | X11 font at size 14 could not be loaded | version | _ | platform i686-pc-linux-gnu | arch i686 | os linux-gnu | system i686, linux-gnu | status Patched | major2 | minor1.0 | year 2005 | month04 | day 20 | language R | - | | Any insight? Works fine with mine. version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R Something to do with the patch, perhaps? There is no patch on the X11 device. The dpi of the screen does come into this. It is quite possible that 2.0.1 failed to scale for the screen dpi and so was using the wrong set of fonts (it used 75dpi unless the screen was 100+/-0.5 dpi). So I think PD was correct: this does indicate a problem in the installed fonts: perhaps the 100dpi set is missing. -- 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] Windows list of Folders
Hi Kenneth: I tried: list.files(path=c:\\pctexv4\\samples) and that worked just fine. Hope this helps! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] From: [EMAIL PROTECTED] Subject: [R] Windows List of Folders? X-BeenThere: r-help@stat.math.ethz.ch For windows, how can I list only the folders in some folder? I was thinking that dir() and file.info() with isdir==TRUE being something that might work. These folders or directories are numerically named with no dot extension names or other characters. Typically, these are 3132, 3334, ... Here is what I tried. The last line is where I need more work. pData=C:/Myfiles/R/Data/ setwd (pData) x - dir(pData, all.files=F) y - file.info(x, x$isdir==T) TIA Kenneth Ray Hobson, P.E. Oklahoma DOT - QA IAS Manager 200 N.E. 21st Street Oklahoma City, OK 73105-3204 __ 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] Windows List of Folders?
Example: path - system.file(package=base) pathnames - list.files(path, full.names=TRUE) isDir - file.info(pathnames)$isdir dirs - pathnames[isDir] files - pathnames[!isDir] If you don't get the 'isDir' line, think of it as infos - file.info(pathnames) isDir - infos$isdir /Henrik [EMAIL PROTECTED] wrote: For windows, how can I list only the folders in some folder? I was thinking that dir() and file.info() with isdir==TRUE being something that might work. These folders or directories are numerically named with no dot extension names or other characters. Typically, these are 3132, 3334, ... Here is what I tried. The last line is where I need more work. pData=C:/Myfiles/R/Data/ setwd (pData) x - dir(pData, all.files=F) y - file.info(x, x$isdir==T) TIA Kenneth Ray Hobson, P.E. Oklahoma DOT - QA IAS Manager 200 N.E. 21st Street Oklahoma City, OK 73105-3204 __ 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] generalized matrix product ?
On 4/29/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Is there available in R a generalized inner product or matrix product, similar to 'outer(x,y, fun)', where one can specifiy an arbitrary function in place of ordinary multiplication? Here's my application. I frequently analyze user questionnaires from our HR/training department. These have questions of the form please rate your skill in task X, and other questions of the form Have you taken course Y? (or How many years since you have taken course Y?) I look at rank correlation between the (suitably ordered) vectors of responses to a question in the first group and a question in the second group. (The two vectors have the same length, but I want to replace the standard inner product with a different operation; in this case, rank correlation) Repeat the process across all possible pairs of questions. Is there a way to accomplish this without nested 'for' statements? Try this: inner - function(a,b,f, ...) { f - match.fun(f) apply(b,2,function(x)apply(a,1,function(y)f(x,y, ...))) } data(iris); irish - head(iris)[,-5] # test data res - inner(t(irish), irish, cor, method = spearman) # test res2 - cor(irish, method = spearman) # should give same result identical(res, res2) # TRUE __ 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] R2.1.0: X11 font at size 14 could not be loaded
Xiang-Jun Lu [EMAIL PROTECTED] writes: [2] Using YaST, I installed XFree86-fonts-100dpi - 100dpi Bitmaps fonts for X11 which originally was not there, but still have the same error. Did you restart the X server after the font installation? FWIW: I'm seeing the same font size error as you've reported on SuSE 9.2 with R patched. The 100dpi x.org fonts were not installed. I haven't had time to try this fix yet. + seth __ 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] lmer for mixed effects modeling of a loglinear model
I have a dataset with 25 subjects and 25 items. For each subject-item combination, there's a 0/1 score for two parts, A and B. I'm thinking of this as a set of 2 x 2 tables, 25 x 25 of them. I'd like to fit a log-linear model to this data to test the independence of the A and B scores. If I ignore the subject and item parts, the following works just fine: glm(count ~ A * B, family = poisson, data =llform.df) However, there's variability in the success probability by both item and subject. There are difficult items (for both parts A and B jointly) and there are proficient subjects (for A and B jointly). I would like to include these as random effects, and since I don't want a separate effect for A and for B, I created a new variable AB = I(A + B), representing the additive effect of A and B. I then tried lmer(count ~ A * B + (AB - 1 | item) + (AB - 1 | subj), family = poisson, data = llform.df) The lmer function (from the lme4 package) only detects a portion of the variance due to item and subject, and finds a highly significant AxB interaction effect that is really only due to the situation that good subjects with easy items tend to get both A and B right and so forth. I'm not sure whether I'm modeling this wrong in lmer, I'm thinking about this wrong, or I'm asking too much (or any subset of the above), but I'd be grateful for any advice. Below I given a few sample lines of the dataframe, as well as the code I used to generate it. Thanks, Steve Start of dataframe: item subj A B AB count 1 11 0 0 0 FALSE 110011 0 1 1 FALSE 110211 1 0 1 FALSE 110411 1 1 2 TRUE 2 12 0 0 0 FALSE 210012 0 1 1 FALSE 210212 1 0 1 FALSE 210412 1 1 2 TRUE 3 13 0 0 0 FALSE 310013 0 1 1 FALSE 310213 1 0 1 FALSE 310413 1 1 2 TRUE Code to generate it: test.df - data.frame(item = gl(25, 25), subj = gl(25, 1, 625)) test.df$item.level - with(test.df, rnorm(25, sd = 1)[item]) test.df$subj.level - with(test.df, rnorm(25, sd = 1)[subj]) test.df$Atemp - as.numeric(with(test.df, runif(625) 1/(1 + exp(-item.level + subj.level test.df$Btemp - as.numeric(with(test.df, runif(625) 1/(1 + exp(-item.level + subj.level llform.df - rbind(test.df, test.df, test.df, test.df) llform.df$A - rep(0:1, each = 625 * 2) llform.df$B - rep(0:1, each = 625, times = 2) llform.df$AB - apply(llform.df[,7:8], 1, sum) llform.df$count - with(llform.df, A == Atemp B == Btemp) llform.df - llform.df[order(llform.df$item, llform.df$subj),] platform powerpc-apple-darwin7.9.0 arch powerpc os darwin7.9.0 system powerpc, darwin7.9.0 status major2 minor1.0 year 2005 month04 day 18 language R __ 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] Warning from Rcmd check - data could not find data set
This is rw2010 from CRAN. When running Rcmd check on a package I get: Warning in utils::data(list = al, envir = data_env) : data set 'vowel.test' not found Warning in utils::data(list = al, envir = data_env) : data set 'vowel.train' not found Warning in utils::data(list = al, envir = data_env) : data set 'waveform.test' not found Warning in utils::data(list = al, envir = data_env) : data set 'waveform.train' not found However, I have no problem with this when using the package. This datasets are loaded, multiple datasets at a time, under another name. data(vowel) loads the two first in the list above. Could it be this (which should be allowed, is mentioned in writing R extensions) or is it something else, or a bug? Kjetil -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus. __ 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] ATTEND TO THIS
Dear Friend, Greetings! For this letter is strictly personal, intimate and confidential. Forgive this unusual manner of contacting you, but this particular letter is of exceptional and very private nature. There is absolutely going to be a great doubt and distrust in your heart in respect of this email, coupled with the fact that, so many miscreants have taken possession of the Internet to facilitate their nefarious deeds, thereby making it extremely difficult for genuine people to get attention and recognition. There is no way for me to know whether I will be properly understood, but it is my duty to write and reach out to you. For I believe that you are the only one that can be trusted to handle this project effectively without making us regret. The recommendation I got concerning you, is enough to get us started with you! I head a four-man committee on debt reconciliation at the Ministry of Works, where I am also a Director of Project Implementation. In recent past, we have carefully arranged a contract with a foreign firm, in which the cost was over-invoiced deliberately to favour us. Now, we want to get the funds out of the Apex bank into your provided account within one week from now, and a percentage (20%) will be given to you for your assistance and efforts. The amount we are about transferring is totalled at US$13,731 million. Also, there is the need for you to know that, we shall be sending you the mandatory $89,000.00 that will be requested of you by the Apex bank, as handling charges precedent to releasing the funds into your account, so there are absolutely no bills to be paid by you in the course of the transfer. Note however that it is only on the condition that you have an account domiciled in the United States or any european country that is when we shall make the funds available to you. Our financier is only prepared to release funds to the US and european only. All we need from you now is s concrete mailing address, to enable us send via courier money orders or cashier check in the amount of $89,000.00, which you shall use in settling the bills as they come. We have set aside funds to offset whatever bills that may crop up in the event of transfer. You will certainly ask yourself how consequential this letter is. Indeed, is it not surprising to receive such a letter seeking immediate assistance? This is why today I am making you a non-binding, unrestricted offer, to bring us close into mutual understanding and cooperation now, and in the near future. Trust is definitely the most noble trait in the world, and I urge you to trust my sincerity and the word of a simple and humble person of faith, who in the name of love for her equals is willing to accomplish the task of doing business with a trusted and transparent person. It is up to you to decide whether this letter deserves your trust and confidentiality. And if indeed it does, send me the following: 1. Your letter of consent. 2. Your mailing and contact address. 3. Your telephone numbers. Upon receipt of the above, I shall communicate with you, and let you know the details of the transfer. Whatever your actions and your decision, I thank you for taking the time to read my email. You can send your response to my private email address:[EMAIL PROTECTED] Best personal regards. Engr Willian Douglas __ 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] How to extract function arguments literally
Dear all, One of my friends asked me if it is possible to extract actual R function arguments literally (precisely, as strings). The reason is simple. He feels sometimes awkward to attach quotation marks :-). What he actually wants is to pass R command arguments to XLisp subroutines (He has been an enthusiastic XLisp user for a long time and still tends to use R as a wrapper to XLisp). Is it possible, or should I advise him not to be so lazy? The following is his simple example to explain the situation. R function lc which passes its argument to an Xlisp function: lc=function(cmd){ cmd=as.character(substitute(cmd)) .XLisp(lcommand, cmd)} Corresponding XLisp function lcommand: (defun lcommand (str) (eval (with-input-from-string (s str) (read s If the argument cmd is a string (i.e. with quotation marks) or has no space, it works fine. as.character(substitute(abc)) [1] abc But, if it has no quotation marks or contains spaces, it yileds an error. as.character(substitute((def x1 x2)) Error: syntax error He wants to use the syntax like lc((def x1 x2)), not like lc((def x1 x2)). Thanks in advance. == Shigeru MASE [EMAIL PROTECTED] Tokyo Institute of Technology Dept. of Math. and Comp. Sciences O-Okayama 2-12-1-W8-28, Tokyo, 152-8550, Japan __ 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] Windows List of Folders?
Henrik, thanks! Your example worked fine. Listed below is a sample of what I used and the output. path - C:/MyFiles/Approach/OMRL/Data/ pathnames - list.files(path, full.names=F) isDir - file.info(pathnames)$isdir isDir [1] TRUE TRUE TRUE FALSE FALSE FALSE FALSE dirs - pathnames[isDir] dirs [1] 3334 d1 NotUsedTemplates files - pathnames[!isDir] files [1] O.zipSample21.adx Sample21.apr Sample21.dbf [[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] How to extract function arguments literally
instead of as.character(substitute(arg)) use deparse(substitute(arg)) : -Original Message- : From: [EMAIL PROTECTED] : [mailto:[EMAIL PROTECTED] On Behalf Of Shigeru Mase : Sent: Saturday, 30 April 2005 1:24 PM : To: r-help@stat.math.ethz.ch : Subject: [R] How to extract function arguments literally : : : Dear all, : : One of my friends asked me if it is possible to extract actual R : function arguments literally (precisely, as strings). The reason is : simple. He feels sometimes awkward to attach quotation marks :-). What : he actually wants is to pass R command arguments to XLisp subroutines : (He has been an enthusiastic XLisp user for a long time and : still tends : to use R as a wrapper to XLisp). Is it possible, or should I : advise him : not to be so lazy? The following is his simple example to explain the : situation. : : R function lc which passes its argument to an Xlisp function: : : lc=function(cmd){ : cmd=as.character(substitute(cmd)) : .XLisp(lcommand, cmd)} : : Corresponding XLisp function lcommand: : : (defun lcommand (str) (eval (with-input-from-string (s str) : (read s : : If the argument cmd is a string (i.e. with quotation marks) or has no : space, it works fine. : : as.character(substitute(abc)) : [1] abc : : But, if it has no quotation marks or contains spaces, it : yileds an error. : : as.character(substitute((def x1 x2)) : : Error: syntax error : : He wants to use the syntax like lc((def x1 x2)), not like : lc((def x1 x2)). : : Thanks in advance. : : == : Shigeru MASE [EMAIL PROTECTED] : Tokyo Institute of Technology : Dept. of Math. and Comp. Sciences : O-Okayama 2-12-1-W8-28, Tokyo, 152-8550, Japan : : __ : 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] R-2.1.0 search engine works with mozilla browser but notfirefox
On Fri, 29 Apr 2005, Marc Schwartz wrote: On Fri, 2005-04-29 at 13:04 -0700, Waichler, Scott R wrote: I did find that there seems to be at least four CRAN packages: 1. PHYLOGR 2. sfsmisc 3. survrec 4. vardiag that seem to have problems with UTF-8 locales. If I run help.start() in my default locale of en_US.UTF-8, I get the following for each of the above packages: help.start() Making links in per-session dir ... Error in gsub(pattern, replacement, x, ignore.case, extended, fixed) : input string 28 is invalid in this locale The number of the input string does change. I believe that the above error occurs within make.packages.html(). If I change to LANG=C, the above packages do not cause problems, so perhaps they need to be updated for R 2.1.0. I'll drop a separate e-mail to each of the package authors above. They have non-ASCII titles in their help files. This issue is resolved for R-patched: o make.packages.html() called by help.start() was failing if there were installed packages with titles invalid in the current locale. However, there are further layers of incompatibility, and those will be dealt with in 2.2.x, as far as possible (there is no way to display German in a Chinese locale on Windows 98, for example). -- 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