[R] Need to compare two columns in two data.frames and return all rows from df where rows values are missing

2021-06-13 Thread Gregg Powell via R-help
Thanks Dr. Michaels. ‐‐‐ Original Message ‐‐‐ On Sunday, June 13th, 2021 at 4:17 PM, William Michels wrote: > Maybe something like this? > > > df_A <- data.frame(names=LETTERS[1:10], values_A=1:10) > > > > df_B <- data.frame(names=LETTERS[6:15], values_B=11:20) > > > > df_AB <-

Re: [R] Need to compare two columns in two data.frames and return all rows from df where rows values are missing

2021-06-13 Thread William Michels via R-help
Maybe something like this? > df_A <- data.frame(names=LETTERS[1:10], values_A=1:10) > df_B <- data.frame(names=LETTERS[6:15], values_B=11:20) > df_AB <- merge(df_A, df_B, by="names") > df_AAB <- merge(df_A, df_AB, all.x=TRUE) > df_BAB <- merge(df_B, df_AB, all.x=TRUE) > df_C <- df_AAB[is.na(df_AAB

Re: [R] Need to compare two columns in two data.frames and return all rows from df where rows values are missing

2021-06-13 Thread Bert Gunter
... but I *think* merge(A, B, by = "name", all = TRUE) is what you want. Rows of NA's correspond to rows that were in one but not the other. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bl

Re: [R] Need to compare two columns in two data.frames and return all rows from df where rows values are missing

2021-06-13 Thread Bert Gunter
As always, a reprex would considerably improve the chances of a useful reply... See the posting guide linked below. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

[R] Need to compare two columns in two data.frames and return all rows from df where rows values are missing

2021-06-13 Thread Gregg Powell via R-help
This is even complicated to write into a question Have two data.frames (A and B) data.frame A and B each have a name column. Want to compare A and B data.frame to each other based on the values in the 'names' columns - for every name that appears in dataframe A  but not B, I want to copy th

[R] Need to compare two columns in two data.frames and return all rows from df where rows values are missing

2021-06-13 Thread Gregg Powell via R-help
This is even complicated to write into a question Have two data.frames (A and B) data.frame A and B each have a name column. Want to compare A and B data.frame to each other based on the values in the 'names' columns - for every name that appears in dataframe A  but not B, I want to copy th

Re: [R] aggregation of irregular interval time-series

2021-06-13 Thread Enrico Gabrielli
Hello thanks to my friend Diego, a computer agronomist, I was able to figure out how to do it. I still have only one problem: how do I calculate the data for the first week? The traps were set up on the fields on May 5th. On that date, a 0 could be entered for all time-series. But how to do it with

Re: [R] covert categoral data into number

2021-06-13 Thread Avi Gross via R-help
JL, There are many ways to do what you want. If you need to do it by yourself using standard R, there are ways but if you are allowed to use packages, like the forcats package in the tidyverse, it can be fairly simple. Here for example is a way to convert a factor with the four levels you mention

Re: [R] snapshot3d hangs during rmarkdown::render

2021-06-13 Thread Duncan Murdoch
I believe I have found and fixed a bug in webshot2 that was causing these problems. My current recommendation for installing it is to use remotes::install_github("dmurdoch/webshot2@fixlockup") For more details (and a bug fix for pkgdown, if you're trying to put dynamic graphics on a pkgdown

Re: [R] most stable way to output text layout

2021-06-13 Thread Jeremie Juste
Hello Jim, On Sunday, 13 Jun 2021 at 08:40, Jim Lemon wrote: > Hi Jeremie, > Or assuming that the matrix will always contain strings: > > tabify<-function(x,col_names=NULL) { > # convert NAs to "NA" > x[is.na(x)]<-"NA" > # if this matrix doesn't have any column names > if(is.null(col_names))

Re: [R] covert categoral data into number

2021-06-13 Thread Jeff Newmiller
factor( DF$numbers , levels=1:4 , labels=c( "bottom", "middle", "high" , "top" ) ) On June 12, 2021 8:24:31 AM PDT, Jxay Ljj wrote: >Hi > >I would like to convert numbers into different categorical levels . For >example, > >In one of column of a dataframe, there are numbers: 1,2