[R] Placing the legend 'dynamically'

2010-03-10 Thread T . Wunder
Hello, does anybody know which command to consider when I'm trying to plot a stacked barplot with a legend at the most empty portion of the graphic? I've searched for it, and somebody stated to use the labcurve-command, but I don't know how to produce stacked barplots with it. Is there any po

Re: [R] [SOLVED] file reading /problems with encoding

2010-03-03 Thread T . Wunder
After 1 day searching the internet, I solved the problem with the following code: Encode(xml) <- "UTF-8" # now the ü etc. become ü,etc. gsub("ü","Ä",xml) # employ the gsub()-function WITHOUT useBytes-option turned on Encode(xml) <- "unknwon" # that was the former encoding So all in all t

Re: [R] file reading /problems with encoding

2010-03-02 Thread T . Wunder
Quoting Uwe Ligges : R is not able to re-encode the file to the native encoding. But if you keep it in UTF-8, what is the problem to grep for the specific characters (as grep and friends support the argument useBytes these days)? The Problem with UTF-8 is that I'm not able to cat a valid xml-

Re: [R] file reading /problems with encoding

2010-03-01 Thread T . Wunder
Hello Uwe, Quoting Uwe Ligges : You can arrange the former without a loop by xml <- paste(t, collapse="") Thank you, another trick to improve my R-skills :) For the other problem you are reporting: Can you make (the relevbant part of) your file available (say on some web site) so that we can

[R] file reading /problems with encoding

2010-03-01 Thread T . Wunder
Hello, I'm a little frightened because of a problem that occured lately as I tried to read in a xml-file (for replacing some variables in the string with values from a data frame). The almost biggest problem is the encoding of the xml-file. Since it is generated by Word 2007 its encoding

[R] Printing 2 digits after decimal point

2010-02-15 Thread T . Wunder
Hi there, i'm not getting along with the following problem. I'd like to print a real number, e.g. x <- 12.3 with exactly two digits after the decimal point, e.g. 12.30 I've tried the whole format(), formatC() and prettyNum() functions but did not have any success with it. This should work with al

Re: [R] Printing 2 digits after decimal point [SOLVED]

2010-02-15 Thread T . Wunder
Hi, I'm sorry, I've found the right answer: x <- 0 formatC(x,digits=2, format="f") [1] "0.00" The above worked perfectly! Thanks & Best wishes ;) Tom Quoting twun...@ix.urz.uni-heidelberg.de: Hi there, i'm not getting along with the following problem. I'd like to print a real number, e.g.

Re: [R] Convert data frame to XML-Tree

2010-02-12 Thread T . Wunder
You were completely right with your guesses. I'm sorry, that I didn't told you all the details. Didn't think about that. Thanks for your help, Tom Quoting Dieter Menne : T.Wunder wrote: Well, now I get a warning message like "In xmlRoot.XMLInternalDocument(currentNodes[[1]]) : empty XML

Re: [R] Convert data frame to XML-Tree

2010-02-12 Thread T . Wunder
Hello, Quoting Dieter Menne : T.Wunder wrote: convertToXML <- function(df,name) { xml <- xmlTree("Test") xml$addNode(name, close=FALSE) for (i in 1:nrow(df)) { xml$addNode("value", close=FALSE) for (j in names(df)) { xml$addNode(j, df[i, j]) } xml$closeTag() }

[R] Convert data frame to XML-Tree

2010-02-12 Thread T . Wunder
Hello, I'd like to convert R data frames into xml-trees. I wrote (and copied) this little program to do this: convertToXML <- function(df,name) { xml <- xmlTree("Test") xml$addNode(name, close=FALSE) for (i in 1:nrow(df)) { xml$addNode("value", close=FALSE) for (j in names(df)) {