Re: [R] regexp inside and outside brackets

2015-12-11 Thread phgrosjean
It depends the complexity of your expression. If you are sure you don’t have nested brackets, and pairs of brackets always match, this will take everything outside the brackets: str <- "A1{0}~B0{1} CO{a2}NN{12}” gsub("\\{[^}]*\\}", " ", str) Philippe Grosjean > On 11 Dec 2015, at 14:50,

Re: [R] there is a vectorinzing version of "[[<-" for "tclArray" class ?

2015-12-09 Thread phgrosjean
library(tcltk) methods(class = "tclArray") ## [1] [[ [[<- $$<- length length<- namesnames<- ## see '?methods' for accessing help and source code It should be something like `[<-`. But this one is not defined. Perhaps can you contribute one here? Best, Philippe

Re: [R] column means dropping column minimum

2015-12-08 Thread phgrosjean
There is a bug in your code: it is not > for (i in 1:ncol(test)) { test2[which.min(test[,i]),i]==NA} but for (i in 1:ncos(test)) { test2[which.min(test[, i]), i] <- NA } Otherwise, a solution would be to create your own function to compute the mean of a vector without the smallest value:

Re: [R] [tcltk][tktable] How to make an efficient data transfer from R to Tcl?

2015-12-08 Thread phgrosjean
Are you sure this is the right way to go for your use case? Even if you got a quick solution to display an 1e4 x 100 table in TkTable, what is the purpose of it? Will the user browse the whole dataset that way? Even if the answer is yes, you would probably need to implement sorting and

Re: [R] Tk table: how to get information about configurations ?

2015-12-05 Thread phgrosjean
It depends what property you are looking for… Have you tried tkcget(table, …)? Philippe Grosjean > On 05 Dec 2015, at 12:41, Cleber N.Borges wrote: > > Hello > I would like to know the correct way of getting information about the values > of the parameters of a Tktable. >

Re: [R] Tktable do not expand inside a Tkframe

2015-12-03 Thread phgrosjean
Instead of using tkgrid(), you can do this with tkpack(). Replace: > tkgrid( tableData, scrY ) > tkgrid.configure( scrY, sticky="nsw") > tkgrid( scrX, sticky="new" ) by: scrYwidth <- as.integer(tkcget(scrY, width = NULL)) tkpack(scrY, side = "right", fill = "y", expand = FALSE, pady = c(0,

Re: [R] Passing variable names in quotes to a function

2015-12-02 Thread phgrosjean
> On 02 Dec 2015, at 16:09, Brant Inman wrote: > > Thank you for your response. Here is the problem that I find with your code > (which I had tried). When you pass a value to the subset argument of the > function, it will not hold the quotes on the subsetting variable’s

Re: [R] Passing variable names in quotes to a function

2015-12-02 Thread phgrosjean
Your example and explanation are not complete, but I have the gut feeling that you could do all this both more efficiently *and* more R-ish. First of all, why would you pass Y and X separately, to ultimately build the Y ~ X formula within the body of your function? Secondly, it seems to me

Re: [R] Extracting part of alpha numeric string

2015-11-30 Thread phgrosjean
fields <- c("2154333b-3208-4519-8b76-acaef5b5a479", "980958a0-103b-4ba9-afaf-27b2f5c24e69", "00966654-0dea-4899-b8cf-26e8300b262d") sub("^([0-9]*).*$", "\\1", fields) Best, Philippe Grosjean > On 30 Nov 2015, at 11:39, Abhinaba Roy wrote: > > Hi, > > I

Re: [R] Extracting part of alpha numeric string

2015-11-30 Thread phgrosjean
> On 30 Nov 2015, at 13:09, Abhinaba Roy wrote: > > Hey, > > worked like a charm! :) > > Could you please explain about > > sub("^([0-9]*).*$", "\\1", fields) > Yes. sub() replaces substrings. The first argument captures the interesting part of the string: ^ =

Re: [R] could not load r package in mac

2015-11-25 Thread phgrosjean
Have you tried a different mirror? If they all fail, also check your internet connection. PhG > On 25 Nov 2015, at 09:01, Kristi Glover wrote: > > Hi R user, > > I was wondering why I could not load R packages such as reshape2 in mac. I > tried different ways but

Re: [R] One application of Tcltk2

2010-05-28 Thread phgrosjean
Hello, tk2notebook() is a ttk/tile styled widget. Its appearance is governed by styles. Before you change style, you should first look if there is one predefined theme that better suits you: tk2theme.list() # List all available themes [1] clamalt default classic tk2theme(clam) # Change