[R] Danish characters i R2.0.1 vs R1.9.1 under winXP
Sorry for not reporting earlier, but the same problem exists with Swedish verisons of Windows XP together with R 2.0.0 patched (but not with R 1.9.1) and the last characters in our alphabet. "ä" [1] "\344" "ö" [1] "\366" "å" [1] "å" "Ö" [1] "\326" "Ä" [1] "\304" "Å" [1] "\305" Hans Gardfjell Ecology and Environmental science Umeå University, Sweden The problem is in your OS, which thinks the character \370 is not printable in your locale. Apparently this is a WinXP problem, for it also thinks \366 is not printable in German (and other versions of Windows thinks it is). (Uwe Ligges pointed that out a few hours ago.) R 1.9.1 did not check, and so made a mess of trying to print non-printable characters, in particular nuls and control characters. There is no simple workaround, as you do want octal representation for non-printable characters (e.g. embedded nuls). What I have proposed is that we override Windows' view for upper (>= 0x80) characters. It does not seem to be common: the only reports before today were for Chinese, which is not expected to work. On Mon, 22 Nov 2004, Ladelund, Steen wrote: / Hi all. />>/ />>/ After upgrading to R2.0.1 i get />>/ />>>/ "æ" />>/ [1] "æ" />>>/ "ø" />>/ [1] "\370" />>>/ "å" />>/ [1] "å" />>/ />>/ Whereas under R1.9.1 i get />>/ />>>/ "æ" />>/ [1] "æ" />>>/ "ø" />>/ [1] "ø" />>>/ "å" />>/ [1] "å" />>/ />>/ Any hints apreciated. />>/ />>/ Steen />>/ />>/ Steen Ladelund, statistician />>/ +4543233275 stelad01.FUNNYAglostruphospDOTkbhamt.dk />>/ Research Center for Prevention and Health />>/ Glostrup University Hospital, Denmark />>/ www.fcfs.kbhamt.dk />>/ />>/ __ />>/ R-help at stat.math.ethz.ch <https://stat.ethz.ch/mailman/listinfo/r-help> 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, ripley at stats.ox.ac.uk <https://stat.ethz.ch/mailman/listinfo/r-help> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ <http://www.stats.ox.ac.uk/%7Eripley/> University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] 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] Filled triangles in lattice graphics?
Dear R users, I can get a filled triangle pointing upwards by specifying pch=17 in xyplot or lpoints, but how do I get a filled triangle that points downwards? In the standard plot function it's possible to use plot(x,y,pch=25,bg="black"), but bg= doesn't seem to work with lattice and lpoints. Thanks, Hans Gardfjell Ecology and Environmental Science Umeå University, Sweden __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Fw: [R] SIMCA algorithm implementation
/ Dear All />/ Is there a SIMCA (Soft Independent Modelling Class Analogy) implementation />/ on R or does anyone know if is it possible to replicate the SIMCA /algorithm / using existing R functions? />/ />/ Thanks />/ Mike White />/ / I haven't seen any implementation in R, but check out the 'chemiometrics' home page here at Umeå University, http://www.acc.umu.se/%7Etnkjtg/chemometrics/publications.html Hans Gardfjell Dept of Ecology and Environmental science Umeå University, Sweden __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R on kubuntu
Dear R users, It's possible to install newer versions of R from the Ubuntu depositories, but the new version of R can only be found in 'breezy', the 'unstable' version of Ubuntu. You can however create a mixed system with most of your packages from the old 'hoary' and only some (like R) from the unstable 'breezy' by using the pinning mechanism in apt-get. Check out the instructions on pinning in the Ubuntu wiki: https://wiki.ubuntu.com/PinningHowto?highlight=%28apt-get+-t%29 In short it works like this: 1. Put in links to other depositories in /etc/apt/sources.list 2. Set the pinning priorities in /etc/apt/preferences 3. Install newer R-base with "apt-get -t breezy install r-base" Cheers, Hans Gardfjell Dept. of Ecology and Environmental Science Umeå University, Sweden >Hello all, > >I am planning to redeploy my workstation under KUBUNTU. > >Does any body has any r experience installing/using r on this platform? > >Best regards. > > >-- >Constant Depièreux >Managing Director >Applied QUality Technologies Europe sprl >Rue des Déportés 123, B-4800 Verviers >(Tel) +32 87 292175 - (Fax) +32 87 292171 - (Mobile) +32 475 555 818 >(Web) http://www.aqte.be - (Courriel) constant.depiereux at aqte.be <https://stat.ethz.ch/mailman/listinfo/r-help> >(Skype) cdepiereux __ 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 do I "relate" tables in R?
?merge -- * Hans Gardfjell Ecology and Environmental Science Umeå University 90187 Umeå, Sweden email: [EMAIL PROTECTED] phone: +46 907865267 mobile: +46 705984464 __ 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] aggregate vs tapply; is there a middle ground?
I faced a similar problem. Here's what I did tmp <- data.frame(A=sample(LETTERS[1:5],10,replace=T),B=sample(letters[1:5],10,replace=T),C=rnorm(10)) tmp1 <- with(tmp,aggregate(C,list(A=A,B=B),sum)) tmp2 <- expand.grid(A=sort(unique(tmp$A)),B=sort(unique(tmp$B))) merge(tmp2,tmp1,all.x=T) At least fewer than 10 extra lines of code. Anyone with a simpler solution? Cheers, Hans lebouton wrote: > >Dear all, > >I'm wanting to do a series of comparisons among 4 categorical variables: > >a <- aggregate(y, list(var1, var2, var3, var4), sum) > >This gets me a very nice 2-dimensional data frame with one column per >variable, BUT, as help for aggregate says, <removed>>. I don't see in help(aggregate) how I can change this. > >In contrast, >a <- tapply(y, list(var1, var2, var3, var4), sum) > >gives me results for everything including empty subsets, but in an >awkward 4-dimensional array that takes me another 10 lines of >inefficient code to turn into a 2D data.frame. > >Is there a way to directly do this calculation INCLUDING results for >empty subsets, and still obtain a 2D array, matrix, or data.frame? OR >alternatively is there a simple way to mush the 4D result from the >tapply into a 2D matrix/data.frame? > >thanks very much in advance for any help! > >-jlb > >-- > >Joseph P. LeBouton >Forest Ecology PhD Candidate >Department of Forestry >Michigan State University >East Lansing, Michigan 48824 > >Office phone: 517-355-7744 >email: lebouton at msu.edu <https://stat.ethz.ch/mailman/listinfo/r-help> -- * Hans Gardfjell Ecology and Environmental Science Umeå University 90187 Umeå, Sweden email: [EMAIL PROTECTED] phone: +46 907865267 mobile: +46 705984464 __ 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] aggregate vs tapply; is there a middle ground?
Thanks Peter! I had a "feeling" that there must be a simpler, better, more elegant solution. /Hans Peter Dalgaard wrote: > hadley wickham <[EMAIL PROTECTED]> writes: > > >>> I faced a similar problem. Here's what I did >>> >>> tmp <- >>> data.frame(A=sample(LETTERS[1:5],10,replace=T),B=sample(letters[1:5],10,replace=T),C=rnorm(10)) >>> tmp1 <- with(tmp,aggregate(C,list(A=A,B=B),sum)) >>> tmp2 <- expand.grid(A=sort(unique(tmp$A)),B=sort(unique(tmp$B))) >>> merge(tmp2,tmp1,all.x=T) >>> >>> At least fewer than 10 extra lines of code. Anyone with a simpler solution? >>> >> Well, you can almost do this in with the reshape package: >> >> tmp <- >> data.frame(A=sample(LETTERS[1:5],10,replace=T),B=sample(letters[1:5],10,replace=T),C=rnorm(10)) >> a <- recast(tmp, A + B ~ ., sum) >> # see also recast(tmp, A ~ B, sum) >> add.all.combinations(a, row="A", cols = "B") >> >> Where add.all.combinations basically does what you outlined above -- >> it would be easy enough to generalise to multiple dimensions. >> > > Anything wrong with > > >> as.data.frame(with(tmp,as.table(tapply(C,list(A=A,B=B),sum >> >A B Freq > 1 A a NA > 2 B a -0.2524320 > 3 C a 3.8539264 > 4 D a NA > 5 A c 0.7227294 > 6 B c -0.2694669 > 7 C c 0.4760957 > 8 D c NA > 9 A e NA > 10 B e 0.1800500 > 11 C e NA > 12 D e -1.0350928 > > (except the silly colname, responseName="sum" should fix that). > > -- * Hans Gardfjell Ecology and Environmental Science Umeå University 90187 Umeå, Sweden email: [EMAIL PROTECTED] phone: +46 907865267 mobile: +46 705984464 __ 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] Constructing a transition matrix
If you order your factor levels in your vectors in the order you want in the output, then the prop.table(prop()) command will give you what you want. But you have to reorder the factor levels so that the levels commands give the following output: >levels(trans$class) [1] "seed" "veg" "repr" >levels(trans$fate) [1] "seed" "veg" "repr" "dead" That means that you need to include "seed" as a factor level in fate (even if that level is unused). The prop.table(table()) command will then produce a 3 by 4 table. Remove the last row (that contains the proportion dead), and your set. Hans Gardfjell Dept of Ecology and Environmental science Umeå University, Sweden Chris Stubben wrote: Hi again, I almost figured this out, but still need some help on the last part. I can use prop.table to get survival probabilities... A <- t(prop.table( table(trans$class, trans$fate),1) ) rep seed veg dead 0.000 0.333 0.000 rep 0.500 0.000 1.000 veg 0.500 0.667 0.000 so now I just need to format the matrix. I thought I could create a matrix of zeroes using size class names, dev<- c("seed","veg", "rep"). A0<-matrix(numeric(9), nrow=3, dimnames=list(dev,dev) ) seed veg rep seed 0 0 0 veg 0 0 0 rep 0 0 0 but how do I assign values in A to the corresponding rows and columns in A0? I hope there is an easy solution that I'm overlooking. seed veg rep seed 0 0 0 veg 0.67 0 0.5 rep 0 1 0.5 Thanks, Chris Chris Stubben wrote: >/ Hi, />/ />/ I would like to construct a transition matrix from a data frame with />/ annual transitions of marked plants. />/ />/ plant<-c(1:6) />/ class<-c("seed","seed", "seed", "veg", "rep", "rep") />/ fate<-c("dead", "veg","veg","rep", "rep", "veg") />/ />/ trans<-data.frame(plant, class, fate) />/ />/ plant class fate />/ 1 1 seed dead />/ 2 2 seed veg />/ 3 3 seed veg />/ 4 4 veg rep />/ 5 5 rep rep />/ 6 6 rep veg />/ />/ I have been using sql queries to do this, but I would like to construct />/ the matrix in R since I plan to resample transitions using />/ trans[sample(nrow(trans), 6, replace=T), ] />/ />/ I know I can get the original size vector using table() />/ />/ data.matrix(table(trans$class)) />/ [,1] />/ rep 2 />/ seed 3 />/ veg 1 />/ />/ />/ but I don't know how to get counts of each class-fate combination where />/ fate does NOT equal dead />/ />/ seed veg = 2 />/ veg rep = 1 />/ rep rep = 1 />/ rep veg = 1 />/ />/ />/ or how to divide the class-fate count by the original class count in the />/ size vector to get survival probabilities />/ />/ seed veg = 2 / 3 seed = 0.67 />/ veg rep = 1 / 1 veg = 1 />/ rep rep = 1 / 2 rep = 0.5 />/ rep veg = 1 / 2 rep = 0.5 />/ />/ />/ or construct the square matrix with rows and columns in the same />/ developmental sequence like dev<- c("seed","veg", "rep"). />/ />/ seed veg rep />/ seed 0 0 0 />/ veg 0.67 0 0.5 />/ rep 0 1 0.5 />/ />/ Any help or suggestions would be appreciated. />/ Thanks, />/ />/ />/ Chris Stubben />/ />/ />/ -- />/ Los Alamos National Lab />/ BioScience Division />/ MS M888 />/ Los Alamos, NM 87545 />/ />/ /> __ 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] Labeling a range of bars in barplot?
Is this what you want... op<-par(xpd=TRUE) segments(0,-1,20,-1,col=2) text(10,-1,"Interval",pos=1) Cheers, Hans Gardfjell Dept. of Ecology and Environmental science Umeå University, Sweden Dan Bolser wrote: Hi, I am plotting a distribution of (ordered) values as a barplot. I would like to label groups of bars together to highlight aspects of the distribution. The label for the group should be the range of values in those bars. As this is hard to describe, here is an example; x <- rlnorm(50)*2 barplot(sort(x,decreasing=T)) y <- quantile(x, seq(0, 1, 0.2)) y plot(diff(y)) That last plot is to highlight that I want to label lots of the small columns together, and have a few more labels for the bigger columns (more densely labeled). I guess I will have to turn out my own labels using low level plotting functions, but I am stumped as to how to perform the calculation for label placement. I imagine drawing several line segments, one for each group of bars to be labeled together, and putting the range under each line segment as the label. Each line segment will sit under the group of bars that it covers. Thanks for any help with the above! Cheers, Dan. __ 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] Environment problems
Dear list readers, Can someone of you explain this behavior. Here's a toy example: Start by constructing a function tmp >fix(tmp) In the default editor enter this one-liner: hist(rnorm(10)) close the editor and run environment on the function. > environment(tmp) Open the editor and remove the last parenthesis, this will make the editor choke. > fix(tmp) Error in edit(name, file, title, editor) : an error occurred on line 4 use a command like x <- edit() to recover Put the paranthesis back: > edit()->tmp > environment(tmp) > tmp() Error in tmp() : could not find function "hist" And as you can see, the function doesn't work anymore... Yes, I know I can manually change the environment back to .GlobalEnv, but is this the way it supposed to work? This example is done in > R.Version()$version.string [1] "Version 2.3.0 Patched (2006-04-25 r37924)" on WindowsXP Cheers, Hans -- * Hans Gardfjell Ecology and Environmental Science Umeå University 90187 Umeå, Sweden email: [EMAIL PROTECTED] phone: +46 907865267 mobile: +46 705984464 __ 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] Plotting female and male signs
Dear R-users, Just like other users (as seen from previous posts on the list), I would like to use female and male signs in plots. I found B. Ripley's post about using Unicode characters. However, it doesn't works for me. > text(locator(1),"\u2640") produces the following error: Error: invalid \u sequence But I can specify other Unicode characters as long I don't exceed 00FF, so this works > text(locator(1),"\u00FF") or > text(locator(1),"\u00E6") and also without preceeding 00 > text(locator(1),"\uE6") Can someone give me a hint? I'm using a Swedish locale on WindowsXP and my R version is 2.3.1 Patched (2006-06-04 r38279) Thanks, Hans Gardfjell -- * Hans Gardfjell Ecology and Environmental Science Umeå University 90187 Umeå, Sweden email: hans.gardfjell at emg.umu.se phone: +46 907865267 mobile: +46 705984464 __ 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