search for: oldvector

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

2012 Mar 24
1
Double And average a vector
Dear all, I am reading with R some measurements vectors from an external device. The length of each vector (containing numbers) is not constant. I would like by doubling the numbers of elements I select to shrink the vector to a new one Let's call the vector I read from the device as oldvector and the shrinked version of it as newVersion I want to have newVersion[1]<- mean(oldvector[1]) newVersion[2]<- mean(oldvector[2:3]) newVersion[3]<- mean(oldvector[4:7]) newVersion[4]<- mean(oldvector[8:15]) as I said the length of oldvector is not the same sol it might be also the...
2005 Nov 29
3
Reclassifying values within a vector to several other values
Dear List Apologies for such a simple question: I have a vector of 738 elements, coded with values between 1 and 16 (but not containing 7, 10, 11 or 13) and wish to recode value 14 to 1, 4 to 2, 1 to 3, 2 to 4 and all other values to 5. I've been trying to use the replace function (in base) and %in%, but without success. Many thanks Roy