Re: [R] "logical indexing, " [was] match() question or needle haystack problem for a data.frame

2018-10-25 Thread Knut Krueger
Am 25.10.18 um 16:13 schrieb peter dalgaard: Yes: x[!(x$A %in% y$B),] Ok thats in my opinion a little workaround why?: There is an = and != < and > means the opposite is available between terms. why is there f.e no %!in%, %notin% or !%in% This would be more intuitive. Kind regards Knut

Re: [R] remove text from nested list

2018-10-25 Thread Ek Esawi
Thank you Bert and Peter. My apology for posting poor code. I cannot create a reproducible example of my data, but i hope the list indices as shown below helps you understand my question.. My regex pattern on my previous post works correctly because i tested it on a few sublists and it worked, but

Re: [R] remove text from nested list

2018-10-25 Thread William Dunlap via R-help
If your matrices are at various depths in the list, try rapply(). E.g., > L <- list( A = list( a1 = matrix(c("AAA","AB", "AAB","AC"),2,2), a2=c("AAx")), list(B = c("AAb1AAA","AAb2"))) > str(L) List of 2 $ A:List of 2 ..$ a1: chr [1:2, 1:2] "AAA" "AB" "AAB" "AC" ..$ a2: chr "AAx" $ :List o

Re: [R] remove text from nested list

2018-10-25 Thread Bert Gunter
1. Please learn how to use dput() to provide examples to responders. There's not much we can do with a text printout (at least without some work that I don't care to do). 2. Do you know what mylist[[c(1,2,1)]] means? If not, read ?(Extract) and note in particular: "[[ can be applied recursively to

Re: [R] remove text from nested list

2018-10-25 Thread Peter Langfelder
You should be more specific about what you want to replace and with what. The pattern you use, namely "[0-9][0-9]/[0-9[0-9].*com", does not (AFAICS) match any of the strings in your data, so don't be surprised that your commands do not change anything. If you have a correct pattern and replacement

[R] remove text from nested list

2018-10-25 Thread Ek Esawi
Hi All— I have a list that contains multiple sub-lists and each sub-list contains multiple sub(sub-lists), each of the sub(sub-lists) is made up of matrices of text. I want to replace some of the text in some parts in the matrices on the list. I tried gsub and stringr, str_remove, but nothing see

Re: [R] "logical indexing, " [was] match() question or needle haystack problem for a data.frame

2018-10-25 Thread Rui Barradas
Hello, 2. x[!x$A %in% y$B, ] 1. An Introduction to R, file R-into.pdf in your docs folder. http://www.cookbook-r.com/Basics/Indexing_into_a_data_structure/ Hope this helps, Rui Barradas Às 15:06 de 25/10/2018, Knut Krueger escreveu: Hi Bert, another question for indexing 1. is there a good

Re: [R] "logical indexing, " [was] match() question or needle haystack problem for a data.frame

2018-10-25 Thread peter dalgaard
> On 25 Oct 2018, at 16:06 , Knut Krueger wrote: > > Hi Bert, > another question for indexing > 1. is there a good manual for indexing ?Extract is at least authoritative > > 2. is it possible to get !%in% > f.e Yes: x[!(x$A %in% y$B),] -pd > x =data.frame("A"=c(1:5),"C"=c("A","B",

Re: [R] "logical indexing, " [was] match() question or needle haystack problem for a data.frame

2018-10-25 Thread Knut Krueger
Hi Bert, another question for indexing 1. is there a good manual for indexing 2. is it possible to get !%in% f.e x =data.frame("A"=c(1:5),"C"=c("A","B","C","D","E")) y =data.frame("B"=c(1,3,5)) test = x[x$A %in% y$B,] test = x[x$A %in% y$B,] test A C 1 1 A 3 3 C 5 5 E means: the result where

[R] findAssocs Heatmap in R

2018-10-25 Thread Elahe chalabi via R-help
Hi all, I have a document term matrix and I would like to have a heatmap (geom_tile) for 20 most associated words to a specific word in it. Here is my dtm:  corpus=Corpus(VectorSource(data$Message))  corpus=tm_map(corpus,tolower) corpus=tm_map(corpus,removePunctuation) corpus=tm_map(corpus,rem

Re: [R] metafor all list elements must be square matrices

2018-10-25 Thread Michael Dewey
Dear Hugh 1 - Your post is unreadable because you posted in HTML so it will be very difficult for anyone to see your V 2 - there is a separate mailing list for meta-analysis in R where you may get more helpful responses as it is monitored by authors of most of the main packages. Please see