Re: [R] grep

2021-05-08 Thread Rui Barradas
Hello, Maybe instead of a loop, vectorize with logical indices. i1 <- is.na(jindex) i2 <- is.numeric(jindex) if(any(!i1)){ if(any(!i2)){ words <- jindex[!i1 & !i2] pattern <- paste(words, collapse = "|") jindex <- grep(pattern = pattern, x.label, value = FALSE) } jj <- jindex[

Re: [R] factor analysis of dynamic structure (FADS) for a huge time-series data

2021-05-08 Thread Ranjan Maitra
I am an author of the paper behind the fad package. I suspect that the call is not correct. Actually, fad does not quite account for time series or other structured data and you have to enter it, as in all general EFA packages as a n x p matrix, with n the number of observations and p the number

Re: [R] grep

2021-05-08 Thread Steven Yen
Thank to Rui, Jeff, and Bert. They are all very useful. Somewhat related is the following, in which jindex is a numeric or alphanumeric vector in a function that starts with try<-function(, jindex=NA) In the if loop, in the first line I am trying to determine whether the vector jindex is

Re: [R] factor analysis of dynamic structure (FADS) for a huge time-series data

2021-05-08 Thread Jeff Newmiller
This not being a question about R, but rather about statistics, or possibly about a contributed package, means (per the Posting Guide) that you should be asking in a statistics forum like stats.stackexchange.com or corresponding with the author of the package in question. If you are lucky someon

[R] factor analysis of dynamic structure (FADS) for a huge time-series data

2021-05-08 Thread Hyun Soo Park
Dear R users, I want to find the latent factors from a kind of time-series data describing temporal changes of concentration using a factor analysis technique called 'factor analysis of dynamic structure (FADS).' I learned how to form the data for the analysis using a proper package embedding FADS

Re: [R] grep

2021-05-08 Thread Rui Barradas
Hello, The pattern can be assembled with paste(., collapse = "|"). With the same vector of names, nms: words <- c("black","conserv") pattern <- paste(words, collapse = "|") grep(pattern = pattern, nms, value = TRUE) #[1] "x1.black" "x1.conserv" "x2.black" "x2.conserv" Hope this helps, Ru

Re: [R] grep

2021-05-08 Thread Jeff Newmiller
Regular expression patterns are not vectorized... only the data to be searched are. Use one of the many websites dedicated to tutoring regular expressions to learn how they work. (Using function names like "names" as data names is bad practice.) nms <- c( "x1.one", "x1.black", "x1.othrrace", "x

Re: [R] grep

2021-05-08 Thread David Winsemius
On 5/8/21 10:00 AM, Steven Yen wrote: Below, the first command simply creates a list of 16 names (labels) which can be ignore. In the 2nd and 3rd commands, I am able to identify names containing "black". In line 4, I am trying to identify names containing "black" or "conserv" but obviousl

[R] grep

2021-05-08 Thread Steven Yen
Below, the first command simply creates a list of 16 names (labels) which can be ignore. In the 2nd and 3rd commands, I am able to identify names containing "black". In line 4, I am trying to identify names containing "black" or "conserv" but obviously it does not work. Can someone help? Thank