Re: [R] Adding comment in C++ code for debugging purpose

2022-12-16 Thread Rui Barradas
Às 23:32 de 16/12/2022, Christofer Bogaso escreveu: Hi, I am using an R package where there are some C++ code. To check some intermediate values generated by that C++ code, I added a line like std::cout << "My values"; Now with this modification, I next build a modified package (source) using

Re: [R] Adding comment in C++ code for debugging purpose

2022-12-16 Thread Jeff Newmiller
a) This is not the Rcpp help list. b) Writing to stdout without going through R is not supported in packages. Do read the Writing R Extensions manual. On December 16, 2022 3:32:33 PM PST, Christofer Bogaso wrote: >Hi, > >I am using an R package where there are some C++ code. > >To check some i

[R] datatable using dt not able to print background colors

2022-12-16 Thread Matthew Pirritano
Hey, all! I've got a report that uses datatable from DT to create an rmarkdown html that looks great as an html but when I try to print it, to a printer, or to a pdf the colors I've assigned to cells are not displaying. I'm using chrome and I've clicked on the Background graphics button there,

[R] Adding comment in C++ code for debugging purpose

2022-12-16 Thread Christofer Bogaso
Hi, I am using an R package where there are some C++ code. To check some intermediate values generated by that C++ code, I added a line like std::cout << "My values"; Now with this modification, I next build a modified package (source) using R CMD build Next I install this modified package us

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Göran Broström
Yes, I was confused: In is.na(x) <-value, value is supposed to be an index vector, clearly stated on the help page. So Bert�s suggestion is the way to go. Thanks to all, G�ran -Ursprungligt meddelande- Fr�n: Bill Dunlap Datum: fredag, 16 december 2022 20:15 Till: G�ran Brostr�m Kopia:

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Bill Dunlap
I think that is.na(x) <- i generally does the same to x as does x[i] <- NA I say 'generally' because some classes (e.g., numeric_version) do not allow x[i]<-NA but do allow is.na(x)<-i. It is possible that some classes mess up this equivalence, but I think that would be considered a bug. -

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Bert Gunter
To do what the OP wanted, one can use: x <- c('A', 'B') is.na(x) <- x=='A' ## rhs is a logical index vector ## yielding > x [1] NA "B" Cheers, Bert On Fri, Dec 16, 2022 at 10:43 AM Eric Berger wrote: > maybe this will make it clear > > x <- c(a=1, b=5) > is.na(x) <- "b" > > i.e. your second

Re: [R] Get data from a list of data frames (Stefano Sofia)

2022-12-16 Thread Bert Gunter
... and note that my previous version can be simplified using R's pipe syntax to: do.call('rbind',Total[select.stat]) |> subset(sensor == 'thermometer', code) ## which calls the subset.data.frame() method that gives: code Station1.1 2583 Station4.4 4453 Station5.3 3179 close

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Jeff Newmiller
I don't find _either_ of these acceptable. On the other hand, x[ is.na( x ) ] <- 1 should have no effect on x. On December 16, 2022 10:28:52 AM PST, "Göran Broström" wrote: >I'm confused: > >> x <- 1:2 >> is.na(x) <- 1 >> x >[1] NA 2 > >OK, but > >> x <- c("A", "B") >> is.na(x) <- "A" >>

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Eric Berger
maybe this will make it clear x <- c(a=1, b=5) is.na(x) <- "b" i.e. your second case is dealing with a named vector HTH, Eric On Fri, Dec 16, 2022 at 8:29 PM Göran Broström wrote: > I'm confused: > > > x <- 1:2 > > is.na(x) <- 1 > > x > [1] NA 2 > > OK, but > > > x <- c("A", "B") > > is.na(

[R] is.na()<- on a character vector

2022-12-16 Thread Göran Broström
I'm confused: > x <- 1:2 > is.na(x) <- 1 > x [1] NA 2 OK, but > x <- c("A", "B") > is.na(x) <- "A" > x A "A" "B" NA What happens? G_ran __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mai

Re: [R] Get data from a list of data frames (Stefano Sofia)

2022-12-16 Thread Jorgen Harmse via R-help
Following Bert Gunter's suggestion, I wonder why the data are in separate frames (with hard-coded values) in the first place. You could put them in a text file and call read.table. If you provide a header and put a meaningful station name at the start of each data row then rownames of your data

Re: [R] [Rd] I do not want that R CMD build removes temp directory

2022-12-16 Thread Uwe Ligges
On 15.12.2022 21:47, Witold E Wolski wrote: Thank you Simon, It seems not to be related to the R package but rather to the OS, (just got the same error when installing the shiny R package from CRAN). I am on an M1 mac running Windows ARM in Parallels. Installed a x86_64-w64 R version. "**