Dear R users, I am trying to join two 8 bit integers, as defined by the "coolbutuseless/uint8" package, without success:> library(uint8)> x1 = uint8(3)> x1[1] = as.uint8(1) > x1[2] = as.uint8(2)> x2 = uint8(3)> x2[1] = as.uint8(2)> x1[1] 1 2 0> x2[1] 2 0 0> xx = c(x1,x2)> xx[1] 01 02 00 02 00 00In the real application the first array (x1) is extremely large (order 15-20 Gbytes) while the second is relatively small, so that I cannot afford, given my RAM, to define a third array, as> x3 = uint8(length(x1)+length(x2))and then fill its components, but I need to join the two arrays. Is anyone aware of the right procedure in R or so kind to give suggestions ? (A possibility would be to switch to C/C++, but I would prefer not to). Many thanks, Luca -- ________________________________________________________ Le informazioni contenute in questo messaggio di posta elettronica sono strettamente riservate e indirizzate esclusivamente al destinatario. Si prega di non leggere, fare copia, inoltrare a terzi o conservare tale messaggio se non si ? il legittimo destinatario dello stesso. Qualora tale messaggio sia stato ricevuto per errore, si prega di restituirlo al mittente e di cancellarlo permanentemente dal proprio computer. The information contained in this e mail message is strictly confidential and intended for the use of the addressee only.? If you are not the intended recipient, please do not read, copy, forward or store it on your computer. If you have received the message in error, please forward it back to the sender and delete it permanently from your computer system. -- [[alternative HTML version deleted]]
Please note per the posting guide linked below: "For questions about functions in standard packages distributed with R (see the FAQ Add-on packages in R <https://cran.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R>), ask questions on R-help. If the question relates to a *contributed package* , e.g., one downloaded from CRAN, try contacting the package maintainer first. You can also use find("functionname") and packageDescription("packagename") to find this information. *Only* send such questions to R-help or R-devel if you get no reply or need further assistance. This applies to both requests for help and to bug reports. " It appears you have not done this -- if you have, please say so. Given that, while you might get lucky here, you should not be surprised if you don't. This looks like *exactly* the sort of query that a maintainer could help you with. Cheers, Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Feb 4, 2021 at 2:36 PM Luca Passalacqua via R-help < r-help at r-project.org> wrote:> Dear R users, > > I am trying to join two 8 bit integers, as defined by the > "coolbutuseless/uint8" package, > without success: > > > library(uint8) > > > x1 = uint8(3)> x1[1] = as.uint8(1) > > x1[2] = as.uint8(2)> x2 = uint8(3)> x2[1] = as.uint8(2)> x1[1] 1 2 0> > x2[1] 2 0 0> xx = c(x1,x2)> xx[1] 01 02 00 02 00 00 > > > In the real application the first array (x1) is extremely large (order > 15-20 Gbytes) > while the second is relatively small, so that I cannot afford, given my > RAM, > to define a third array, as > > > x3 = uint8(length(x1)+length(x2)) > > and then fill its components, but I need to join the two arrays. > > Is anyone aware of the right procedure in R or so kind to give suggestions > ? > (A possibility would be to switch to C/C++, but I would prefer not to). > > Many thanks, > > Luca > > -- > ________________________________________________________ > Le informazioni > contenute in questo messaggio di posta elettronica sono strettamente > riservate e indirizzate esclusivamente al destinatario. Si prega di non > leggere, fare copia, inoltrare a terzi o conservare tale messaggio se non > si ? il legittimo destinatario dello stesso. Qualora tale messaggio sia > stato ricevuto per errore, si prega di restituirlo al mittente e di > cancellarlo permanentemente dal proprio computer. > The information contained > in this e mail message is strictly confidential and intended for the use of > the addressee only. If you are not the intended recipient, please do not > read, copy, forward or store it on your computer. If you have received the > message in error, please forward it back to the sender and delete it > permanently from your computer system. > > -- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Hi Luca, The answer to your question depends on your application. What do you want to do with x3? Do you really need a native vector to represent x1 and x2? Or you just want an object that behaves like it is a joint of x1 and x2? I do not think you can have a native vector x3 without paying anything, this is impractical, but if all you want to do is to have something that behaves like x3, I think R's S4 class can achieve that. Best, Jiefei On Fri, Feb 5, 2021 at 6:36 AM Luca Passalacqua via R-help < r-help at r-project.org> wrote:> Dear R users, > > I am trying to join two 8 bit integers, as defined by the > "coolbutuseless/uint8" package, > without success: > > > library(uint8) > > > x1 = uint8(3)> x1[1] = as.uint8(1) > > x1[2] = as.uint8(2)> x2 = uint8(3)> x2[1] = as.uint8(2)> x1[1] 1 2 0> > x2[1] 2 0 0> xx = c(x1,x2)> xx[1] 01 02 00 02 00 00 > > > In the real application the first array (x1) is extremely large (order > 15-20 Gbytes) > while the second is relatively small, so that I cannot afford, given my > RAM, > to define a third array, as > > > x3 = uint8(length(x1)+length(x2)) > > and then fill its components, but I need to join the two arrays. > > Is anyone aware of the right procedure in R or so kind to give suggestions > ? > (A possibility would be to switch to C/C++, but I would prefer not to). > > Many thanks, > > Luca > > -- > ________________________________________________________ > Le informazioni > contenute in questo messaggio di posta elettronica sono strettamente > riservate e indirizzate esclusivamente al destinatario. Si prega di non > leggere, fare copia, inoltrare a terzi o conservare tale messaggio se non > si ? il legittimo destinatario dello stesso. Qualora tale messaggio sia > stato ricevuto per errore, si prega di restituirlo al mittente e di > cancellarlo permanentemente dal proprio computer. > The information contained > in this e mail message is strictly confidential and intended for the use of > the addressee only. If you are not the intended recipient, please do not > read, copy, forward or store it on your computer. If you have received the > message in error, please forward it back to the sender and delete it > permanently from your computer system. > > -- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]