Re: [R] How to define new operator in R?

2011-03-30 Thread Frank Schwidom
Hi, you may overwrite existing opreators in the current environment for example: `+` - `*` 2+3 [1] 6 Regards! On Wed, Mar 30, 2011 at 10:04:19AM -0600, Chuanlong Du wrote: Hello, everyone! Does anyone know how make some symbols have special means in R? For example, we know that + in R

Re: [R] possibly Error in R version 2.12.1 (2010-12-16)

2012-02-18 Thread Frank Schwidom
How can i file this isssue as an bugreport? On Fri, Feb 03, 2012 at 02:01:02PM +0100, peter dalgaard wrote: On Feb 2, 2012, at 21:24 , Frank Schwidom wrote: Hi, the following Code demonstrates an possibly Error in R (or you can explain me, why this happens, thanks in advance

Re: [R] suggestions argument in rbga function in genalg package

2012-04-09 Thread Frank Schwidom
On Thu, Sep 22, 2011 at 06:46:23PM +, Joseph Boyer wrote: Would someone be so kind as to provide example code where they use the suggestions argument in the rgba function In genalg? I can't get it to work. The following code works just fine: GenFit -rbga(Lower, Upper, evalFunc =

[R] possibly Error in R version 2.12.1 (2010-12-16)

2012-02-02 Thread Frank Schwidom
Hi, the following Code demonstrates an possibly Error in R (or you can explain me, why this happens, thanks in advance) Code: # testClass - function( stackData= c()) { list( write= function( ...) { sChain= for( s in c( stackData, ...)) {

[R] unlist( list( factor( 'a'), 1)) == c( 1, 1); unlist( list( factor( 'a'), factor( 1)))==c( 'a', '1')

2014-03-30 Thread Frank Schwidom
Hi, c( factor( 'a'), ( 1)) [1] 1 1 c( factor( 'a'), factor( 1)) [1] 1 1 c( factor( 'a'), factor( 'b')) [1] 1 1 unlist( list( factor( 'a'), 1)) [1] 1 1 unlist( list( factor( 'a'), factor( 1))) [1] a 1 Levels: a 1 unlist( list( factor( 'a'), factor( 'b'))) [1] a b Levels: a b In an

Re: [R] about lm()

2014-03-30 Thread Frank Schwidom
Please provide some data from your variable data. Show the output of dput( data) or an subset of data which leads toe the specific error. Regards On Sun, Mar 30, 2014 at 02:23:09PM +0100, Si Qi L. wrote: Hi I have a problem with linear regression. This is my codes: acc1- lm(data$acc ~

Re: [R] Help! Weird behavioral difference between R interactive and command-line?

2013-04-07 Thread Frank Schwidom
Hi some functions, like plot, readline and others behave different depending to the result of the function interactive() there is no way to ask R which functions do that On Thu, Sep 06, 2012 at 01:22:32PM -0500, Michael wrote: Help! Weird behavioral difference between R interactive and

Re: [R] Start R from bash/bat file and end in interactive mode

2013-04-07 Thread Frank Schwidom
one way could be: $ cat rook.R | R --interactive but with a little different console behaviour the problem in your other examples is, that R uses only the first appearing switch of: --interactive, --f, -e, --vanilla, --no-save, ... the switches cannot be combined On Thu, Nov 01, 2012 at

Re: [R] Start R from bash/bat file and end in interactive mode

2013-04-07 Thread Frank Schwidom
another working Example: { echo print( 1); cat;} | R --interactive but do not end with ctrl-D, it overrides the save workspace question; use q() instead there is an additional echo where i don't know how to avoid them On Thu, Nov 01, 2012 at 09:14:09AM +0100, Jan van der Laan wrote: I

Re: [R] R lappy, sapply or mapply question

2015-10-10 Thread Frank Schwidom
On 2015-10-09 20:15:16, liqunhan--- via R-help wrote: > for (k in 1 : 5) { >   xlist <- list(x5 = dailyrecord$a[k], x6 = dailyrecord$e[k], x7 = > dailyrecord$f[k]) >   result_forloop[k] <- fun3(list1, list2, xlist) > } result_forloop <- lapply( 1 : 5, function( k) { tmpRow <-

Re: [R] R lappy, sapply or mapply question

2015-10-10 Thread Frank Schwidom
correction: On 2015-10-10 16:08:39, Frank Schwidom wrote: > On 2015-10-09 20:15:16, liqunhan--- via R-help wrote: > > > for (k in 1 : 5) { > >   xlist <- list(x5 = dailyrecord$a[k], x6 = dailyrecord$e[k], x7 = > > dailyrecord$f[k]) > >   result_forlo

Re: [R] Help with vectors!

2015-09-08 Thread Frank Schwidom
# my last one: xtfrm( VAS) On Tue, Sep 08, 2015 at 11:55:51AM -0700, Dan D wrote: > Great! > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Help-with-vectors-tp4711801p4712023.html > Sent from the R help mailing list archive at Nabble.com. > >

Re: [R] extracting every nth character from a string...

2015-09-08 Thread Frank Schwidom
> rawToChar( charToRaw( str)[ c( TRUE, FALSE)]) [1] "ACEG" Regards On Sat, Sep 05, 2015 at 04:59:54PM -0400, Evan Cooch wrote: > Suppose I had the following string, which has length of integer multiple of > some value n. So, say n=2, and the example string has a length of (2x4) = 8 >

Re: [R] Help with vectors!

2015-09-08 Thread Frank Schwidom
On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote: > # your data > VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") > > # declare the new vector > New_Vector<-numeric(length(VAS)) > > # brute force: > New_Vector[VAS=="White"]<-1 >

Re: [R] Counting occurrences of a set of values

2015-09-10 Thread Frank Schwidom
df <- data.frame( V1= 1, V2= c( 2, 3, 2, 1), V3= c( 1, 2, 1, 1)) dfO <- df[ do.call( order, df), ] dfOD <- duplicated( dfO) dfODTrigger <- ! c( dfOD[-1], FALSE) dfOCounts <- diff( c( 0, which( dfODTrigger))) cbind( dfO[ dfODTrigger, ], dfOCounts) V1 V2 V3 dfOCounts 4 1 1 1 1 3 1

Re: [R] aggregate counting variable factors

2015-09-17 Thread Frank Schwidom
Hi where can i find 'melt' and 'dcast' ? Regards On Thu, Sep 17, 2015 at 08:22:10AM +, PIKAL Petr wrote: > Hi > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kai Mx > > Sent: Wednesday, September 16, 2015 10:43 PM > > To: r-help mailing

Re: [R] aggregate counting variable factors

2015-09-17 Thread Frank Schwidom
Hi res <- sapply( df1[ , -1], function( x) table(x)[as.character( 0:5)]) rownames( res) <- paste( sep='', 'result', 0:5) res[ is.na( res)] <- 0 res item1 item2 item3 item4 item5 result0 1 0 1 1 0 result1 1 2 0 0 0 result2 1 2 1 1

Re: [R] c(1:n, 1:(n-1), 1:(n-2), ... , 1)

2015-09-17 Thread Frank Schwidom
sequence( 5:1) Regards. On Thu, Sep 17, 2015 at 11:19:05AM -0700, Dan D wrote: > Can anyone think of a slick way to create an array that looks like c(1:n, > 1:(n-1), 1:(n-2), ... , 1)? > > The following works, but it's inefficient and a little hard to follow: > n<-5 >

Re: [R] c(1:n, 1:(n-1), 1:(n-2), ... , 1)

2015-09-17 Thread Frank Schwidom
how abount a more complicated one? outer( 1:5, 1:5, '-')[ outer( 1:5, 1:5, '>')] [1] 1 2 3 4 1 2 3 1 2 1 On Thu, Sep 17, 2015 at 11:52:27AM -0700, David Winsemius wrote: > You can add this to the list of options to be tested, although my bet would > be placed on `sequence(5:1)`: > > >

Re: [R] R WRONG CALCULATIONS - Please Help

2015-09-14 Thread Frank Schwidom
On Mon, Sep 14, 2015 at 04:11:57PM +0100, JORGE COLACO wrote: > > X-mean > [,1] [,2] [,3] [,4] [,5] [,6] > [1,] -0.8 -0.2 0.8 -1.2 0.8 -0.2 > [2,] -0.2 0.2 0.8 0.8 0.8 -1.2 > [3,] -1.2 -0.2 -0.8 0.8 -0.2 0.8 > [4,] 0.8 0.8 -1.2 -0.8 -0.2 -0.2 > [5,] -0.2 -0.2 0.8 0.8 -0.8 0.8 >

Re: [R] merging tables based on both row and column names

2015-09-28 Thread Frank Schwidom
test1 <- (rbind(c(0.1,0.2),0.3,0.1)) rownames(test1)=c('y1','y2','y3') colnames(test1) = c('x1','x2'); test2 <- (rbind(c(0.8,0.9,0.5),c(0.5,0.1,0.6))) rownames(test2) = c('y2','y5') colnames(test2) = c('x1','x3','x2') lTest12 <- list( test1, test2) namesRow <- unique( unlist( lapply( lTest12,

Re: [R] Help with vectors!

2015-09-09 Thread Frank Schwidom
c( as.factor( VAS)) On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote: > # your data > VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") > > # declare the new vector > New_Vector<-numeric(length(VAS)) > > # brute force: > New_Vector[VAS=="White"]<-1

Re: [R] Help with vectors!

2015-09-09 Thread Frank Schwidom
Just for fun: > colSums( outer( VAS, VAS, '<')) [1] 3 3 0 3 7 8 8 0 3 0 On Sat, Sep 05, 2015 at 02:14:18PM -0700, Dan D wrote: > # your data > VAS<-c("Green","Green","Black","Green","White","Yellow","Yellow","Black","Green","Black") > > # declare the new vector >

Re: [R] Plot with R un html5

2015-09-19 Thread Frank Schwidom
Hi, when you can plot this graph using the rgl-package, then you can use "rgl::writeWebGL" to create an 3D-View in the Browser. Regards On Sat, Sep 19, 2015 at 04:42:47PM +0200, bgnumis bgnum wrote: > Hi al, > > I want to put a graph in a html5 webpage plotted with R (I want to get dar > from

Re: [R] vector manipulations -- differences

2015-09-22 Thread Frank Schwidom
And if we want to use the approach of William Dunlap for sequence.optimization , then we can write: rev( xr[ seq_len(sum(vec)) - rep.int(cumsum(c(0L, vec[-length(vec)])), vec)] - rep.int( xr[ -1], vec)) Regards. On 2015-09-22 23:43:10, Frank Schwidom wrote: > Hi, > > xr <- rev( x

Re: [R] c(1:n, 1:(n-1), 1:(n-2), ... , 1)

2015-09-22 Thread Frank Schwidom
Hi I have to correct myself, this last solution is not universally valid here a better one: tmp1 <- ( 1 - outer( max( x):1, x, FUN='-')) tmp1[ tmp1 > 0] On 2015-09-17 21:06:30, Frank Schwidom wrote: > > how abount a more complicated one? > > outer( 1:5, 1:5, '-'

Re: [R] vector manipulations -- differences

2015-09-22 Thread Frank Schwidom
Hi, xr <- rev( x) vec <- 1:(length( x) - 1) rev( xr[ sequence( vec)] - rep.int( xr[ -1], vec)) On 2015-09-21 14:17:40, Dan D wrote: > I need an efficient way to build a new n x (n-1)/2 vector from an n-vector x > as: > > c(x[-1]-x[1], x[-(1:2)]-x[2], ... , x[-(1:(n-1)] - x[n-1]) > > x is

Re: [R] Extract from data.frame

2015-09-21 Thread Frank Schwidom
year <- df$Year[ which.max( df$Amount)] df[ df$Year %in% (as.numeric( as.character( year)) + -1:1), ] Year Amount 2 2002120 3 2003175 4 2004160 On Mon, Sep 21, 2015 at 04:52:46PM +0200, Nico Gutierrez wrote: > Hi All, > > I need to do the following operation from data.frame: > >

Re: [R] Extract from data.frame

2015-09-21 Thread Frank Schwidom
better ( if year is an vector of more than 1 element): df[ df$Year %in% outer(as.numeric( as.character( year)), -1:1, FUN='+'), ] Year Amount 2 2002120 3 2003175 4 2004160 On Mon, Sep 21, 2015 at 10:49:34PM +0200, Frank Schwidom wrote: > > year <- df$Year[ which.max(

[R] Open a file which name contains a tilde

2019-06-05 Thread Frank Schwidom
Hi, As I can see via path.expand a filename which contains a tilde anywhere gets automatically crippled. +> path.expand("a ~ b") [1] "a /home/user b" +> path.expand("a ~ b ~") [1] "a /home/user b /home/user" I want to open a file regardless whether its name contains any character unless 0.

Re: [R] Open a file which name contains a tilde

2019-06-05 Thread Frank Schwidom
On 2019-06-05 20:32:07, Enrico Schumann wrote: > >>>>> "FS" == Frank Schwidom writes: > > FS> Hi, > FS> As I can see via path.expand a filename which contains a tilde > anywhere gets automatically crippled. > > FS> +> path

Re: [R] Open a file which name contains a tilde

2019-06-05 Thread Frank Schwidom
On 2019-06-05 20:32:07, Enrico Schumann wrote: > >>>>> "FS" == Frank Schwidom writes: > > FS> Hi, > FS> As I can see via path.expand a filename which contains a tilde > anywhere gets automatically crippled. > > FS> +> path

Re: [R] Open a file which name contains a tilde

2019-06-14 Thread Frank Schwidom
ake a look: https://github.com/schwidom/simplefs Suggestions are welcome. Kind regards Frank Schwidom On 2019-06-12 12:50:12, John via R-help wrote: > On Wed, 5 Jun 2019 18:07:15 +0200 > Frank Schwidom wrote: > > In reading file names, names with spaces require escaping of the > s

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Frank Schwidom
Hi, yes, I have seen this package and it has the same tilde expanding problem. Please excuse me I will cc this answer to r-help and r-devel to keep the discussion running. Kind regards, Frank Schwidom On 2019-06-11 09:12:36, Gábor Csárdi wrote: > Just in case, have you seen the fs pack

Re: [R] [Rd] Open a file which name contains a tilde

2019-06-11 Thread Frank Schwidom
ildes in filenames" bandwagon, so this >behavior, even if technically a bug, has no ability to cause them > problems. >Best, >~G >On Tue, Jun 11, 2019 at 8:25 AM Frank Schwidom <[1]schwi...@gmx.net> >wrote: > > Hi, > > yes, I hav

Re: [R] Open a file which name contains a tilde

2019-06-10 Thread Frank Schwidom
Hi, to get rid of any possible filename modification I started a little project to cover my usecase: https://github.com/schwidom/simplefs This is my first R package, suggestions and a review are welcome. Thanks in advance Frank Schwidom On 2019-06-07 09:04:06, Richard O'Keefe wrote: >

[R] Axiom alike formula needs to get prooved

2019-10-05 Thread Frank Schwidom
t works, but how can I understand that and how it is proven? Regards Frank Schwidom __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.