similar to: Recoding multiple TRUE/FALSE columns into a single list of TRUE columns

Displaying 20 results from an estimated 20000 matches similar to: "Recoding multiple TRUE/FALSE columns into a single list of TRUE columns"

2006 Mar 15
2
Regarding aov Error()
The following dummy data frame has factor Q (with 2 levels) nesting factor P (with levels p1 and p2 nested under q1, and p3 and p4 nested under q2), but both crossing the random variate s, which has 8 levels. The dependent measure is dv. > # The data frame: > testnest dv s P Q 1 1 s1 p1 q1 2 2 s2 p1 q1 3 1 s3 p1 q1 4 2 s4 p1 q1 5 1 s5 p1 q1 6 3 s6 p1 q1 7 3 s7
2018 Mar 20
2
Elements of Sets as dataframe column names
Hello all, I have a set B and a dataframe df. I want to name the columns of the dataframe after the elements of the set B. For example, for set B with elements {{"P1"}, {"P2"}, {"P3", "P4"}} I want to create a new dataframe with 3 columns named {"P1"} and {"P2"} and {"P3","P4"}. I tried colnames(df)<-(B). But it
2006 Jul 14
1
Optim()
Dear all, I have two functions (f1, f2) and 4 unknown parameters (p1, p2, p3, p4). Both f1 and f2 are functions of p1, p2, and p3, denoted by f1(p1, p2, p3) and f2(p1,p2,p3) respectively. The goal is to maximize f1(p1, p2, p3) subject to two constraints: (1) c = k1*p4/(k1*p4+(1-k1)*f1(p1,p2,p3)), where c and k1 are some known constants (2) p4 = f2(p1, p2, p3) In addition, each parameter
2011 Jan 10
2
Calculating Portfolio Standard deviation
Dear R helpers I have following data stocks <- c("ABC", "DEF", "GHI", "JKL") prices_df <- data.frame(ABC = c(17,24,15,22,16,22,17,22,15,19),                                          DEF = c(22,28,20,20,28,26,29,18,24,21),                                           GHI = c(32,27,32,36,37,37,34,23,25,32),                                          
2003 Jun 19
2
Subseting by more than one factor...
Is it possible in R to subset a dataframe by more than one factor, all at once? For instance, I have the dataframe: >data p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 pred 1 0 1 0 0 0 0 0 0 0 0 0.5862069 4 0 0 0 0 0 0 0 0 0 1 0.5862069 5 0 0 0 0 0 0 1 0 0 0 0.5862069 6 0 0 0 0 0 0 0 1 0 0 0.5862069 7 0 0 1 0 0 0 0 0 0
2018 Mar 18
1
How to take difference of sets when there is an empty subset involved
Hello, Problem I am facing is as follows: Set A is made of 2 sets x and y x<-{"P1", "P2", "P3", "P4"} y<-{} A<-set(x,y) #A={{}, {"P1", "P2", "P3", "P4"}} i need to use A in a recursive loop where i need to take set difference of A and it 's elements. Example: for (i in A){ print(i)
2005 Jul 20
2
Turning off return warning messages.
Dear All, Is there a way I can turn off the following warning message for using multi-argument returns? multi-argument returns are deprecated in: return(p1, p2, p3, p4) Steve. ************************************************************************************** Steve Su (s.su@qut.edu.au) Postdoctoral fellow Faculty of Business Queensland University of Technology Postal
2018 Mar 18
1
Set Difference Problem
Hello All, I am facing a problem and am unable to find much help online as sets package in R is relatively new. My problem is as follows: Set R is made of 2 sets x and y x<-{"P1", "P2", "P3", "P4"} y<-{} R<-set(x,y) #R={{}, {"P1", "P2", "P3", "P4"}} i need to use R in a recursive loop where i need to take
2016 Apr 19
2
Creating two new variables conditional on retaining values from previous rows
Hello, Iam looking for an R solution that can efficiently produce the output shown below. I can produce this easily in SAS with retain statement and a few lines of if-then-else logic, etc.. but I am not find anything similar on the Rforum archives. Below is the logic I am trying to apply to produce the output table below. Thanks in any help! if the ID is the first ID encountered then group=1 and
2005 Jun 05
3
function and apply
Dear all    I think my problem is not complicated but I'm having difficulties to solve it. v is a vector: v=c(p1 , p2 , p3 , p4), and f  is a function: f : v -> w , where w=c(p1 , p2*(1-p1) , p3*(1-p2)*(1-p1) , p4*(1-p3)*(1-p2)*(1-p1))   I write the function f as: f<- function(w,x,y,z) {c(w,x*(1-w),y*(1-x)*(1-w),z*(1-y)*(1-x)*(1-w))} f(a,b,c,d) it
2010 Jul 23
1
(no subject)
Dear R list, I use the constrOptim to maximize a function with four constriants but the answer does not leave from the starting value and there is only one outer iteration. The function is defined as follows: tm<-function(p){ p1<-p[1]; p2<-p[2]; p3<-p[3]; p4<-1-p1-p2-p3; p1*p2*p3*p4} ##the constraints are p1>=0; p2>=0; p3>=0 and p4>=0 i.e. p1+p2+p3<=1
2008 Feb 04
2
make dataframe from table
Dear R-experts, I have got a dataframe: data ID disease V1 V2 1 p1 1 2 p1 3 3 p3 3 4 p3 5 5 p5 1 From which I extract a usefull table: affect affect 1 3 5 p1 1 1 0 p3 0 1 1 p5 1 0 0 I want to merge this with anotherdataframe: age p1 23 p2 24 p3 23 p4 11 p5 45 If have tried as.data.frame(affect) and other solutions to get the following comment going:
2024 Jan 29
1
linear programming in R | limits to what it can do, or my mistake?
Question for 'experts' in LP using R (using the lpSolve package, say) -- which does not apply to me for the sort of problem I describe below. I've run any number of LP's using lpSolve in R, but all of them to date have objective and constraint functions that both contain the same variables. This lets you set up a LHS and RHS matrix/vector that are symmetrical. But, for a
2011 Aug 13
1
Own R function doubt
Hi to all the people again, I was writting a simply function in R, and wish to collect the results in a excel file. The work goes as follows, Ciervos<-function(K1, K0, A, R,M,Pi,Hembras) {B<-(K1-K0)/A T1<-(R*Pi*Hembras-M*Pi+B)/(Pi-M*Pi+R*Pi*Hembras) P1<-Pi-B R1<-P1*Hembras*R M1<-P1*M T2<-(R1-M1+B)/(P1-M1+R1) P2<-P1-B R2<-P2*Hembras*R M2<-P2*M
2024 Jan 30
1
linear programming in R | limits to what it can do, or my mistake?
Apart from the fact that the statement "such that t1+t2+t3+t4=2970 (as it must)" is not correct, the LP can be implemented as follows: library(lpSolve) LHS <- rbind( c(0,0,0,0, 1, 0, 0,0), c(1,0,0,0,-1, 1, 0,0), c(0,1,0,0, 0,-1, 1,0), c(0,0,1,0, 0, 0,-1,1), cbind(-diag(4),diag(4)), c(0,0,0,0,0,1,0,0), c(0,0,0,0,0,0,1,0), c(0,0,0,0,0,0,0,1) ) RHS <-
2011 Dec 19
1
calculating correlation coefficients on repeated measures
Dear list, I have 9 repeated measures (measurement variable == 'Delta13C') for individuals (ID variable == 'Individual_ID'. Each repeated measure is "indexed" (right term?) by the variable 'FeatherPosition' and given as c('P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9'). I would like to
2010 Sep 25
1
margin control in lattice package
Hi all, I am difficulty with simple layout of plots in the lattice package I have created a series of levelplots and would like to plot them to a single device, but need to reduce the margin areas. This is easily accomplished with par(oma) and par(mar) in the base graphics package but I am having problems finding the equivalent features in the lattice package. Ideally, I would like to reduce
2011 Sep 29
1
Permutations of configurations on multiple columns
Hi, I have got this start situation: structure(list(subject = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L), .Label = c("s1", "s2"), class = "factor"), part = structure(c(1L, 1L, 2L, 3L, 4L, 5L, 1L, 1L, 2L, 6L, 6L), .Label = c("p1", "p2", "p3", "p4", "p5", "p9"), class =
2011 Aug 24
1
Passing a large amount of parameters to a function
Hello, I have a function with a long list of parameters (of different types, numeric and string) myFunc <-function(p1, p2, p3, p4, p5...etc) { do.something(p1,p2,....) } I want to loop over this to provide a different set of parameters to the list every time. for (ii in 1:N) { myFunc(p1(ii), p2(ii),....etc) } I would like to simplify the notation and use some kind of structure, maybe
2012 Feb 13
3
Change dataframe-structure
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120213/d2a5afa6/attachment.pl>