similar to: Constructing logical expressions dynamically

Displaying 20 results from an estimated 20000 matches similar to: "Constructing logical expressions dynamically"

2005 Jun 03
2
rearrange data
Dear all: I have this: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3 And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3 Example: m<- matrix(1:15,nrow=3,byrow=T) m v<- unlist(list(t(m[,1:4]))) u<- rep(c(5,10,15),c(4,4,4)) data.frame(v,u) This is the result I want but I would like to learn a simpler way to do it. Any clue?
2007 Mar 23
1
substitute and S4 objects
Hi all, I don't understand why this does not what I expect : ## code start here ############## setClass("num",representation(x="numeric")) num<-function(x) new("num",x=x) add<-function(e1,e2) { cat("Computing ",deparse(substitute(e1)),"+",deparse(substitute(e2)),"\n") e1@x+e2@x }
2005 May 31
2
help
Dear all:   I have this:  A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 B3 C3 D3 E3   And I want this A1 E1 B1 E1 C1 E1 D1 E1 A2 E2 B2 E2 C2 E2 D2 E2 A3 E3 B3 E3 C3 E3 D3 E3   Example:   m<- matrix(1:15,nrow=3,byrow=T) m v<- unlist(list(t(m[,1:4]))) u<-
2007 Nov 14
2
Generating these matrices going backwards
I have generated the following: x= E1 E2 E3 D1 0 0 1 D2 1 0 3 D3 0 2 0 y= E1 E2 E3 D1 0 0 1.75 D2 1.75 0 1.3125 D3 0 3.5 0 Where x and y are linked by: y =sum(x) * x / (rowSums(x)%o%colSums(x)) N=x[x[1:3,]>0] R=y[y[1:3,]>0] Now suppose I ONLY
2007 Mar 09
1
Applying some equations over all unique combinations of 4 variables
#I have a data set that looks like this. A bit more complicated actually with # three factor levels but these calculations need to be done on one factor at a #I then have a set of different rates that are applied #to it. #dataset cata <- c( 1,1,6,1,1,2) catb <- c( 1,2,3,4,5,6) doga <- c(3,5,3,6,4, 0) data1 <- data.frame(cata, catb, doga) rm(cata,catb,doga) data1 # start rates #
2004 Jul 08
2
Getting elements of a matrix by a vector of column indice s
See if the following helps: > m <- outer(letters[1:5], 1:4, paste, sep="") > m [,1] [,2] [,3] [,4] [1,] "a1" "a2" "a3" "a4" [2,] "b1" "b2" "b3" "b4" [3,] "c1" "c2" "c3" "c4" [4,] "d1" "d2" "d3" "d4" [5,]
2009 Sep 05
2
Combining expressions.
I am trying to construct a function to which I pass an expression as an argument. >From that expression I want to create a somewhat more complicated expression and then differentiate it using D() or deriv(). To give a simple example, I'd like to be able to do something like e1 <- expression(x^2 + y^2) e2 <- some.magic(e1,"n") or maybe e2 <- some.magic(e1,expression(n))
2003 May 20
1
How to use pakcage SEM
Hi. I have tried to use Package "SEM". As a learning, I try to convert a program running well of EQS which is as follows to SEM: ### EQS ### /SPECIFICATION CAS=100; VAR=5 MAT=COR; ANA=COR; /EQUATIONS V1=*F1+E1; V2=*F1+E2; V3=*F1+*F2+E3; V4=**F1+*F2*E4; V5=*F2+E5; /VAR E1 TO E5=*; F1*1.0; F2=1.0; /COV E1,E2=*; F1,F2=*: /PRINT FIT ALL; /MATRIX ...... /END This is the converted SEM
2012 Sep 20
1
question on assigning an argument in a function that is create by the function itself
Hi, I need some help with making a function a bit more elegant. How would you all suggest avoiding the problem I've made myself below - I've written a function that creates a temporary matrix by subseting a larger one I assign it. I then call vectors from that matrix, add each item in the vector to create a cumulative vector for each factor, and then patch them all back together.
2004 Mar 18
12
substitute question
Consider the following example: # substitute a with b in the indicated function. Seems to work. > z <- substitute( function()a+1, list(a=quote(b)) ) > z function() b + 1 # z is an object of class call so use eval # to turn it into an object of class expression; however, # when z is evaluated, the variable a returns. > eval(z) function()a+1 Why did a suddenly reappear again
2010 Dec 07
4
Creating binary variable depending on strings of two dataframes
Hi, consider the following two dataframes: x1=c("232","3454","3455","342","13") x2=c("1","1","1","0","0") data1=data.frame(x1,x2) y1=c("232","232","3454","3454","3455","342","13","13","13","13")
2004 Aug 04
1
Constructing a VAR model using dse
Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Received-SPF: none (hypatia: domain of wolfgang-abele at web.de does not designate permitted sender hosts) X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on hypatia.math.ethz.ch X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=BAYES_50
2002 Mar 19
1
Catenating expressions in plotmath().
I want to do something like produce a plot title of the form ``Sample size n = 42; critical value k_0 = 17.'' where the ``n'' is to be in a maths font and ``k_0'' indicates that the 0 is a subscript. (A la LaTeX.) But the values ``42'' and ``17'' are to be substituted in from the numeric values of R objects. After a bit of struggle I found that >
2017 Aug 25
2
retrieve machine password in current Samba?
We have a wireless network that uses 802.1x authentication, in which domain joined computers use their machine credentials to connect. Windows machines do this automatically, and until recently Linux computers could join using wicd, wpa-supplicant, and a simple script that would retrieve the machine password with tdbdump. ( specifically tdbdump -k SECRETS/MACHINE_PASSWORD/DOMAIN
2014 Jul 28
2
[LLVMdev] [lld] question on ELF section formating
I've been adding ELF/AArch64 support to lld based off the existing x86_64 code that is already there in lld. I've been able to compile and link a simple "Hello World"-type program. However, I'm getting what appears to be a misplacement/name change of the _start atom. When I do the link, the _start section gets named __tls_get_addr. The code inside this section appears to be
2006 Sep 01
1
setMethod("Logic", ...)
Hi In V&R the "polynomial" class is explicitly specified to have no logical operators: setMethod("Logic", signature(e1="polynomial"), function(e1,e2){stop ("...")}) I too have a class of objects for which I want to specify that Logic operators do not work, but executing setClass("brob", representation = representation
2012 Jul 18
6
taylor expansions with real vectors
Dear list, I have a big deal concerning the development of a Taylor expansion. require(Matrix) e1 <- as.vector(1:5) e2 <- as.vector(6:10) in order to obtain all the combinations between these two vectors following a Taylor expansion (or more simply through a Maclaurin series) for real numbers. We have f(x) = f(0) + f'(0)(x-0) + f''(0)(x-0)^2/2! + ? + f^(k)(0)(x-0)^k/k!
2013 Nov 21
1
how can I import a number of datsets in a folder in my working directory to a list in R
Hi, Suppose, if I create 15 files in my working directory. set.seed(48) lapply(1:15,function(i) {m1 <- matrix(sample(1:20,1686*2,replace=TRUE),nrow=1686,ncol=2); write.table(m1,paste0("file_",i,".txt"),row.names=FALSE,quote=FALSE)}) ?D <-dir() D1 <- D[order(as.numeric(gsub("\\D+","",D)))] D1 ?res <- t(sapply(D1,function(x) {x1<-
2019 Nov 18
2
BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"
On 11/18/19 9:18 AM, Martin Maechler wrote: >>>>>> Henrik Bengtsson >>>>>> on Sun, 17 Nov 2019 14:31:07 -0800 writes: > > $ R --vanilla R version 3.6.1 (2019-07-05) -- "Action of > > the Toes" Copyright (C) 2019 The R Foundation for > > Statistical Computing Platform: x86_64-pc-linux-gnu > > (64-bit) ...
2019 Nov 17
2
BUG?: A copy of base::`+` (primitive) is not a clone but a "pointer"
$ R --vanilla R version 3.6.1 (2019-07-05) -- "Action of the Toes" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) ... > str(base::`+`) function (e1, e2) > plus <- structure(base::`+`, class = "plus") > str(plus) function (e1, e2) - attr(*, "class")= chr "plus" ## Hmm ... >