Re: [R] Integrating R and Textmate

2008-07-25 Thread Hans-Jörg Bibiko
On 25.07.2008, at 17:06, Rob Goedman wrote: Art, Could it be the case TextMate is activating the wrong version of R (2.6 vs. 2.7.1). I do not believe this. TextMate is using the normal R Terminal. I invoked the following command in a Rdaemon environment: install.packages(ade4,

Re: [R] variable as part of file name

2008-07-02 Thread Hans-Jörg Bibiko
On 02.07.2008, at 15:31, Laura Poggio wrote: Dear all, sorry for this very basic question, but I did not find any good example yet. I would like to set up a variable that can be recall later to substitute a part of a file name. As example: var_filename = as.name(aaa)

Re: [R] Convert character string to number

2008-06-21 Thread Hans-Jörg Bibiko
On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2, 1/4) to yyy - c(0.5, 0.25) , but as.numeric didn't work for me. Could anyone give me a hint please? There are many many ways, and they're depending on the structure of xxx. If you only

Re: [R] cutting out numbers from vectors

2008-06-21 Thread Hans-Jörg Bibiko
On 20.06.2008, at 19:27, calundergrad wrote: i have a vector with a string of number e.g [1] 0113001 001130011000 001130012000 001130013000 001130016000 [6] 001130018000 i want a vector with the same numbers except with the last three digits of every factor cut off. e.g [1]

Re: [R] Convert character string to number

2008-06-21 Thread Hans-Jörg Bibiko
On 21.06.2008, at 17:25, Marc Schwartz wrote: on 06/21/2008 09:18 AM Gabor Grothendieck wrote: On Sat, Jun 21, 2008 at 8:31 AM, Wacek Kusnierczyk [EMAIL PROTECTED] wrote: Hans-Jörg Bibiko wrote: On 21.06.2008, at 01:36, Ken Liu wrote: I would like to convert a character vector xxx - c(1/2, 1

Re: [R] (no subject)

2008-06-19 Thread Hans-Jörg Bibiko
On 19.06.2008, at 07:24, Paul Adams wrote: Hello everyone, I am wanting to replace an element in a matrix with NA. I have used the following code dat-read.table(file=C:\\Documents and Settings\ \txt,header=T,row.names=1) file.show(file=C:\\Documents and Settings\\txt)

Re: [R] Pattern Matching Replacement

2008-06-19 Thread Hans-Jörg Bibiko
On 19.06.2008, at 20:17, ppatel3026 wrote: I would like to replace \r\n with in a character string, where \r\n exists only between and , how could I do that? Initial: characterString = XMLtag1 id=\F\r\n2\/t\r\nag1\r\ntag\r\n2/tag2/XML Result: characterString = XMLtag1

Re: [R] Editor for Mac OSX

2008-06-18 Thread Hans-Jörg Bibiko
On 18.06.2008, at 18:09, Graham Smith wrote: Have a look at TextMate http://macromates.com/ There are three extensions (bundles) available dealing with R for TextMate [up to now in the Review repository]: [in very short terms] 1) R - writing R scripts and executing it (plots are inside

Re: [R] gsub and multiple replacements

2008-06-02 Thread Hans-Jörg Bibiko
On 02.06.2008, at 17:27, Ng Stanley wrote: I would like to replace A B by A-B and AA (DD) by AA using a single gsub. Is that possible besides using two gsub ? Could you be a bit more precisely? If you are dealing with two fix strings then you can write

Re: [R] Unicode characters (R 2.7.0 on Windows XP SP3 and Hardy Heron)

2008-06-01 Thread Hans-Jörg Bibiko
On 31.05.2008, at 00:11, Prof Brian Ripley wrote: On Fri, 30 May 2008, Duncan Murdoch wrote: But I think with Brian Ripley's work over the last while, R for Windows actually handles utf-8 pretty well. (It might not guess at that encoding, but if you tell it that's what you're using...)

Re: [R] Unicode characters (R 2.7.0 on Windows XP SP3 and Hardy Heron)

2008-05-30 Thread Hans-Jörg Bibiko
Hi, to put it simply. Windows cannot handle utf-8 data. There is no utf-8 locale available. If your corpus only contains Russian data, maybe English glosses etc. you can try to set lang of Rgui.exe to Russian. Then at least you can use grep, strsplit because they are depending on the

Re: [R] data.frame indexing

2008-04-28 Thread Hans-Jörg Bibiko
On 28.04.2008, at 16:40, Georg Ehret wrote: E.g.: a-as.data.frame(matrix(rnorm(100),nrow=10,ncol=10)) b-which(a$V10.8) b [1] 1 4 6 10 a_indexb-a[b,] a_notIndexB-a[!b,] nrow(a_notIndexB) [1] 0 Indexing a on b is not a problem (a_indexb), but how can do get only the elements left if I

Re: [R] Regular Expressions Help

2008-04-19 Thread Hans-Jörg Bibiko
On 19.04.2008, at 06:46, maud wrote: I am having some trouble learning regular expressions. Let me describe the general problem I am dealing with. Consider the following setup: Joe- c(1,2,3) Bob- c(2,4,6) Alice - c(9,8,7) Matrix - cbind(Joe, Bob, Alice) St - c(Bob, Alice, Alice:Bob)

Re: [R] How to replace German umlauts in strings?

2008-04-10 Thread Hans-Jörg Bibiko
On 10.04.2008, at 18:03, Hofert Marius wrote: I have a file containing names of German students. These names contain the characters ä, ö or ü (German umlauts). I use read.table() to read the file and let's assume the table is then stored in a variable called data. The names are then contained

Re: [R] for loop help

2008-04-10 Thread Hans-Jörg Bibiko
On 11.04.2008, at 05:38, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ?`break` ?`next` for(i in 1:13) { if(i 13) next print(Hello!\n) } [1] Hello!\n I am trying to find a solution in R for the following C++ code that allows one to skip ahead in the loop: for (x =

Re: [R] Number of words in a string

2008-04-09 Thread Hans-Jörg Bibiko
On 09.04.2008, at 17:46, Shubha Vishwanath Karanth wrote: To put it simple, C=c(My Dog, Its really good, Beautiful) Now, SOMEFUNCTION(C) should give: c(My, Its really, ) SOMEFUNCTION - function(x) gsub( *\\w+$, , x) But be aware that this won't work for instance for combining diacritics.

Re: [R] How to create a legend without plot, and to use scientific notation for axes label ?

2008-04-09 Thread Hans-Jörg Bibiko
On 10.04.2008, at 05:18, Ng Stanley wrote: Also, is there any way to specify scientific notation for axes label ? Scientific notation à la 3E-4 is set by default. Or did you mean engineering notation? Maybe this could help: http://wiki.r-project.org/rwiki/doku.php?id=tips:data-

[R] distance matrix as text file - how to import?

2008-04-08 Thread Hans-Jörg Bibiko
Dear all, I have -hopefully- a tiny problem. I was sent a text file containing a distance matrix à la: 1 2 3 4 5 6 Now I wanted to import these data into a dist object to, let's say, do 'plot(hclust(v))'. My first naïve approach was to scan the text file in order to get a vector v. Then I