search for: mydf2

Displaying 20 results from an estimated 20 matches for "mydf2".

Did you mean: mydf
2017 Oct 13
4
Populate one data frame with values from another dataframe for rows that match
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. myDF1 <- structure(list(studyno = c("J1000/9", "J1000/9", "J1000/9", "J1000/...
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, by = "studyno") Hope this helps, Rui Barradas Em 13-10-2017 20:09, Kevin Wamae escreveu: > I'm trying to populate t...
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 entries of pf_mcl in myDF1. myDF1 <- structure(list(studyno = c(...
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...
2017 Oct 14
2
Populate one data frame with values from another dataframe for rows that match
...late 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<mailto: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. myDF1 <- structure(list(studyno = c("J1000/9", "J1000/9", "J1000/9", "J1000/...
2017 Oct 15
1
Populate one data frame with values from another dataframe for rows that match
...late 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", "J666/6", "J1000/9", "J1000/9"), date = structure(c(17123, 17127, 17135, 17144, 17148, 17155), class =...
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", "J666/6", "J1000/9", "J1000/9"), date = structure(c(17123, 17127, 17135, 17144, 17148, 17155), class =...
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. > > myDF1 <- structure(list(studyno = c("J1000/9", "J1000/9", "J100...
2004 Mar 10
3
Center labels on a boxplot
...better way. Much thanks, Andy ####################### myDF1 <- data.frame(spp1 = c(0,0,0,0,1,0,1,1,0,0,0,1), spp2 = c(1,0,1,1,0,0,0,0,1,0,0,0), spp3 = c(0,1,0,0,0,1,0,0,0,1,1,0), aVar = runif(12, 1, 10) + 1:12) myDF2 <- data.frame(spp1 = c(1,1,0,0,0,0,0,0,1,0,0,1), spp2 = c(0,0,1,1,0,0,0,1,0,0,1,0), spp3 = c(0,0,0,0,1,1,1,0,0,1,0,0), aVar = runif(12, 1, 10) + 1:12) boxplot(aVar ~ spp1 + spp2 + spp3, data = myDF1, boxwex = 0.25, at...
2013 Jan 29
2
converting XML document to table or dataframe
...tionPricePerShare$value_2 $nonDerivativeTable$nonDerivativeTransaction$transactionAmounts$transactionPricePerShare$value_3 etc myxml = xmlParse(" http://www.sec.gov/Archives/edgar/data/743988/000124636013000561/form.xml") mylist <- xmlToList(mydoc) mydf <- xmlToDataFrame(mydoc) mydf2 <- data.frame(mylist) mytable <- as.table(mylist) mydf2 <- data.frame(mydoc) mytable <- as.table(mydoc) [[alternative HTML version deleted]]
2004 Sep 14
3
erase columns
Can somebody remember me which is the command to erase columns from a data frame? Thanks Michele ___________________________________ http://it.seriea.fantasysports.yahoo.com/
2009 Nov 08
0
trend thresholds on time series
...it. x<-1:1500 y<-x/exp(x^0.2) smaller15<-y[y<15] y<-ifelse(y<15,y+rnorm(length(smaller15)), 15+rnorm(1000-length(smaller15), 0, 0.9)) myDF1<-data.frame(cbind(x,y)) plot(y~x, data=myDF1) k1<-1:10 l1<- -65*k1*k1+750*k1-500 k2<-12:25 l2<-2.6299*k2*k2- 104.39*k2 + 1000 myDF2<-data.frame(cbind(k=c(k1,k2),l=c(l1,l2))) plot(l~k, data=myDF2) As one can see, the first simulation we have a non-linear ascendent y-response, and after ~500 time steps the simulation change the behaviour to almost stable results. By other side, on second example I get a fast increasing, subse...
2011 Jun 09
1
Using a function inside a function
...ison")) myfunc <- function(lst) { myone <- function(x, y) { nu <- do.call(paste, expand.grid(x, y)) mydf <- data.frame(keyword=c(nu)) } mytwo <- function(x, y, z){ mu <- do.call(paste, expand.grid(x, y, z)) mydf2 <- data.frame(keyword=c(mu)) } d1 = mytwo(lst$prefix, lst$roots, lst$suffix) d2 = mytwo(lst$prefix, lst$roots, lst$suffix2) d3 = mytwo(lst$prefix, lst$roots, lst$suffix3) d4 = mytwo(lst$prefix2, lst$roots, lst$suffix) d5 = mytwo(lst$prefix2, lst$roots, lst$suf...
2004 Aug 03
4
How to select a whole column? Thanks!
Dear all, I hope to remove a whole column from a data frame or matrix (> 2000 columns). All value in the column are same. The first thing is to select those columns. For instance, I hope to remove the V3~6 column, for all the value in those colume is zero. V3 V4 V5 V6 V7 V8 V9 V10 1 0 0 0 0 0.000 0.000 0.000 0.000 2 0 0 0 0 0.000 0.000 0.000 0.000 3 0 0 0
2011 Sep 03
2
problem in applying function in data subset (with a level) - using plyr or other alternative are also welcome
Dear R experts. I might be missing something obvious. I have been trying to fix this problem for some weeks. Please help. #data ped <- c(rep(1, 4), rep(2, 3), rep(3, 3)) y <- rnorm(10, 8, 2) # variable set 1 M1a <- sample (c(1, 2,3), 10, replace= T) M1b <- sample (c(1, 2,3), 10, replace= T) M1aP1 <- sample (c(1, 2,3), 10, replace= T) M1bP2 <- sample (c(1, 2,3), 10, replace= T)
2011 Jun 09
1
Trying to make code more efficient
...st), agency=c(agency)) myone <- function(x, y) { m1 <- do.call(paste, expand.grid(lst[[x]], lst[[y]])) mydf <- data.frame(keyword=c(m1)) } mytwo <- function(x, y, z){ m2 <- do.call(paste, expand.grid(lst[[x]], lst[[y]], lst[[z]])) mydf2 <- data.frame(keyword=c(m2)) } d1 = mytwo("prefix", "roots", "suffix") d2 = mytwo("prefix", "roots", "suffix2") d3 = mytwo("prefix", "roots", "suffix3") d4 = mytwo("prefix...
2011 Jun 09
1
Error: missing values where TRUE/FALSE needed
...t;), suffix2 = c("rate", "rates"), suffix3 = c("comparison")) myone <- function(x, y) { nu <- do.call(paste, expand.grid(lst$x, lst$y)) mydf <- data.frame(keyword=c(nu)) } mytwo <- function(x, y, z){ mu <- do.call(paste, expand.grid(lst$x, lst$y, lst$z)) mydf2 <- data.frame(keyword=c(mu)) } d1 = mytwo(lst$prefix, lst$roots, lst$suffix) d2 = mytwo(lst$prefix, lst$roots, lst$suffix2) d3 = mytwo(lst$prefix, lst$roots, lst$suffix3) d4 = mytwo(lst$prefix2, lst$roots, lst$suffix) d5 = mytwo(lst$prefix2, lst$roots, lst$suffix2) d6 = mytwo(prefix2, roots, suf...
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:
2013 Apr 06
1
Replace missing values within a group with the non-missing value
I have a large dataset organised in choice groups see below. Each choice represents a separate occasion with 1 product chosen out of the 6 offered.            +-------------------------------------------------------------------------------------------------+      | dn   obs   choice      acid   br                 date       cdate   situat~n   mth   year   set |     
2010 Feb 23
5
export tables to Excel files
Dear R users, I've just posted a similar question about Illustrator. This time I would like to export the results of my statistic tables and my dataframes into Excel files. Up to now I've used write.csv(), but I have to resave every file in .xls in Excel. I would like to know if there is a function or package to export directly into *.xls. I have found xlsReadWrite which would be