Displaying 20 results from an estimated 10000 matches similar to: "Elements of Sets as dataframe column names"
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)
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
2018 Apr 21
2
Check if row of dataframe is superset of any row in another dataframe.
Hi,
I am looking for a way in which I can check if rows in 1 dataframe are
present in another data frame in a unique way. A row in dataframe should be
super set of any row in another dataframe.
I can write a for loop for it, however, that will be inefficient. So, I am
looking for an efficient way to do this in R.
I have explained it with an example below:
I want to check if a row in dataframe
2018 May 02
2
using apply
Hi
I have 3 dataframes, a,b,c with 0/1 values...i have to check a condition
for dataframe a and b and then input the rows ids to datframe c . In the if
condition, I AND the 2 rows of from a and b and then see if the result is
equal to one of them.
I have done this using a for loop, however, it takes a long time to execute
with larger dataset..Can you help me do it using apply function so that i
2018 May 02
0
using apply
Hi Neha,
Perhaps merge() from base or join from dplyr is what you are looking for.
data. table could also be interesting.
Hth
Ulrik
On Wed, 2 May 2018, 21:28 Neha Aggarwal, <aggarwalneha2000 at gmail.com> wrote:
> Hi
>
> I have 3 dataframes, a,b,c with 0/1 values...i have to check a condition
> for dataframe a and b and then input the rows ids to datframe c . In the if
>
2018 Mar 11
4
subsetting comparison problem
Hello All,
I am facing a unique problem and am unable to find any help in R help pages
or online. I will appreciate your help for the following problem:
I have 2 data-frames, samples below and there is an expected output
R Dataframe1:
C1 C2 C3 C4...... CN
R1 0 1 0 1
R2 1 0 1 1
R3
2018 May 24
1
Time complexity of functions in R
Hi,
I have implemented an algorithm in R, where i have used while loop and some
set operations inside it, for example,
while(condition){
union(set A,set B)
set C - set D
intersection(set D, set E)
}
I want to calculate the complexity of my algo. Can you tell me the
complexity of union, intersection and set minus operations/functions in R?
Is it O(n) or O(log n) ?
Also can anyone point a good
2018 Mar 12
0
subsetting comparison problem
> On Mar 11, 2018, at 3:32 PM, Neha Aggarwal <aggarwalneha2000 at gmail.com> wrote:
>
> Hello All,
> I am facing a unique problem and am unable to find any help in R help pages
> or online. I will appreciate your help for the following problem:
> I have 2 data-frames, samples below and there is an expected output
>
> R Dataframe1:
> C1 C2
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>
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:
2010 Feb 19
1
Quadprog help
I am having some problems using Quadprog in R. I want to minimize the
objective function :
200*P1-1/2*10*P1^2+100*P2-1/2*5*P2^2+160*P3-1/2*8*P3^2+50*P4-1/2*10*P4^2+50*P
5-1/2*20*P5^2+50*P6-1/2*10*P6^2,
Subject to a set of constrains including not only the variables P1, P2, P3,
P4, P5, P6, but also the variables X1, X2,X3,X4,X5,X6,X7,X8,X9.
As the set of variables X's are not
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
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
2011 Dec 26
2
Recoding multiple TRUE/FALSE columns into a single list of TRUE columns
Hi everyone,
I need to recode multiple columns in a dataframe into a single column in a
variety of different ways. Often the values will be TRUE/FALSE and I want a
list of the columns that are true as in the Result column below:
P1 P2 P3 P4 Result
1 0 0 1 1 P3,P4
2 0 1 1 1 P2,P3,P4
3 1 0 0 0 P1
4 0 0 0 0 NA
5 1 1 1
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),
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
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
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 Dec 16
1
Bug in acepack (PR#2352)
This ancient bug was tracked to the acepack library, line 556 in line
src/avas.f
The troublesome line is:
if (x(n).gt.x(1)) go to 30
Since the input arguments are empty, referencing x(1) and x(n) cause
a Segmentation fault, and cause R to crash. Acepack author and
maintainer Rob Tibshirani <tibs at utstat.toronto.edu> has been contacted
with this information. This is not a
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