[R] Time complexity of functions in R

2018-05-23 Thread Neha Aggarwal
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, intersecti

[R] using apply

2018-05-02 Thread Neha Aggarwal
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 ta

[R] Check if row of dataframe is superset of any row in another dataframe.

2018-04-21 Thread Neha Aggarwal
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

[R] Elements of Sets as dataframe column names

2018-03-19 Thread Neha Aggarwal
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

[R] How to take difference of sets when there is an empty subset involved

2018-03-18 Thread Neha Aggarwal
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) A<-se

[R] Set Difference Problem

2018-03-18 Thread Neha Aggarwal
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 n

[R] Dataframe Subsetting comparison

2018-03-11 Thread Neha Aggarwal
Hello All, I am facing a unique issue 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

[R] Subsetting comparison problem

2018-03-11 Thread Neha Aggarwal
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

[R] Fwd: subsetting comparison problem

2018-03-11 Thread Neha Aggarwal
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

[R] subsetting comparison problem

2018-03-11 Thread Neha Aggarwal
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