search for: mydf1

Displaying 16 results from an estimated 16 matches for "mydf1".

Did you mean: mydf
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 W...
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 o...
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", "J100...
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 popula...
2008 Mar 28
3
Converting a data frame to matrix
...ve 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] colnames(mydf1) <- as.character(mydf[,1]) here comes the trouble: mymat <- as.matrix(mydf1) -- numerical values become character values. -1 becomes "-1" mymat <- data.matrix(mydf1) -- whole matrix is filled with 1,2 and 3. Is there any other way I can do...
2017 Oct 14
2
Populate one data frame with values from another dataframe for rows that match
...; Subject: Re: [R] 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<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", "J100...
2017 Oct 15
1
Populate one data frame with values from another dataframe for rows that match
...: [R] 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...
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...
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", &qu...
2004 Mar 10
3
Center labels on a boxplot
...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 spaces to make them center. There must be a 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),...
2007 May 17
2
How to select specific rows from a data frame based on values
...variables): subj1 <- cbind(-4, -3, -1, -5, -7) subj2 <- cbind(-2, -1, -1, -2, +2) subj3 <- cbind(+2, +1, +2, +1, +2) subj4 <- cbind(-4, -1, -2, +2, +1, +1) mydf <- as.data.frame(rbind(subj1, subj2, subj3, subj4)) >From mydf, I want to generate a new dataframe (let's call it mydf1) which will have records of only subj2 and subj3 in it since only these two individuals had all values for variables V1 through V5 in mydf to range between -3 and +3. Documentation on subsetting and indexing data frames did not help to solve this specific problem. There may be an obvious solution...
2013 Mar 14
2
Modifying a data frame based on a vector that contains column numbers
Hello! # I have a data frame: mydf<-data.frame(c1=rep(NA,5),c2=rep(NA,5),c3=rep(NA,5)) # I have an index whose length is always the same as nrow(mydf): myindex<-c(1,2,3,2,1) # I need c1 to have 1s in rows 1 and 5 (based on the information in myindex) # I need c2 to have 1s in rows 2 and 4 (also based on myindex) # I need c3 to have 1 in row 3 # In other words, I am trying to achieve this
2009 Nov 08
0
trend thresholds on time series
...s, and I would like to identify the thresholds for trend changes. Fro example, below I forced two different response behaviours and on x is time unit. 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 a...
2010 Jun 13
1
S4 classes and S3 generic functions
...nce, an S4 method for signature '"data.frame"' for function 'f3()' would be called for the S3 object 'df1'. A similar S4 method for primitive function '`[`' would be ignored for that object, but would be called for the S4 object 'mydf1' that inherits from '"data.frame"'. Defining both an S3 and S4 method removes this inconsistency.
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:
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