[Rd] What is the INDEX file for?
Hi the list, In WRE (or in Rdindex), we can find how the INDEX is make, how to change it, but I do not manage to find the purpose of this file. So what is the INDEX file for? Thanks Christophe -- Christophe Genolini Maître de conférences en bio-statistique Vice président Communication interne et animation du campus Université Paris Ouest Nanterre La Défense __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] built-in NAMED(obj) from within R
Hello, Is it possible to retrieve the 'named' field within the header (sxpinfo) of a object, without resorting to a debugger, external code, etc? In other words is there a built-in equivalent to the "getnamed" subroutine described here: http://tolstoy.newcastle.edu.au/R/e2/devel/07/09/4496.html The goal is to ascertain whether a copy of an object has been made. Thanks, Ben __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] built-in NAMED(obj) from within R
Benjamin Tyner gmail.com> writes: > > Hello, > > Is it possible to retrieve the 'named' field within the header (sxpinfo) > of a object, without resorting to a debugger, external code, etc? And much more than just NAMED : .Internal(inspect(x)) > The goal is to ascertain whether a copy of an object has been made. Then : ?tracemem One demonstration of using both together is here : http://stackoverflow.com/a/10312843/403310 Matthew __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] unable to load shared object - opencv
Ok, sorry. I need the library libopencv_core.2.4.0.dylib and libopencv_highgui.2.4.0.dylib. Thanks G.M. Il giorno 09/nov/2012, alle ore 01:09, Simon Urbanek ha scritto: > > On Nov 8, 2012, at 3:34 PM, niandra wrote: > >> Sorry but i'm really a beginner. >> >> If when i use opencv with Xcode i need to set the following path >> /System/Library/Frameworks >> /usr/local/include >> /usr/local/lib >> >> how can i specify this in R CMD SHLIB? >> > > Those are essentially default so no need to specify any of those. The real > thing you need to specify are the actual libraries to link against, typically > something like -lopencv_core ... If you use a framework it may be just > something like -framework OpenCV - we don't know since you didn't tell us > what your'e really using. > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] built-in NAMED(obj) from within R
>> The goal is to ascertain whether a copy of an object has been made. > > Then : > > ?tracemem > > One demonstration of using both together is here : > > http://stackoverflow.com/a/10312843/403310 Note that tracemem detects duplications (in a technical R sense), not copies - i.e. x <- 1:10 tracemem(x) x[11] <- 11L although all the individual elements are copied, the vector is not duplicated. This confused me at first, so I thought I'd point it out. Hadley -- RStudio / Rice University http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] unable to load shared object - opencv
Thanks to all, now this problem is solved G.M. Il giorno 09/nov/2012, alle ore 01:09, Simon Urbanek ha scritto: > > On Nov 8, 2012, at 3:34 PM, niandra wrote: > >> Sorry but i'm really a beginner. >> >> If when i use opencv with Xcode i need to set the following path >> /System/Library/Frameworks >> /usr/local/include >> /usr/local/lib >> >> how can i specify this in R CMD SHLIB? >> > > Those are essentially default so no need to specify any of those. The real > thing you need to specify are the actual libraries to link against, typically > something like -lopencv_core ... If you use a framework it may be just > something like -framework OpenCV - we don't know since you didn't tell us > what your'e really using. > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Crash - cause 'memory not mapped'
i'm using the following c++ code using namespace std; #include #include #include #include #include #include #include #include #include #include extern "C" { SEXP FiltroGaus(SEXP size1_r, SEXP size2_r, SEXP sigma_r) { int size1 = INTEGER(size1_r)[0]; int size2 = INTEGER(size2_r)[0]; double sigma = REAL(sigma_r)[0]; } } The compilation go without errors but when in R i type .C("FiltroGaus",3,3,2) the message is: Errore: INTEGER() can only be applied to a 'integer', not a 'NULL' if i type .C("FiltroGaus",as.integer(3),as.integer(3),as.double(2)) the message is Errore: INTEGER() can only be applied to a 'integer', not a 'closure' while if i type .Call("FiltroGaus",as.integer(3),as.integer(3),as.double(2)) the message is NULL *** caught segfault *** address 0x20be, cause 'memory not mapped' Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace I now, i need to study and i know also for sure the answer is in some book (i have lot). I swear i read a lot and i'm still reading, but i really need help :) -- View this message in context: http://r.789695.n4.nabble.com/Crash-cause-memory-not-mapped-tp4649141.html Sent from the R devel mailing list archive at Nabble.com. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Crash - cause 'memory not mapped'
the error "memory non mapped" happen also if i use void FiltroGaus(SEXP size1_r, SEXP size2_r, SEXP sigma_r) instead SEXP FiltroGaus(SEXP size1_r, SEXP size2_r, SEXP sigma_r) { Il giorno 09/nov/2012, alle ore 23:58, Peter Langfelder ha scritto: > I'm not an expert, but from what I know you should certainly use the > .Call interface when you define a function as you did. The problem is > that your function must return a value (of type SEXP) which it does > not. If you don't return a value, all bets are off as to what will > happen, and if the internal R code uses a pointer to the result of > your function, you can easily get memory map errors. > > HTH, > > Peter > > On Fri, Nov 9, 2012 at 2:31 PM, niandra > wrote: >> i'm using the following c++ code >> using namespace std; >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> >> extern "C" { >> SEXP FiltroGaus(SEXP size1_r, SEXP size2_r, SEXP sigma_r) { >> >>int size1 = INTEGER(size1_r)[0]; >>int size2 = INTEGER(size2_r)[0]; >>double sigma = REAL(sigma_r)[0]; >> >> } >> } >> >> The compilation go without errors but when in R i type >> .C("FiltroGaus",3,3,2) >> the message is: Errore: INTEGER() can only be applied to a 'integer', not a >> 'NULL' >> if i type .C("FiltroGaus",as.integer(3),as.integer(3),as.double(2)) >> the message is Errore: INTEGER() can only be applied to a 'integer', not a >> 'closure' >> >> while if i type .Call("FiltroGaus",as.integer(3),as.integer(3),as.double(2)) >> the message is >> NULL >> >> *** caught segfault *** >> address 0x20be, cause 'memory not mapped' >> >> Possible actions: >> 1: abort (with core dump, if enabled) >> 2: normal R exit >> 3: exit R without saving workspace >> 4: exit R saving workspace >> >> >> I now, i need to study and i know also for sure the answer is in some book >> (i have lot). I swear i read a lot and i'm still reading, but i really need >> help :) >> >> >> >> -- >> View this message in context: >> http://r.789695.n4.nabble.com/Crash-cause-memory-not-mapped-tp4649141.html >> Sent from the R devel mailing list archive at Nabble.com. >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Crash - cause 'memory not mapped'
On 9 November 2012 at 14:31, niandra wrote: | extern "C" { | SEXP FiltroGaus(SEXP size1_r, SEXP size2_r, SEXP sigma_r) { [...] | The compilation go without errors but when in R i type | .C("FiltroGaus",3,3,2) You missed the part in "Writing R Extension" about .C() and .Call() arguments. You are mixing both approaches here, which usually ends badly. Do some more reading, and maybe study some existing (simpler) examples / packages. You really do not need to engage OpenCV headers and libraries before you understand the basics better. Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] built-in NAMED(obj) from within R
Thanks Matthew and Hadley; that is exactly what I was looking for, and them some. Regards, Ben >>/ The goal is to ascertain whether a copy of an object has been made. />/ />/ Then : />/ />/ ?tracemem />/ />/ One demonstration of using both together is here : />/ />/ http://stackoverflow.com/a/10312843/403310 / Note that tracemem detects duplications (in a technical R sense), not copies - i.e. x <- 1:10 tracemem(x) x[11] <- 11L although all the individual elements are copied, the vector is not duplicated. This confused me at first, so I thought I'd point it out. Hadley -- RStudio / Rice University http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] built-in NAMED(obj) from within R
On Nov 9, 2012, at 8:00 AM, Hadley Wickham wrote: >>> The goal is to ascertain whether a copy of an object has been made. >> >> Then : >> >>?tracemem >> >> One demonstration of using both together is here : >> >>http://stackoverflow.com/a/10312843/403310 > > Note that tracemem detects duplications (in a technical R sense), not > copies - i.e. > > x <- 1:10 > tracemem(x) > x[11] <- 11L > > although all the individual elements are copied, No elements are copied - this is a subassignment and it is done in place hence there is neither duplication nor copying - simply the value of the 11th element is changed. > the vector is not duplicated. This confused me at first, so I thought I'd > point it out. > I'm not quite sure what is your distinction you are trying to make there... Cheers, Simon > Hadley > > -- > RStudio / Rice University > http://had.co.nz/ > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] built-in NAMED(obj) from within R
On Friday, November 9, 2012, Simon Urbanek wrote: > > On Nov 9, 2012, at 8:00 AM, Hadley Wickham wrote: > > >>> The goal is to ascertain whether a copy of an object has been made. > >> > >> Then : > >> > >>?tracemem > >> > >> One demonstration of using both together is here : > >> > >>http://stackoverflow.com/a/10312843/403310 > > > > Note that tracemem detects duplications (in a technical R sense), not > > copies - i.e. > > > > x <- 1:10 > > tracemem(x) > > x[11] <- 11L > > > > although all the individual elements are copied, > > No elements are copied - this is a subassignment and it is done in place > hence there is neither duplication nor copying - simply the value of the > 11th element is changed. But there was no 11th element - it was only 10 long. Hadley -- RStudio / Rice University http://had.co.nz/ [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] built-in NAMED(obj) from within R
On Nov 9, 2012, at 9:46 PM, Hadley Wickham wrote: > On Friday, November 9, 2012, Simon Urbanek wrote: > > On Nov 9, 2012, at 8:00 AM, Hadley Wickham wrote: > > >>> The goal is to ascertain whether a copy of an object has been made. > >> > >> Then : > >> > >>?tracemem > >> > >> One demonstration of using both together is here : > >> > >>http://stackoverflow.com/a/10312843/403310 > > > > Note that tracemem detects duplications (in a technical R sense), not > > copies - i.e. > > > > x <- 1:10 > > tracemem(x) > > x[11] <- 11L > > > > although all the individual elements are copied, > > No elements are copied - this is a subassignment and it is done in place > hence there is neither duplication nor copying - simply the value of the 11th > element is changed. > > But there was no 11th element - it was only 10 long. > Ah, I see what you mean - the misleading part is rather that x is now a new object that is no longer traced - this is not about duplication or copying. Cheers, Simon __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel