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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks a lot ! The problem was indeed the (old?) assignment operator "_" or my unawareness of its existence! The skript is running now as exspected :^))) 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"_" is an assignment operator. Use "." or capitalization to construct variables. best, -tony>>>>> "TB" == Thomas Bruns <Thomas.Bruns at ptb.de> writes:TB> Hello, For some analysis of a mesh structure I need to prepare TB> several vectors of indexes of different length. This is done TB> by the following code sequence (including diagnostic output): TB> #-------------------------------------------------- MT_ind <- TB> which(V1.frame[,2] %in% mm[,1]) print("M_ind") str(M_ind) TB> Q1_ind <- which(V1.frame[,2] %in% mq1) print("Q1_ind") TB> str(Q1_ind) TB> Q2_ind <- which(V1.frame[,2] %in% mq2) print("Q2_ind") TB> str(Q2_ind) TB> MS_ind <- which(V1.frame[,2] %in% ms) print("MS_ind") TB> str(MS_ind) TB> print ("---------------") print("M_ind") str(M_ind) TB> print("Q1_ind") str(Q1_ind) print("Q2_ind") str(Q2_ind) TB> print("MS_ind") str(MS_ind) TB> #----------------------------------------------------- TB> Although the Index vectors *_ind have different names they get TB> subsequently overwriten, as you see in the diagnostic output: TB> [1] "M_ind" int [1:12023] 6952 6953 6954 6957 6958 6959 6962 TB> 6963 6964 6965 ... [1] "Q1_ind" int [1:331] 1 2 3 4 5 6 7 8 9 TB> 10 ... [1] "Q2_ind" int [1:331] 6952 6957 6962 6963 6964 6965 TB> 6966 6967 6968 6969 ... [1] "MS_ind" int [1:3] 15237 15238 TB> 15239 [1] "---------------" [1] "M_ind" int [1:3] 15237 15238 TB> 15239 [1] "Q1_ind" int [1:3] 15237 15238 15239 [1] "Q2_ind" TB> int [1:3] 15237 15238 15239 [1] "MS_ind" int [1:3] 15237 15238 TB> 15239 TB> Everything is now equal to MS_ind which was asigned last! So, TB> can anybody tell me what's happened here? Am I working on TB> memory pointers without knowing?? TB> Tia! TB> Thomas TB> -- ------------------------------------------------------- TB> Dr. Thomas Bruns <thomas.bruns at ptb.de> TB> Physikalisch-Technische Bundesanstalt Braunschweig TB> Fachlabor: 1.13 Bundesallee 100 Tel: 0531/592 - 1132 D-38116 TB> Braunschweig Fax: 0531/592-69-1132 TB> ------------------------------------------------------- TB> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- TB> r-help mailing list -- Read TB> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", TB> "help", or "[un]subscribe" (in the "body", not the subject !) TB> To: r-help-request at stat.math.ethz.ch TB> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ -- A.J. Rossini Rsrch. Asst. Prof. of Biostatistics UW Biostat/Center for AIDS Research rossini at u.washington.edu FHCRC/SCHARP/HIV Vaccine Trials Net rossini at scharp.org -------- (friday is unknown) -------- FHCRC: M--W : 206-667-7025 (fax=4812)|Voicemail is pretty sketchy CFAR: ?? : 206-731-3647 (fax=3694)|Email is far better than phone UW: Th : 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Thu, 3 May 2001, Thomas Bruns wrote:> 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])Since the underscore is an old assignment token, I think you are seeing multiple assigns to "ind":> ls()character(0)> a <- 1 > ls()[1] "a"> b_a > b[1] 1> ls()[1] "a" "b" Hope this helps, Roger -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: Roger.Bivand at nhh.no and: Department of Geography and Regional Development, University of Gdansk, al. Mar. J. Pilsudskiego 46, PL-81 378 Gdynia, Poland. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._