similar to: Populate one data frame with values from another dataframe for rows that match

Displaying 20 results from an estimated 1000 matches similar to: "Populate one data frame with values from another dataframe for rows that match"

2017 Oct 14
0
Populate one data frame with values from another dataframe for rows that match
Your example used one distinct studyno in DF1 and one distinct pf_mcl in DF2. I think that makes it hard to see what is going on, but maybe I completely misunderstand the problem. In any case, let's redefine myDF1 and myDF2. Note that myDF1 contains a studyno not in myDF2 and vice versa. myDF1 <- structure(list(studyno = c("J1000/9", "J895/7", "J931/6",
2017 Oct 15
1
Populate one data frame with values from another dataframe for rows that match
Dear @William<mailto:wdunlap at tibco.com>, thanks for the feedback. I have tested it on the larger dataset and noticed that it created two variables, pf_raw and pf_curated. The output we were looking for, was one that takes the variable pf_mcl in curated dataset and replaces pf_mcl in matching rows within the raw dataset. @Eric<mailto:ericjberger at gmail.com>?s solution was able to
2017 Oct 14
0
Populate one data frame with values from another dataframe for rows that match
Hi Kevin, I think there are issues with Rui's proposed solution. For example, if there are rows in myDF1 which have a studyno which does not match any row in myDF2, then you will lose those rows. In your original request you said that you wanted to keep those rows. To demonstrate my point I need to modify your sample data. Specifically, I changed some studyno settings in myDF1, and also the
2017 Oct 14
2
Populate one data frame with values from another dataframe for rows that match
Dear @Bert Gunter<mailto:bgunter.4567 at gmail.com>, I tried merge and I faced many challenges. @Rui Barradas<mailto:ruipbarradas at sapo.pt> solution is working. From: Bert Gunter <bgunter.4567 at gmail.com> Date: Friday, 13 October 2017 at 22:44 To: Kevin Wamae <KWamae at kemri-wellcome.org> Cc: R-help <R-help at r-project.org> Subject: Re: [R] Populate one data
2017 Oct 14
2
Populate one data frame with values from another dataframe for rows that match
Dear @Rui Barradas, thank you for the solution. It works perfectly. On 13/10/2017, 23:35, "Rui Barradas" <ruipbarradas at sapo.pt> wrote: Hello, Try the following. myDF1$studyno <- as.character(myDF1$studyno) myDF2$studyno <- as.character(myDF2$studyno) i1 <- which(names(myDF1) == "pf_mcl") merge(myDF1[-i1], myDF2,
2017 Oct 13
0
Populate one data frame with values from another dataframe for rows that match
Hello, Try the following. myDF1$studyno <- as.character(myDF1$studyno) myDF2$studyno <- as.character(myDF2$studyno) i1 <- which(names(myDF1) == "pf_mcl") merge(myDF1[-i1], myDF2, by = "studyno") Hope this helps, Rui Barradas Em 13-10-2017 20:09, Kevin Wamae escreveu: > I'm trying to populate the column ?pf_mcl? in myDF1 with values from myDF2, where rows
2017 Oct 13
0
Populate one data frame with values from another dataframe for rows that match
?merge Bert On Oct 13, 2017 12:09 PM, "Kevin Wamae" <KWamae at kemri-wellcome.org> wrote: > I'm trying to populate the column ?pf_mcl? in myDF1 with values from > myDF2, where rows match based on column "studyno" but the solutions I have > found so far don't seem to be giving me the desired output. > > Below is a snapshot of the data.frames. >
2018 Feb 22
0
alternative for multiple if_else statements
Hi Kevin, I ran the code on the full data set and was able to reproduce the problem that you are facing. My guess is that you have an error in your intuition and/or logic, and that this relates to the use of the subscript [1]. Specifically, on the full dataset, the condition trialData$date[trialData$survey_start == "Y" & trialData$year == 2013 & trialData$site ==
2018 Feb 21
7
alternative for multiple if_else statements
Hi, I am having trouble trying to figure out why if_else is behaving the way it is, it may be my code or the way the data is structured. Below is a snapshot of a database am working on and it represents a longitudinal survey of study participants in a trial with weekly follow up. The variable "survey_start" represents the start of the study-defined one year follow up (which we called
2018 Feb 22
0
alternative for multiple if_else statements
I don't fully understand the logic you are trying to implement, but something along the lines of foo <- cut(trialData$date, breaks = as.Date(c("2007-01-01", "2008-05-01", "2009-04-01", "2010-05-01",
2018 Feb 26
0
alternative for multiple if_else statements
That many ifelse statements is obviously rather a pain. Would you not have got what you want with ... paste("survey", year, sep="_") ? If that is not what you're looking for (eg because 'year' is the observation year and not the study start year), perhaps something that picks the minimum year for a subject or other relevant group might work? For example
2004 Mar 10
3
Center labels on a boxplot
Suppose that I have data on three species for a variable and datasets from two time periods. I want to make a boxplot of the first dataset and then add the second using 'at = ' and 'add = T' as in the example for 'boxplot.' Since the boxes are paired by species, I want to do is have the x labels be centered between the boxes. I'm doing this now with mtext and entering
2009 Mar 05
3
Dropping rows conditionally
Dear R-help team, I am getting addicted to using R but keep on getting many challenges on the way especially on data management (data cleaning). I have been wanting to drop all the rows if there values are `NA' or have specific values like 1 or 2 or 3. mdat <- matrix(1:21, nrow = 7, ncol=3, byrow=TRUE, dimnames = list(c("row1",
2008 Jul 22
3
Error in installing packages
Dear R Users; I am an R user who has recently bought a new laptop;Toshiba Satellite U405 running on both Windows Vista and Ubuntu. I have problems on the wondows vista when installing packages. The argument 'lib' is missing. How do i solve this problem? Illustration: > install.packages("epicalc") Warning in install.packages("epicalc") : argument 'lib'
2011 Jan 17
2
Summing data frame columns on identical data
Dear all, I have 9 data frames, and I'm simply trying to sum the values of column 3 (on a row-by-row basis). However, there are a slightly different number of rows in each data frame, so I'm receiving the following error: "Error in Ops.data.frame(mrunoff_207101[3], mrunoff_207102[3]) : ? + only defined for equally-sized data frames". Here is what I'm attempting to do:
2009 Aug 20
2
getting R 2.9.1 from the tar.gz file
Dear Sir, I am almost giving up on getting the R-2.9.1 on the ubuntu 9.04 using the instructions found on the R site. I decided to use the R-2.9.1.tar.gz and untarred it. I then typed ./configure and the results are shown below. However, on typing make, I got an error, "No targets specified and no makefile found stop" What is the solution? lmramba at LMramba-dll-d:~$ su Password:
2009 Dec 04
1
z to r transformation within print.rma.uni and forest from the package metafor
Dear R community, I'm using the ,metafor'-package by Wolfgang Viechtbauer (Version: 0.5-5) to calculate random-effects meta-analyses using Correlations and Sample Sizes as the raw data. (By the way: Really a nice piece of work, Wolfgang! Thanks heaps.) I specified the "rma.uni' function so that it looks like this: MAergebnis<-rma.uni(ri=PosOutc, ni=N,
2008 Mar 28
3
Converting a data frame to matrix
Hello: I have a tab delim file with 100 rows and 100 columns. I have numerical values in this table. What I want is to create an image color map with color gradation. my values range from -5 to 0. max value is 0. to acheive this, I need to convert my data.frame into matrix. I tried following : mydf <- read.table('mytable',sep='\t',header=T) mydf1 <- mydf[,2:100]
2013 Jan 29
2
converting XML document to table or dataframe
I am a relatively new user to R, and I am trying to learn more about converting data in an XML document into "2-dimensional format" such as a table or array. I might eventually wish to export this data into a relational database such as SQL, and/or to work with this data within the R package. My sample XML document is located at "
2008 Dec 09
2
assign()ing within apply
Hello, I'm trying to convert a character column in several dataframes to lower case. ### # # Sample data and 'spp' column summaries: # dput(ban.ovs.1993[sample(row.names(ban.ovs.1993), 20), 1:4]) ban.ovs.93 <- structure(list(oplt = c(43L, 43L, 38L, 26L, 35L, 8L, 39L, 1L, 34L, 50L, 10L, 29L, 31L, 24L, 18L, 12L, 27L, 49L, 28L, 51L), rplt = c(NA_integer_, NA_integer_,