[R] Index vectors get overwriten ?!
Thomas Bruns
Thomas.Bruns at ptb.de
Thu May 3 13:38:01 CEST 2001
Hello,
For some analysis of a mesh structure I need to prepare several vectors
of indexes of different length. This is done by the following code
sequence (including diagnostic output):
#--------------------------------------------------
MT_ind <- which(V1.frame[,2] %in% mm[,1])
print("M_ind")
str(M_ind)
Q1_ind <- which(V1.frame[,2] %in% mq1)
print("Q1_ind")
str(Q1_ind)
Q2_ind <- which(V1.frame[,2] %in% mq2)
print("Q2_ind")
str(Q2_ind)
MS_ind <- which(V1.frame[,2] %in% ms)
print("MS_ind")
str(MS_ind)
print ("---------------")
print("M_ind")
str(M_ind)
print("Q1_ind")
str(Q1_ind)
print("Q2_ind")
str(Q2_ind)
print("MS_ind")
str(MS_ind)
#-----------------------------------------------------
Although the Index vectors *_ind have different names they get
subsequently overwriten, as you see in the diagnostic output:
[1] "M_ind"
int [1:12023] 6952 6953 6954 6957 6958 6959 6962 6963 6964 6965 ...
[1] "Q1_ind"
int [1:331] 1 2 3 4 5 6 7 8 9 10 ...
[1] "Q2_ind"
int [1:331] 6952 6957 6962 6963 6964 6965 6966 6967 6968 6969 ...
[1] "MS_ind"
int [1:3] 15237 15238 15239
[1] "---------------"
[1] "M_ind"
int [1:3] 15237 15238 15239
[1] "Q1_ind"
int [1:3] 15237 15238 15239
[1] "Q2_ind"
int [1:3] 15237 15238 15239
[1] "MS_ind"
int [1:3] 15237 15238 15239
Everything is now equal to MS_ind which was asigned last!
So, can anybody tell me what's happened here? Am I working on memory
pointers without knowing??
Tia!
Thomas
--
-------------------------------------------------------
Dr. Thomas Bruns <thomas.bruns at ptb.de>
Physikalisch-Technische Bundesanstalt
Braunschweig
Fachlabor: 1.13
Bundesallee 100 Tel: 0531/592 - 1132
D-38116 Braunschweig Fax: 0531/592-69-1132
-------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list