similar to: Merge data under conditions

Displaying 20 results from an estimated 5000 matches similar to: "Merge data under conditions"

2009 Sep 10
2
Merge data frames but prefer values in one
Hello everyone, My problem is better explained with an example: > x=data.frame(a=1:4,b=1:4,c=rnorm(4)) > x a b c 1 1 1 -0.8821089 2 2 2 -0.7082583 3 3 3 -0.5948835 4 4 4 -1.8571443 > y=data.frame(a=c(1,3),b=3,c=rnorm(2)) > y a b c 1 1 3 -0.273155973 2 3 3 0.009517862 Now I want to merge x and y by columns a and b, hence creating a data.frame with all
2010 Nov 07
3
help to sum up data frame
Dear All, I have a data frame like this: name ip Bsent Breceived a 1 0.00 0.00 a 2 1.43 19.83 a 1 0.00 0.00 a 2 1.00 1.00 b 1 0.00 2.00 b 3 0.00 2.00 b 2 2.00 0.00 b 2 2.00 0.00 b 1 24.40 22.72 c
2010 Mar 12
5
Vertical subtraction in dataframes
Hello all, I have not been able to find an answer to this problem. I feel like it might be so simple though that it might not get a response. Suppose I have a dataframe like the one I have copied below (minus the 'calib' column). I wish to create a column like calib where I am subtracting the 'Count' when 'stain' is 'none' from all other 'Count' data for
2010 Nov 04
5
Sorting data from one column with strings
Hello, I have tried to find this out some other way, but unsuccessful I have to try this list. I assume this should be quite simple. I have a dataset with 4 columns, "Sample_no", "Species", "Nitrogen", "Carbon" in csv format. In the species column I have many different species with varying number of obs per species Eg "Sample_no"
2012 Jan 11
3
summarizing a complex dataframe
I need some help summarizing complex data frames (small example below): m1_1 m2_1 m3_1 m1_2 m2_2 m3_2 i1 1 1 1 2 2 2 i1 2 1 1 2 2 2 i2 2 2 1 2 2 2 For an arbitrary number of columns (say m1 ?. m199) where the column names have variable patterns, and such that each set of columns is repeated (with potentially unique data) an
2018 Apr 18
1
merge two data frame based on equal and unequal comparisons
Dear R users, I need to merge two data frames based on both equal and unequal comparisons. The "sqldf" package used to work well , but today, I cannot resolve the following error by reinstallation of the sqldf package. Can anyone suggest a different way to perform this kind of merge function? Thank you, Ding > DMRlog2pbde47DMS <- sqldf("select * from DMR_log2pbde47 as a
2010 Apr 06
2
Merging data frames on two conditions
Hi Guys I have two data frames which I would like to merge on two conditions. I am doing the following (abstract form) new.data.frame <- merge(df1,df2, by=c("Col1","Col2")) It is giving me a null result. Basically I need to apply two conditions. I also tried sqldf but it is running forever. Will indexing help ? temp <- sqldf("select
2020 Oct 09
1
Aide pour finaliser ce code
Hello. Here is my R code. I used the functional data . Now I need to use the functional data by applying the kernels instead of the xi, yi functions. Bonjour. Voici mon code en R . J'ai utiliser les donn?es fonctionnelles . Maintenant j'ai besoin d'utiliser les donn?es fonctionnelles en appliquant les noyaux ? la place des fontions xi, yi library(MASS)
2009 Jun 10
2
Merge data frame and keep unmatched
Hi, With two data sets, one complete and another one partial, I would like to merge them and keep the unmatched lines. The problem is that merge() dosen't keep the unmatched lines. Is there another function that I could use to merge the data frames. Example: completedf <- expand.grid(alpha=letters[1:3],beta=1:3) partdf <- data.frame( alpha= c('a','a','c'),
2011 May 16
2
conditional rowsums in sapply
Hi all I have a data frame with duplicate columns and i want to remove duplicates by adding rows in each group of duplicates, but have lots of NA's. Data: dfrm <- data.frame(a = 1:4, b= 1:4, cc= 1:4, dd=1:10, ee=1:4) names(dfrm) <- c("a", "a", "b", "b", "b") dfrm[3,2:3]<-NA dfrm a a b b b 1 1 1 1 1 1 2 2 2 2 2 2 3
2018 Feb 01
2
Data Table Merge Help
Hello I'm not sure if this is an appropriate use of this mailing list or not, please let me know if it isn't.? I'm struggling to figure out how to merge two data tables based on max effective date logic compared to when a payment occurred.? My dtDistributions DT is a transactional dataset while dtDepartments is a domain data set containing all department names and the effective date
2007 Aug 27
4
Problem with save or/and if (I think but maybe not ...)
Hi, I recently discovered the R program and I thought it could be useful to me. I have to analyse data saved as .Px file (x between 0 and 8 - .P0 files have 18 lines at the beginning that I have to skip). New files are generated everyday. This is my strategy : In order to analyse the data, I first want to copy the new data in a database in MySQL (which already contains the previous data). So
2011 Jan 31
2
From data frame to list object
Dear all, let say I have following data frame: > data.frame(x=rnorm(18), y=rep(c("a", "b", "c"), each=6)) x y 1 -1.072152537 a 2 0.382985265 a 3 0.058877377 a 4 -0.006911939 a 5 -2.355269051 a 6 -0.303095553 a 7 0.484038422 b 8 0.733928931 b 9 -1.136014346 b 10 0.503552090 b 11 1.708609658 b 12 -0.294599403 b 13
2011 Jan 31
2
Missing at random
R users: Thanks in advance  How to generate missing at random (MAR)? assaedi76@yahoo.com Thanks [[alternative HTML version deleted]]
2013 Mar 06
2
Fwd: How to conditionally remove dataframe rows?
Hi, I have a data frame with two columns. I need to remove duplicated rows in first column, but I need to do it conditionally to values of the second column. Example: Point_counts Psi_Sp 1 A 0 2 A 1 3 B 1 4 B 2 5 B 0
2010 Oct 12
2
merging and working with BIG data sets. Is sqldf the best way??
Hi everyone, I’m working with some very big datasets (each dataset has 11 million rows and 2 columns). My first step is to merge all my individual data sets together (I have about 20) I’m using the following command from sqldf data1 <- sqldf("select A.*, B.* from A inner join B using(ID)") But it’s taking A VERY VERY LONG TIME to merge just 2 of the datasets
2011 Jul 15
3
summarized data set - how to use an "occurs" field
I have a data set with 22 fields and several thousand records in which one field (count) indicates the number of times that each specific combination of the other 21 fields occurred in a bigger and largely unavailable data set. So each record is unique in its combination of field values and has a field that identifies how many multiples of this record actually occurred. Without resorting to
2012 Mar 18
3
Extracting numbers from a character variable of different types
Hello, I have a file which contains a column with age, which is represented in the two following patterns 1. "007/A" or ''007/a" or ''7 /a" ..... In this case A or a means year and I would like to extract only the numeric values eg 7 in the above case if this pattern exits in a line of file. 2. "004/M" or "004/m" where M or m means month
2013 Mar 11
2
how to convert a data.frame to tree structure object such as dendrogram
I have a data.frame object like: > data.frame(x=c('A','A','B','B'), y=c('Ab','Ac','Ba','Bd')) x y 1 A Ab 2 A Ac 3 B Ba 4 B Bd how could I create a tree structure object like this: |---Ab A---| _| |---Ac | | |---Ba B---| |---Bb Thanks, Zech [[alternative HTML version deleted]]
2010 Mar 16
2
Conditional variable assignment
Hi everyone, Once again I am stuck with a problem I can't seem to figure out. I suppose this learning curve levels off eventually, lol. I am learning on my own with absolutely no background in programming, so if I seem to request help a lot it's not because I am seeking others to do the work for me. I need to assign one of two arrival times to the 'ARRIVE' variable of my