R 3.1.0 OS X Colleagues
I have an array (I am using T/F rather than TRUE/FALSE for convenience) that could have patterns like: c(T, T, T, F, F, F, T, F, T, T, T) ## T at either end, a single T in the middle c(F, F, F, F, F, T, F, F, T, T, T) ## T at the tail end, a single T in the middle c(T, T, T, F, F, T, T, F, F, F, F) ## T at the front end, two T in the middle c(T, T, T, F, F, T, T, F, T, F, F) ## T at the front end, three T in the middle (not contiguous) c(F, F, F, F, F, T, F, F, F, F, F) ## no T at either end, a single T in the middle There might (or might not) be one or more T at the beginning (or the end). There might or might not be one or more T in the middle (not in a series that continues to either end) and the position of these T values varies. I am trying to identify the indices (if any) of these T values in the middle A brute force approach would be to strip off any contiguous T values from each end, then look for any remaining T values. Can anyone propose a more clever approach? Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone: 1-866-PLessThan (1-866-753-7784) Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.