FancyJules Posted December 5, 2012 Posted December 5, 2012 (edited) Hello, I am doing a project in R and am interested in creating a list of vectors of TRUES and FALSES as follows:FALSE FALSE FALSE FALSE FALSEFALSE FALSE FALSE FALSE TRUEFALSE FALSE FALSE TRUE FALSEFALSE FALSE FALSE TRUE TRUE...TRUE TRUE TRUE TRUE TRUEI have manually typed all 32 combinations; however, I am interested in doing this more elegantly. I imagine a loop and some sort of modulus operation are required. Any advice would be appreciated.Thank you! Edited December 5, 2012 by FancyJules
John Cuthber Posted December 5, 2012 Posted December 5, 2012 Make 2 copies of the list you have of 32 combinations. Prefix one set with "True" and the other set with "False". You now have a list of 64 Make 2 copies of that list...
Klaynos Posted December 5, 2012 Posted December 5, 2012 Yes, you can use logic test and assign the results to a vector: a<- c() a[1]<- 3>4 You can loop or use something like which() to do this more cleverly depending on your test.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now