Re: [R] Install OpenCL
Dear Quirin, To be able to install OpenCL on ArchLinux, I needed to install opencl-headers first, because my system complained about CL/opencl.h ... Maybe there is something like that on Windows ... Best, Rasmus [1] https://archlinux.org/packages/extra/any/opencl-headers/ __ R-help@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.
[R] Install OpenCL
Hi everyone, the installation of OpenCL on windows with CUDA 11.7 failed. I can set up tensorflow in python and communicate with the GPU, so I assume CUDA is set up correctly. OpenCL headers are also available through the CUDA toolkit. However, the package installation of OpenCL in R fails. There is not much documentation available. Can anyone help with that please? > install.packages("OpenCL") Installiere Paket nach ‘C:/Users/quiri/AppData/Local/R/win-library/4.2’ (da ‘lib’ nicht spezifiziert) Paket, das nur als Quelltext vorliegt und eventuell Übersetzung von C/C++/Fortran benötigt.: ‘OpenCL’ installiere Quellpaket ‘OpenCL’ trying URL 'https://cran.rstudio.com/src/contrib/OpenCL_0.2-2.tar.gz' Content type 'application/x-gzip' length 20881 bytes (20 KB) downloaded 20 KB * installing *source* package 'OpenCL' ... ** Paket 'OpenCL' erfolgreich entpackt und MD5 Summen überprüft ** using staged installation ERROR: OCL not set! You will need a working OpenCL SDK with headers and libraries for both i386 and x64 Set OCL to the root of the SDK You can also set individial variables OCLINC, OCL32LIB and OCL64LIB. If they are not set, the default layout will be assumed. ERROR: configuration failed for package 'OpenCL' * removing 'C:/Users/quiri/AppData/Local/R/win-library/4.2/OpenCL' Warning in install.packages : Installation des Pakets ‘OpenCL’ hatte Exit-Status ungleich 0 Die heruntergeladenen Quellpakete sind in ‘C:\Users\quiri\AppData\Local\Temp\RtmpeepQng\downloaded_packages’ Best regards, Quirin __ R-help@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.
Re: [R] R_LIBS var needed to be set after upgrade to R 4.2.2
Dear Sir, Many thanks for the reply. Best, Ashim On Thu, Jun 2, 2022 at 12:56 PM Martin Maechler wrote: > > > Ashim Kapoor > > on Wed, 1 Jun 2022 14:30:58 +0530 writes: > > > Dear Sir, > >> > I upgraded to R 4.2.2 on Debian 10 today. > >> > >> Well, I assume you mean R 4.2.0 .. at least that one exists. > > > My bad, yes I made a typo. I did mean R 4.2.0. > > >> > The R shell incantation worked fine and all libraries would load but, > >> > I needed to point the R_LIBS variable to > >> > /usr/local/lib/R/site-library/ in order for the R --vanilla < > myfile.R > >> > incantation to find the libraries. > >> > >> you mean other installed *packages* > >> > >> > May I ask, why was this ? I never needed to do this on any previous > >> > upgrade to R. > >> > >> Well, for me, the R --vanilla form also only sees the > >> 29 (14 "base" + 15 "Recommended") packages that come with R. > > > Has this ALWAYS been the case for you ? Even with prior versions of R ? > > Yes; I'm sorry this was unclear. > > >> Debian (& Ubuntu etc) have used a similar setup where the > >> default {R-level} .libPaths() has contained three libraries, > >> via > >> > >> > R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'} > >> > >> see > >> > >> https://cloud.r-project.org/bin/linux/debian/#pathways-to-r-packages > >> > >> also for much more. > >> Note (also from the above CRAN page > >> https://cloud.r-project.org/bin/linux/debian/ > >> [ Remember "menu" "Binaries" -> "Linux" -> "Debian" ] > >> > >> The good thing about the Debian (and derivatives) setup is that > >> it also separates (as I do) the "packages that come with R" in > >> one library (= /usr/lib/R/library) from packages that are > >> installed differently. > > > My confusion is : Earlier R --vanilla incantation was working fine, > > even without my intervening and > > adding to R_LIBS. That is why I was confused. > > > My main query is : Is there anything special to R 4.2.0 which needs > > R_LIBS to be setup seperately? > > to which Jeroen Ooms answered nicely -- thank you, Jeroen! > > > I was hit by this problem as well a few weeks ago. You may get a more > > detailed answer in r-sig-debian or from Dirk directly, but from what I > > understood, this is now expected behavior: indeed if you start R > > --vanilla then /usr/local/lib is no longer included in the library path. > > > The reason is that R-core made a change in 4.2.0 to pre-set values for > > R_LIBS_USER and R_LIBS_SITE in Renviron [1] which would take > > precedence over the proper distro defaults (that include > > /usr/local/lib) as configured by the r-base deb/rpm packages. To > > mitigate the problem the r-base deb package moved the appropriate > > R_LIBS_USER and R_LIBS_SITE definitions into Renviron.site, which > > takes precedence over Renviron. However a side effect of this solution > > is that Renviron.site is ignored in --vanilla mode. At least this is > > my best understanding of the problem. > > > [1] https://cran.r-project.org/doc/manuals/r-release/NEWS.html > > Yes, as > > R --help | grep -A1 -e --vanilla | head -2 > > has given > > --vanilla Combine --no-save, --no-restore, --no-site-file, > --no-init-file and --no-environ > > (unchanged for many years). > > > Being a Linux user of more than 25 years, I've not been much of a > Debian-or-derivatives user in recent years (apart from setting up > and maintaining Ubuntu LTS on my wife's computer) mainly because > of lazyness as our IT staff helps me solve all problems with > Fedora quickly, including lowelevel device-related ones, > I think that Debian(+derivatives) has always been the exception > among the Linux distros and for all the others, '--vanilla' > really meant "vanilla" in a loose sense, i.e., "just base R". > > I agree that I had wanted a "vanilla+strawberry" version myself, really. > which would be just not have the --no-site-file switch, > so we could call it >--vanilla+site > > {Others may hate "feature creep" and yet more output from > 'R --help' ..} > > Martin __ R-help@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.
Re: [R] Request for some help: Error when joining multiple csv files together
Hello, I'm seeing two obvious errors, those are not csv files and the columns spec is wrong, you have a spec of 6 columns but the posted data only has 4 and of different classes. If the data is in comma separated values (CSV) files the following worked without errors. library(readr) col_spec <- cols( d1 = col_double(), d2 = col_double(), d3 = col_double(), d4 = col_double() ) list.files(pattern = "*\\.csv$") |> lapply(read_csv, col_types = col_spec) |> dplyr::bind_rows() If the data is like in the question, try instead list.files(pattern = "*\\.csv$") |> lapply(read_delim, delim = " ", col_types = col_spec) |> dplyr::bind_rows() Hope this helps, Rui Barradas Às 00:17 de 02/06/2022, Bhaskar Mitra escreveu: Hello Everyone, I have a bunch of csv files, all with common headers (d1, d2, d3, d4). When I am trying to join the csv files together, with the following code (shown below), I am getting a warning when the files are joined. The values under columns d3 and d4 are not joined properly. The code and the error are given below. I would really appreciate some help in this regard. regards, bhaskar #---code df <- list.files(pattern = "*.csv") %>% lapply(read_csv) %>% bind_rows #---code Header of each file: d1 d2 d3 d4 3 4NA NA 4 5 NA 7 5 6 8 8 6 7 8 NA # #Warning when the codes run -- Column specification ─ cols( .default = col_double(), name = col_character(), d1 = col_datetime(format = ""), d2 = col_character(), d3 = col_logical(), d4 = col_logical() ) Warning: 48766 parsing failures. * row**col* * expected * *actual* *file* 3529 d3 1/0/T/F/TRUE/FALSE 100 'file1.csv' 3529 d41/0/T/F/TRUE/FALSE 100 'file1.csv' . .. .. [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
Re: [R] R_LIBS var needed to be set after upgrade to R 4.2.2
> Ashim Kapoor > on Wed, 1 Jun 2022 14:30:58 +0530 writes: > Dear Sir, >> > I upgraded to R 4.2.2 on Debian 10 today. >> >> Well, I assume you mean R 4.2.0 .. at least that one exists. > My bad, yes I made a typo. I did mean R 4.2.0. >> > The R shell incantation worked fine and all libraries would load but, >> > I needed to point the R_LIBS variable to >> > /usr/local/lib/R/site-library/ in order for the R --vanilla < myfile.R >> > incantation to find the libraries. >> >> you mean other installed *packages* >> >> > May I ask, why was this ? I never needed to do this on any previous >> > upgrade to R. >> >> Well, for me, the R --vanilla form also only sees the >> 29 (14 "base" + 15 "Recommended") packages that come with R. > Has this ALWAYS been the case for you ? Even with prior versions of R ? Yes; I'm sorry this was unclear. >> Debian (& Ubuntu etc) have used a similar setup where the >> default {R-level} .libPaths() has contained three libraries, >> via >> >> R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/lib/R/site-library:/usr/lib/R/library'} >> >> see >> >> https://cloud.r-project.org/bin/linux/debian/#pathways-to-r-packages >> >> also for much more. >> Note (also from the above CRAN page >> https://cloud.r-project.org/bin/linux/debian/ >> [ Remember "menu" "Binaries" -> "Linux" -> "Debian" ] >> >> The good thing about the Debian (and derivatives) setup is that >> it also separates (as I do) the "packages that come with R" in >> one library (= /usr/lib/R/library) from packages that are >> installed differently. > My confusion is : Earlier R --vanilla incantation was working fine, > even without my intervening and > adding to R_LIBS. That is why I was confused. > My main query is : Is there anything special to R 4.2.0 which needs > R_LIBS to be setup seperately? to which Jeroen Ooms answered nicely -- thank you, Jeroen! > I was hit by this problem as well a few weeks ago. You may get a more > detailed answer in r-sig-debian or from Dirk directly, but from what I > understood, this is now expected behavior: indeed if you start R > --vanilla then /usr/local/lib is no longer included in the library path. > The reason is that R-core made a change in 4.2.0 to pre-set values for > R_LIBS_USER and R_LIBS_SITE in Renviron [1] which would take > precedence over the proper distro defaults (that include > /usr/local/lib) as configured by the r-base deb/rpm packages. To > mitigate the problem the r-base deb package moved the appropriate > R_LIBS_USER and R_LIBS_SITE definitions into Renviron.site, which > takes precedence over Renviron. However a side effect of this solution > is that Renviron.site is ignored in --vanilla mode. At least this is > my best understanding of the problem. > [1] https://cran.r-project.org/doc/manuals/r-release/NEWS.html Yes, as R --help | grep -A1 -e --vanilla | head -2 has given --vanilla Combine --no-save, --no-restore, --no-site-file, --no-init-file and --no-environ (unchanged for many years). Being a Linux user of more than 25 years, I've not been much of a Debian-or-derivatives user in recent years (apart from setting up and maintaining Ubuntu LTS on my wife's computer) mainly because of lazyness as our IT staff helps me solve all problems with Fedora quickly, including lowelevel device-related ones, I think that Debian(+derivatives) has always been the exception among the Linux distros and for all the others, '--vanilla' really meant "vanilla" in a loose sense, i.e., "just base R". I agree that I had wanted a "vanilla+strawberry" version myself, really. which would be just not have the --no-site-file switch, so we could call it --vanilla+site {Others may hate "feature creep" and yet more output from 'R --help' ..} Martin __ R-help@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.
[R] rbind of multiple data frames by column name, when each data frames can contain different columns
Dear R-list users, for each winter season from 2000 to 2022 I have a data frame collecting for different weather stations snowpack height (Hs), snowfall in the last 24h (Hn) and a validation flag. Suppose I have these three following data frames df1 <- data.frame(data_POSIX=seq(as.POSIXct("2000-12-01", format="%Y-%m-%d", tz="Etc/GMT-1"), as.POSIXct("2000-12-05", format="%Y-%m-%d", tz="Etc/GMT-1"), by="1 days"), Station1_Hs = c(30, 40, 50, NA, 55), Station1_Hn = c(10, 20, 10, NA, 5), Station1_flag = c(0, 0, 0, NA, 0), Station2_Hs = c(20, 20, 30, 30, 0), Station2_Hn = c(0, 0, 10, 0, 5), Station2_flag = c(0, 0, 0, 1, 0)) df2 <- data.frame(data_POSIX=seq(as.POSIXct("2001-12-01", format="%Y-%m-%d", tz="Etc/GMT-1"), as.POSIXct("2001-12-05", format="%Y-%m-%d", tz="Etc/GMT-1"), by="1 days"), Station1_Hs = c(50, 60, 70, NA, NA), Station1_Hn = c(20, 20, 20, NA, NA), Station1_flag = c(0, 0, 0, NA, NA), Station3_Hs = c(20, 20, 30, 30, 0), Station3_Hn = c(0, 0, 10, 0, 5), Station3_flag = c(0, 0, 0, 1, 0)) df3 <- data.frame(data_POSIX=seq(as.POSIXct("2002-12-01", format="%Y-%m-%d", tz="Etc/GMT-1"), as.POSIXct("2002-12-05", format="%Y-%m-%d", tz="Etc/GMT-1"), by="1 days"), Station2_Hs = c(50, 60, 70, NA, NA), Station2_Hn = c(20, 20, 20, NA, NA), Station2_flag = c(0, 0, 0, NA, NA), Station3_Hs = c(20, 20, 30, 30, 0), Station3_Hn = c(0, 0, 10, 0, 5), Station3_flag = c(0, 0, 0, 1, 0)) As you can see, each data frame can have different stations loaded. I would need to call rbind matching data frames by column name (i.e. by station name), keeping in mind that the number of stations loaded in each data frame may differ. The result should be data_POSIX Station1_Hs Station1_Hn Station1_flag Station2_Hs Station2_Hn Station2_flag Station3_Hs Station3_Hn Station3_flag 2000-12-01 30 10 0 20 0 0 NA NA NA 2000-12-02 40 20 0 20 0 0 NA NA NA 2000-12-03 50 10 0 30 10 0 NA NA NA 2000-12-04 NA NA NA 30 0 0 NA NA NA 2000-12-05 55 5 0 0 5 0 NA NA NA 2001-12-01 50 20 0 NA NA NA 20 0 0 2001-12-02 60 20 0 NA NA NA 20 0 0 2001-12-03 70 20 0 NA NA NA 30 10 0 2001-12-04 NA NA NA NA NA NA 30 0 1 2001-12-05 NA NA NA NA NA NA 0 5 0 2002-12-01 NA NA NA 50 20 0 20 0 0 2002-12-02 NA NA NA 60 20 0 20 0 0 2002-12-03 NA NA NA 70 20 0 30 10 0 2002-12-04 NA NA NA NA NA NA 30 0 1 2002-12-05 NA NA NA NA NA NA 0 5 0 I tried this code df_list <- list(df1, df2, df3) allNms <- unique(unlist(lapply(df_list, names))) do.call(rbind, c(lapply(df_list, function(x) data.frame(c(x, sapply(setdiff(allNms, names(x)), function(y) NA, make.row.names=FALSE)) but I get this error: Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows Could someone please help me? Thank you for your attention Stefano (oo) --oOO--( )--OOo-- Stefano Sofia PhD Civil Protection - Marche Region - Italy Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona (AN) Uff: +39 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo-oO AVVISO IMPORTANTE: Questo messaggio di posta elettronica pu� contenere informazioni confidenziali, pertanto � destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si � il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si � ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell'art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessit� ed urgenza, la risposta al presente messaggio di posta elettronica pu� essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. -- Questo messaggio stato analizzato da Libraesva ESG ed risultato non infetto. This message was scanned by Libraesva ESG and is believed to be clean. [[alternative HTML version deleted]] __ R-help@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.