search for: vector_2

Displaying 2 results from an estimated 2 matches for "vector_2".

Did you mean: vector2
2010 Mar 29
5
Finding common an unique elements in character vectors
Dear R-list, I have a problem which I think is quite basic, but so far google has not helped me. I have two vectors like this: vector_1 <- c(Belgium, Spain, Greece, Ireland, Luxembourg, Netherlands, Portugal) vector_2 <- c(Denmark, Luxembourg) I would like to find the elements in vector_1 that are not in vector_2 so that i get a vector with these countries: Belgium, Spain, Greece, Ireland, Netherlands, Portugal. Thanks a lot, Thomas
2011 Oct 13
1
using dynamic variable names
...would like to assign variable (or vectors) names dynamically, hence, after you assign the number of new vectors then they populate for use later in the algorithm. Below is an example: n<-5 for (i in (1:n)) { vector_i <- c(1:10) } Here what I am trying to do is create n=5 vectors (vector_1, vector_2, vector_3, vector_4, vector_5) that I will use later in my algorithm. I don't want to create a matrix because I will use these in a time series later and the vectors will be of different length, where having '0' will produce wrong results. This may not be possible in R, if so you can...