similar to: Subtracting rows by id

Displaying 20 results from an estimated 3000 matches similar to: "Subtracting rows by id"

2010 Mar 03
5
Matching rows in a Data set? I'm Stuck!!
Hi, I'm having (yet another) problem with R. I have a few data sets that have this sort of format dataset1 ID DATA 1234 value 2345 value 3456 value dataset2 ID DATA 1111 value 2345 value 3333 value What i really want to do is write an R script that says "if the ID of dataset1 and 2 match (2nd row), print out that whole row into a new dataset3". No idea how to do that though.
2009 Dec 08
4
Split comma separated list
Hi all, I'm a beginner user of R. I am stuck at what I thought was a very obvious problem, but surprisingly, I havent found any solution on the forum or online till now. My problem is simple. I have a file which has entries like the following: #ID Value1 List_of_values ID1 0.342 0.01,1.2,0,0.323,0.67 ID2 0.010 0.987,0.056,1.3,1.5,0.4
2012 Feb 09
1
sample points - sp package
When I make a sample in sp, for example a random samping of 5 points in dataset1: sample.dataset1=spsample(dataset1, n = 5, "random") I have a sp object for the selected sampling... My question is : How can I extract from dataset2 the points & data for the coordinates(sample.dataset1) ? The dataset2 would be an object with the same area and coordinate system, but I would like to
2011 Jun 01
1
Replacing variables in one dataset with those from another
Hoping someone out there can help me...this seems like an easy task but I can't figure it out... I want to replace variables in one dataset (Dataset1) with a variable from another dataset (Dataset2). All the values for variables x1 and x2 in Dataset1 have a unique match to the variable uniquenum in Dataset2. For example, in Dataset1 grpnum A has a value of 343 for variable x1. In Dataset2,
2009 Nov 17
3
Perform operations on dataframes called with paste in loops
In a loop, I compose the name of a csv file using paste, then read it (e.g., dataset1.csv, dataset2.csv, etc). The name of the dataframe assigned to the imported csv is also composed with paste (e.g., dataset1, dataset2, etc.). Now I want to perform operations on the dataframes dataset1, dataset2, etc. However, the paste function only renders a string on which I can not, for example, do operations
2013 Mar 07
1
create vector from indices interpolated values
Readers, Is it possible to create a plot command based upon the indices of missing values in a data set? dataset1<-read.table(text=' 10 2 20 NA 30 5 40 7 50 NA 60 NA 70 2 80 6 90 NA 100 9 ') dataset2<-read.table(text=' 0.2 0.4 0.1 0.9 0.2 0.3 1.1 0.7 0.9 0.6 0.4 ') The 'approx' function is used to obtain the interpolated values for 'NA' in dataset1.
2012 Aug 09
2
correlating rows of two differently-sized data frames in R
Hello everyone, I have two sets of data, with the following structure: DataSet1 Location Part Sample 1 Sample 2 A 1 value value A 2 value value A 3 value value B 1 value value DataSet2 Location Sample 1 Sample 2 A
2011 Jul 21
2
Latex Table Help on R
Hello everyone, Peter (see my earlier post) recommended the following script for finding the means and standard deviations and putting them in table form. However, I would like the standard deviations under the means in brackets. Can anyone check this code to see how this can be adjusted? library(xtable) dataset1 = matrix( c(1,2,3,4, 5, 6 ), 2 , 3) dataset2 = matrix( c(4,3,5,10, 1, 0), 2, 3)
2006 Aug 02
1
questions on aggregate data
Dear friends, my question is how to aggregate dataset and the inverse manipulation. e.g.My dataset data structure1: x 1 1 2 3 3 data structure2: x freq 1 2 2 1 3 2 Then how to generate dataset2 from dataset1 and generate dataset1 from dataset2? e.g. dataset2 from dataset1 : x<-c(1,1,2,3,3) a<-tab(x) as.data.frame(a) *But i can't do the inverse manipulation:generate dataset1 from
2011 Jul 20
1
Latex Table for means and standard deviations in brackets
Hello all, I am new to xtable. I have several datasets in the form of matrices. Consider the following two simple datasets which are 2 x 3 matrices. The rows in both matrices have the same meaning. For example the first row of both matrices are variable 1 and the second row of both matrices are variable 2. dataset1 = matrix( c(1,2,3,4, 5, 6 ), 2 , 3) dataset2 = matrix( c(4,3,5,10, 1, 0), 2, 3)
2011 Oct 11
1
filtering rows
Hi everyone, I've got two data sets as below. My question now is: how can I use Dataset2 as a filter for Dataset1? My goal is just to keep the rows of Dataset1 where the first column (Date) matches the Dates in Dataset2. I would appreciate any solutions to this issue. Many thanks! S.B. Dataset1: Date A B C D 1
2009 Sep 22
2
Creating loops with strings
Hello. I'm trying to run a series of commands in two different datasets. For make it efficient I want to make a loop for it. Until now the only command for loops i found it's the for() command it's only for series of numbers and not a series of strings, witch it's what i'm needing. It would be something like this for(i in dataset1 dataset2) { i <-
2017 Jun 21
0
Help/ Mathematics
Hi Ahmed, Your problem appears trivial as you have already specified the form of the calculation. Learn how to "extract" specified elements from a data structure: # first value sum(dataset1$NPP[dataset1$date >= date1 & dataset1$date <= date2]) # second value dataset2$biomass[dataset2$date == date2] - dataset2$biomass[dataset2$date == date1] # third value
2012 Jan 13
2
More issues with apply
Hi all, Please consider the following: DataSet1.. <- data.frame(Bldgtype=c("SFDM","SFDM","SFDM","SFDM","SFDM","SFDM","APT"), Taz=c("254","254","254","564","564","564","564"),stringsAsFactors = FALSE) PeriodResType_Zx <-
2009 Jul 15
1
loading multiple .Rdata and preserving variable names
Dear R-users, I need to load outputs from multiple previous calculations into one R session for comparison and (cross-)analysis. The previous calculations are stored in different directories in .Rdata files (I don't know if this is the best storage for later usage, but the previous project could be recalculated and saved into different format, if needed, potentially.) I can load consequently
2012 Apr 14
3
Choose between duplicated rows
Dear r experts, Sorry for this basic question, but I can't seem to find a solution? I have this data frame: df <- data.frame(id = c("id1", "id1", "id1", "id2", "id2", "id2"), A = c(11905, 11907, 11907, 11829, 11829, 11829), v1 = c(NA, 3, NA,1,2,NA), v2 = c(NA,2,NA, 2, NA,NA), v3 = c(NA,1,NA,1,NA,NA), v4 = c("N",
2006 Sep 13
3
group bunch of lines in a data.frame, an additional requirement
Thanks for pointing me out "aggregate", that works fine! There is one complication though: I have mixed types (numerical and character), So the matrix is of the form: A 1.0 200 ID1 A 3.0 800 ID1 A 2.0 200 ID1 B 0.5 20 ID2 B 0.9 50 ID2 C 5.0 70 ID1 One letter always has the same ID but one ID can be shared by many letters (like ID1) I just want to keep track of the ID, and get
2008 Jul 09
2
Parsing
Dear R users, I have a big text file formatted like this: x x_string y y_string id1 id1_string id2 id2_string z z_string w w_string stuff stuff stuff stuff stuff stuff stuff stuff stuff // x x_string1 y y_string1 z z_string1 w w_string1 stuff stuff stuff stuff stuff stuff stuff stuff stuff // x x_string2 y y_string2 id1
2011 Apr 25
2
Problem with ddply in the plyr-package: surprising output of a date-column
Hi Together, I have a problem with the plyr package - more precisely with the ddply function - and would be very grateful for any help. I hope the example here is precise enough for someone to identify the problem. Basically, in this step I want to identify observations that are identical in terms of certain identifiers (ID1, ID2, ID3) and just want to save those observations (in this step,
2013 Apr 12
1
Removing rows that are duplicates but column values are in reversed order
Hi, From your example data, dat1<- read.table(text=" id1?? id2?? value a????? b?????? 10 c????? d??????? 11 b???? a???????? 10 c????? e???????? 12 ",sep="",header=TRUE,stringsAsFactors=FALSE) #it is easier to get the output you wanted dat1[!duplicated(dat1$value),] #? id1 id2 value #1?? a?? b??? 10 #2?? c?? d??? 11 #4?? c?? e??? 12 But, if you have cases like the one