Re: [R] "for" loop does not work with my plot_ly command

2021-03-29 Thread Jim Lemon
Hi Rachida, My guess is that you create a vector of filenames: filenames<-list.files(path="FicConfig",pattern="*.txt") then use the filenames in the loop: for(filename in filenames) { nextfile<- read.table(filename, header = TRUE, sep = "\t" , dec = ",", skip = 0) # do whatever you want with

Re: [R] Word cloud based on a specific site

2021-03-29 Thread Bert Gunter
Also (I think): https://cran.r-project.org/web/views/NaturalLanguageProcessing.html (get to know the CRAN resources!). 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

Re: [R] Word cloud based on a specific site

2021-03-29 Thread Jim Lemon
Hi Marcelo, Just google for "word cloud r". Too much information. Jim On Tue, Mar 30, 2021 at 11:18 AM Marcelo Laia wrote: > > Hi, > > I would like to do a word cloud in a specif site related to a specific > word. > > For example, I could be interested in discovery what are the words > linked to

[R] Word cloud based on a specific site

2021-03-29 Thread Marcelo Laia
Hi, I would like to do a word cloud in a specif site related to a specific word. For example, I could be interested in discovery what are the words linked to word "tree" in a site like www.foo.bar and have the result in a wordcloud image. Please, someone could me point me out a package or a bibl

Re: [R] Spie charts

2021-03-29 Thread Jim Lemon
Hi Abby, Have a look at the first example in the radial.pie function (plotrix). Jim On Tue, Mar 30, 2021 at 7:59 AM Abby Spurdle wrote: > > I couldn't find a predefined function for this purpose. > However, it wouldn't be too difficult to write a pair of functions. > > The big question is how fl

Re: [R] using eigen function in MAP and purr

2021-03-29 Thread John Fox
Dear V. K. Chetty, Perhaps I'm missing something but why wouldn't you just use a list of matrices, as in the following? -- snip - > set.seed(123) # for reproducibility > (Matrices <- lapply(1:3, function(i) matrix(sample(1:50, 4), 2, 2))) [[1]] [,1] [,2] [1,] 31 14

Re: [R] Colorizing different individuals with fviz

2021-03-29 Thread Mahmood Naderan-Tahan
I understand that I came across this error after that ind <- get_famd_ind(res.famd) fviz_famd_ind(res.famd, col.ind = ifelse(ind>10,"red","black"), repel = TRUE) Error in ifelse(ind > 10, "red", "black") : 'list' object cannot be coerced to type 'double' Calls: fvi

[R] using eigen function in MAP and purr

2021-03-29 Thread Veerappa Chetty
I want to use map and purr functions to compute eigen values for 3000 matrices. Each matrix has 2 rows and 2 columns. The following code does not work. test.dat<- tibble(ID=c(1,2),a=c(1,1),b=c(1,1),c=c(2,2),d=c(4,3)) test.out<-test.dat %>% nest(-ID) %>% mutate(fit = purrr::map(data,~ function(x)

Re: [R] Colorizing different individuals with fviz

2021-03-29 Thread Bill Dunlap
That error means that fviz_famd_ind has more than one argument that starts with 'col' and you must type a more complete name to disambiguate it. Perhaps col.ind=ifelse(...)? > args(factoextra::fviz_famd_ind) function (X, axes = c(1, 2), geom = c("point", "text"), repel = FALSE, habillage = "n

Re: [R] Colorizing different individuals with fviz

2021-03-29 Thread Mahmood Naderan-Tahan
Hi Jim, It seems that the following proposed method doesn't work ind <- get_famd_ind(res.famd) fviz_famd_ind(res.famd, col=ifelse(x>10,"red","black"), repel = TRUE) Result is: Error in fviz_famd_ind(res.famd, col = ifelse(x > 10, "red", "black"), : argument 2 m

Re: [R] Spie charts

2021-03-29 Thread Abby Spurdle
I couldn't find a predefined function for this purpose. However, it wouldn't be too difficult to write a pair of functions. The big question is how flexible does the rendering function need to be? #plot from angles, distances, etc #(angles on arbitrary scale) spiechart.render <- function ( an

Re: [R] "for" loop does not work with my plot_ly command

2021-03-29 Thread Mika Hamari
Hi! I am also learning, but I want try to help. I often use for-loop in R. I think that it could be due to dimensions of CPM, not the structure of the loop. What kind of error message do you get? Is it: �incorrect number of dimensions�? What happens if you substitute in the end instead of CPM[i

Re: [R] seed problem?

2021-03-29 Thread Mika Hamari
Thank you Bill for your help! In other cases this surely is good thing to check, but in my case it helped earlier today that I removed .RData file according to Jeff�s answer: �Check if you have a .RData file in your R startup directory. It may contain the seed.� Now that this file doesn�t exis

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Stefano Sofia
Maximum at the right endpoint is well accpted in both cases. If I am correst, I just append -Inf at the right end and then I apply what you wrote. Thank you. (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Secti

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Bill Dunlap
Your original query included > x <- c(1,0,0,0,2,2,3,4,0,1,1,0,5,5,5,0,1) ... I need 8 10 13. Did you also want the 1's at the ends to count as local maxima, so the result would be c(1,8,10,13,17)? Or do you want the maxima at endpoints only if there are no others? -BIll On Mon, Mar 29, 20

Re: [R] seed problem?

2021-03-29 Thread Bill Dunlap
Does this happen if you start R with the --vanilla flag? If so it may be that you have a startup file, .\.Rprofile or %HOME%\.Rprofile that is calling set.seed(n) for a fixed n. -Bill On Mon, Mar 29, 2021 at 12:16 AM Mika Hamari wrote: > > Hi! > > I have Windows 10 on PC and different versions

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Stefano Sofia
Thank you Bill, your tip solved everything. Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: s

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Bill Dunlap
If you want to accept maxima at the ends of the series, append -Inf to each end and subtract one from the result. Note that this will make even a constant sequence have a local maximum at 1. On Mon, Mar 29, 2021 at 6:52 AM Stefano Sofia wrote: > > Dear Bill, Bert, Greg and Abby, > I tested your

[R] "for" loop does not work with my plot_ly command

2021-03-29 Thread Rachida El Ouaraini
Hi everyone, I am new to R programming, and I am having difficulties modifying an R script to introduce the "for" loop in the code. While searching I found that this issue has already been raised, but I did not know what to do to fix mine ! *The code that works (without for command):* CPM <- read

[R] Dynamically defining dplyr across statements (was dplyr: summarise across using variable names and a condition)

2021-03-29 Thread Paul Miller via R-help
Hello All, Thanks Rui for your response to my question. I agree that it is possible to use a workaround. Get most of what you want and then tidy it up afterwards. I too have a workaround that I have pasted below. I wanted to avoid that initially. I felt I was only using a workaround because I h

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Greg Minshall
Stefano, i notice that my and Bill's (pretty much isomorphic) solutions give a zero-length vector. i don't remember Bert's, but it's probably gives similar results. your code could check for that result, and react accordingly. cheers, Greg __ R-help@

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Stefano Sofia
Dear Bill, Bert, Greg and Abby, I tested your code (honestly apart from Abby's solution because it needed an additional package and I run R in a server which is not administrated by myself), they work and I found them equivalent. (Probably Bill's and Greg's solutions are a bit faster than Bert's

[R] Spie charts

2021-03-29 Thread Thomas Subia via R-help
Ferri, Radar Charts are often used to compare two or more items or groups on various features or characteristics. However, as the number of groups increases, the user has a harder time making comparisons between groups. As the number of groups increase, the number of spokes of the radar chart in

Re: [R] seed problem?

2021-03-29 Thread Mika Hamari
Thank you, Jeff! I had that file, and when I removed it, that solved the problem. Now random numbers are really random. Excellent! Mika Lähetetty Samsung Galaxy -älypuhelimesta. Alkuperäinen viesti Lähettäjä: Jeff Newmiller Päivämäärä: 29.3.2021 10.31 (GMT+02:00) Saaja: r-h

Re: [R] seed problem?

2021-03-29 Thread Jeff Newmiller
Check if you have a .RData file in your R startup directory. It may contain the seed. .RData files (without anything in front of the period) are dangerous... many R users avoid them because they can easily drag in mistakes from previous sessions to plague you. On March 28, 2021 9:02:17 AM PDT,

[R] seed problem?

2021-03-29 Thread Mika Hamari
Hi! I have Windows 10 on PC and different versions of R. I noticed that when I executed simulation with R 4.0.3, it gave exactly the same results next time when I re-opened the program. I didn�t set the seed. I tested this also with simple �rnorm(10,100,10)�, and the results were every time th