Re: [R] problem with my base_df function ?

2025-04-16 Thread Ben Bolker
When I ran your code I got Error in `n()`: ! Must only be used inside data-masking verbs like `mutate()`, `filter()`, and `group_by()`. Run `rlang::last_trace()` to see where the error occurred. when I tried to define base_df. If I replace n() with length(.) it seems to work. General

Re: [R] problem with my base_df function ?

2025-04-16 Thread varin sacha via R-help
Sorry, At the end of the code I get an error message      Error: object 'base_df' not found Best, Le mercredi 16 avril 2025 à 18:23:42 UTC+2, Ben Bolker a écrit :   Unless this is a continuation of a conversation I missed the beginning of, you haven't told us enough yet for us to h

Re: [R] problem with my base_df function ?

2025-04-16 Thread Ben Bolker
Unless this is a continuation of a conversation I missed the beginning of, you haven't told us enough yet for us to help you. What is your problem? Do you get an error? Does the code give you an incorrect result? How do you know? (It's possible that I could figure out that your code hits

[R] problem with my base_df function ?

2025-04-16 Thread varin sacha via R-help
R-experts, The R script here below. How to solve my problem ?  Best, ## # Load packages   install.packages("remotes") remotes::install_github("bd2kccd/r-causal")   # Install 'gssr' from 'ropensci' universe install.packages('gssr', repos =  c('https://kjhealy.r-unive

Re: [R] Problem with minimization that I failed to understand

2025-03-28 Thread Daniel Lobo
Hi Rui, I was not aware of this function, however it looks like it should work for me. Many thanks for this intuition. However, in my optimization there are 3 constraints as below, 1) sum of all parameters should be 1 2) all parameters should be positive 3) last parameter should be greater than

Re: [R] Problem with minimization that I failed to understand

2025-03-28 Thread Rui Barradas
Às 13:59 de 28/03/2025, Daniel Lobo escreveu: Hi Duncan, Thanks for your comment, I agree with that. But, how it can be justified that an Optimizer gives a result which is inferior to the starting value? At most, resulting value can remain at the same level, isnt it? On Fri, 28 Mar 2025 at 14:

Re: [R] Problem with minimization that I failed to understand

2025-03-28 Thread Duncan Murdoch
That's a question for the maintainer of the package you used. Duncan Murdoch On 2025-03-28 9:59 a.m., Daniel Lobo wrote: Hi Duncan, Thanks for your comment, I agree with that. But, how it can be justified that an Optimizer gives a result which is inferior to the starting value? At most, resu

Re: [R] Problem with minimization that I failed to understand

2025-03-28 Thread J C Nash
Every time I give a seminar on optimization (most recently in Feb at Univ Cote d'Azur -- thank you Yassine for the welcome!) I point out Algorithms CONVERGE Programs TERMINATE If you race a Maserati (fmincon?) on a dirt bike course, you'll likely get stuck on the first mud mound, which co

Re: [R] Problem with minimization that I failed to understand

2025-03-28 Thread Daniel Lobo
Hi Duncan, Thanks for your comment, I agree with that. But, how it can be justified that an Optimizer gives a result which is inferior to the starting value? At most, resulting value can remain at the same level, isnt it? On Fri, 28 Mar 2025 at 14:34, Duncan Murdoch wrote: > I haven't run your

Re: [R] Problem with minimization that I failed to understand

2025-03-28 Thread Duncan Murdoch
I haven't run your code, but since Kendall correlation is based on ranks, your Fn is probably locally constant with jumps when the ranks change. That's a really hard kind of function to maximize, and the algorithm used by fmincon is not appropriate to do it. Sorry, but I don't know if there i

Re: [R] Problem with minimization that I failed to understand

2025-03-27 Thread Daniel Lobo
The objective is to MAXIMIZE the Kendall Correlation. Given that ?pracma::fmincon minimizes the function, I added a negative sign in the objective function. Description Find minimum of multivariable functions with nonlinear constraints. Therefore we should not remove the negative sign. On Fri,

Re: [R] Problem with minimization that I failed to understand

2025-03-27 Thread Rui Barradas
Às 19:36 de 27/03/2025, Daniel Lobo escreveu: My code is to minimize the objective function therefore, shouldnt I expect that StartingValue = c(0.12, 0.04, 0.07, 0.03, 0.06, 0.07, 0.07, 0.04, 0.09, 0.08, 0.02, 0.02, 0.03, 0.06, 0.02, 0, 0.07, 0.05, 0.02, 0.02, 0.02) Fn(q1$par) < Fn(StartingValu

Re: [R] Problem with minimization that I failed to understand

2025-03-27 Thread Daniel Lobo
My code is to minimize the objective function therefore, shouldnt I expect that StartingValue = c(0.12, 0.04, 0.07, 0.03, 0.06, 0.07, 0.07, 0.04, 0.09, 0.08, 0.02, 0.02, 0.03, 0.06, 0.02, 0, 0.07, 0.05, 0.02, 0.02, 0.02) Fn(q1$par) < Fn(StartingValue) ## FALSE Below is the corrected code that ca

Re: [R] Problem with minimization that I failed to understand

2025-03-27 Thread Rui Barradas
Às 18:35 de 27/03/2025, Daniel Lobo escreveu: Hi, I have below minimization problem MyDat = structure(list(c(50L, 0L, 0L, 50L, 75L, 100L, 50L, 0L, 50L, 0L, 25L, 50L, 50L, 75L, 75L, 75L, 0L, 75L, 75L, 75L, 0L, 25L, 75L, 75L, 0L, 75L, 100L, 0L, 25L, 100L), c(75L, 0L, 0L, 50L, 100L, 50L, 75L, 75L

[R] Problem with minimization that I failed to understand

2025-03-27 Thread Daniel Lobo
Hi, I have below minimization problem MyDat = structure(list(c(50L, 0L, 0L, 50L, 75L, 100L, 50L, 0L, 50L, 0L, 25L, 50L, 50L, 75L, 75L, 75L, 0L, 75L, 75L, 75L, 0L, 25L, 75L, 75L, 0L, 75L, 100L, 0L, 25L, 100L), c(75L, 0L, 0L, 50L, 100L, 50L, 75L, 75L, 100L, 25L, 0L, 25L, 100L, 0L, 50L, 0L, 25L, 25

Re: [R] Problem with converting grib file to excel

2024-09-30 Thread Roy Mendelssohn - NOAA Federal via R-help
I have corresponded with Javad off-line, posting this as a follow-up, to close the issue. There are two separate questions here. The first is why did the posted code below fail. The second is there an easy way to read in the values, given the oddities of his file (more on that), and yes it

Re: [R] Problem with converting grib file to excel

2024-09-26 Thread Roy Mendelssohn - NOAA Federal via R-help
The easiest would be to send the link to the site from which you downloaded the file. Thanks, -Roy > On Sep 26, 2024, at 1:26 PM, CALUM POLWART wrote: > > Attachments CAN NOT be sent to group > > > On Thu, 26 Sep 2024, 21:22 javad bayat, wrote: > Dear Roy, > Sorry for my mistake, I thought

Re: [R] Problem with converting grib file to excel

2024-09-26 Thread CALUM POLWART
Attachments CAN NOT be sent to group On Thu, 26 Sep 2024, 21:22 javad bayat, wrote: > Dear Roy, > Sorry for my mistake, I thought I have uploaded the grib file. > I really apologise for that. I will send it on Saturday. > Thank you very much. > > On Thu, 26 Sept 2024, 17:40 Roy Mendelssohn - N

Re: [R] Problem with converting grib file to excel

2024-09-26 Thread javad bayat
Dear Roy, Sorry for my mistake, I thought I have uploaded the grib file. I really apologise for that. I will send it on Saturday. Thank you very much. On Thu, 26 Sept 2024, 17:40 Roy Mendelssohn - NOAA Federal, < roy.mendelss...@noaa.gov> wrote: > Hi Javad: > > I know a lot about reading GRIB f

Re: [R] Problem with converting grib file to excel

2024-09-26 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi Javad: I know a lot about reading GRIB files, I work with them all the time. But if you don’t make the file available, or point me to where I can download it, there is not much I can do. Thanks, -Roy > On Sep 25, 2024, at 9:41 PM, javad bayat wrote: > > Dear all; > Many thanks for yo

Re: [R] Problem with converting grib file to excel

2024-09-25 Thread javad bayat
Dear all; Many thanks for your responses. Actually it is not completely a GIS file, it is a data file which stores meteorological data of a specific region. But the site allows downloading with grib format and as I searched to read this type of file in R, I found the Raster Package. In python it is

Re: [R] Problem with converting grib file to excel

2024-09-25 Thread Roy Mendelssohn - NOAA Federal via R-help
At least for me the dataset file did not come through. I will look at it if it can be made available. It does look like the finial step of reading the data into raster failed, so then did the rest of th commands. -Roy > On Sep 25, 2024, at 3:24 PM, CALUM POLWART wrote: > > Noticeable lack

Re: [R] Problem with converting grib file to excel

2024-09-25 Thread CALUM POLWART
Noticeable lack of silence in the group on this one. I've not got time to test currently. But my experience of geo location files - they often had more than 2 dimensional data. In other words you might have a boundary of a region as an object with long and lat for maybe 100 data points making up t

Re: [R] Problem with converting grib file to excel

2024-09-24 Thread Bert Gunter
You might try posting on r-sig-geo if you don't get a satisfactory response here. I assume there's a lot of expertise there on handling raster-type data. Cheers, Bert On Mon, Sep 23, 2024 at 11:31 PM javad bayat wrote: > > Dear R users; > I have downloaded a grib file format (Met.grib) and I wan

[R] Problem with converting grib file to excel

2024-09-23 Thread javad bayat
Dear R users; I have downloaded a grib file format (Met.grib) and I want to export its data to excel file. Also I want to do some mathematic on some columns. But I got error. I would be more than happy if anyone can help me to do this. I have provided the codes and the Met.grib file in this email.

Re: [R] Problem with combining monthly nc files into a yearly file (era5 climate data)

2024-06-21 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi Leni: You forget to post the important part - the errors you have been getting and if you have the errors isolated to particular lines in the code. HTH, -Roy > On Jun 21, 2024, at 3:59 AM, Leni Koehnen via R-help > wrote: > > Dear R-help List, > > I am currently trying to run a code w

[R] Problem with combining monthly nc files into a yearly file (era5 climate data)

2024-06-21 Thread Leni Koehnen via R-help
Dear R-help List,  I am currently trying to run a code which is available on Zenodo (https://zenodo.org/records/10997880 - 02_MicroClimModel.R). The code downloads yearly era5 climate data. Unfortunately, the limit to download these nc-files was recently reduced to 6. Therefore, I can not

Re: [R] Problem with creating a PCA graph in a loop

2024-05-08 Thread Gavin Duley
> On 8 May 2024, at 09:16, Ivan Krylov wrote: > > В Tue, 7 May 2024 16:57:14 +0200 > gavin duley пишет: > >> aes(label=current_rownames, >>colour=wine.data.filt$Treatment >> ) > > As you've noticed, aes() remembers variables by their name and > environment, not by value: Yes, it was somet

Re: [R] Problem with creating a PCA graph in a loop

2024-05-08 Thread Ivan Krylov via R-help
В Tue, 7 May 2024 16:57:14 +0200 gavin duley пишет: > aes(label=current_rownames, > colour=wine.data.filt$Treatment > ) As you've noticed, aes() remembers variables by their name and environment, not by value: str(ggplot2::aes(label = foo)) # List of 1 # $ label: language ~foo # <-- variab

[R] Problem with creating a PCA graph in a loop

2024-05-07 Thread gavin duley
Hi all, I am having enormous problems with a loop that iterates over different levels in the factor wine.data$Time (levels T06, T09, and T12) and creates a PCA and graph for individuals at that time only. These graphs need to be accessible outside the loop, so I can combine them using ggpubr::ggar

Re: [R] Problem with base::order

2024-04-10 Thread Sigbert Klinke
Hi, you are unfortunately right. Executing x <- sample(c(1,2,NA), 26, replace=TRUE) y <- sample(c(1,2,NA), 26, replace=TRUE) o <- order(x, y, decreasing = c(T,F), na.last=c(F,T)) cbind(x[o], y[o]) shows that the second entry of na.last is ignored without warning. Thanks Sigbert Am 10.04.24 um

Re: [R] Problem with base::order

2024-04-10 Thread Ivan Krylov via R-help
В Wed, 10 Apr 2024 09:33:19 +0200 Sigbert Klinke пишет: > decreasing=c(F,F,F) This is only documented to work with method = 'radix': >> For the ‘"radix"’ method, this can be a vector of length equal to >> the number of arguments in ‘...’ and the elements are recycled as >> necessary. For the o

[R] Problem with base::order

2024-04-10 Thread Sigbert Klinke
Hi, when I execute order(letters, LETTERS, 1:26) then everything is fine. But if I execute order(letters, LETTERS, 1:26, na.last=c(T,T,T), decreasing=c(F,F,F)) I get the error message Error in method != "radix" && !is.na(na.last) : 'length = 3' in constraint to 'logical(1)' Shouldn't both g

Re: [R] Problem with new version of R: Mutated vocals

2024-03-22 Thread Ivan Krylov via R-help
В Fri, 22 Mar 2024 16:11:14 + MACHO Siegfried via R-help пишет: > If I type the command: > Dir <- "C/Users/macho/Documents/_LVn/Experimentelle _bungen" > in the R console there is no problem. However, if I put the same > command into a source file (e.g. Test.r) and call this file from R > (vi

[R] Problem with new version of R: Mutated vocals

2024-03-22 Thread MACHO Siegfried via R-help
Dear ladies and gentlemen, I have recently installed the latest version of R (4.3.3) for windows. Now I have the following problems with mutated vowels like �, �, etc. Here is an example: If I type the command: Dir <- "C/Users/macho/Documents/_LVn/Experimentelle �bungen" in the R console there i

Re: [R] Problem with R coding

2024-03-12 Thread Ivan Krylov via R-help
В Tue, 12 Mar 2024 14:57:28 + CALUM POLWART пишет: > That's almost certainly going to be either the utf-8 character in the > path The problem, as diagnosed by Maria in the first post of the thread, is that the user home directory as known to R is stored in the ANSI encoding instead of UTF-8,

Re: [R] Problem with R coding

2024-03-12 Thread Iris Simmons
Hi Maria, I had something similar on my Windows work laptop at some point where the home directory was something containing non ASCII characters. The easy solution is to copy said directly from the file explorer into utils::shortPathName, and then set that as the home directory. In my case, > wr

Re: [R] Problem with R coding

2024-03-12 Thread CALUM POLWART
That's almost certainly going to be either the utf-8 character in the path OR the use of one drive which isn't really a subfolder as I understand it. When I've had these issues in the past, I've been able to mount a drive (say U:/ ) which sites further down /up the folder tree so that R just calle

Re: [R] Problem with R coding

2024-03-12 Thread Ivan Krylov via R-help
Dear Maria, I'm sorry for somehow completely missing the second half of your message where you say that you've already tried the workaround. В Tue, 12 Mar 2024 07:43:08 + Maria Del Mar García Zamora пишет: > I have tried to start R from CDM using: C:\Users\marga>set > R_USER=C:\Users\marga\

Re: [R] Problem with R coding

2024-03-12 Thread Ivan Krylov via R-help
В Tue, 12 Mar 2024 07:43:08 + Maria Del Mar García Zamora пишет: > Error: package or namespace load failed for ‘Rcmdr’: > .onLoad failed in loadNamespace() for 'tcltk2', details: > call: file.exists("~/.Rtk2theme") > error: file name conversion problem -- name too long? > > Once this ap

Re: [R] Problem with R coding

2024-03-12 Thread Rui Barradas
Às 07:43 de 12/03/2024, Maria Del Mar García Zamora escreveu: Hello, This is the error that appears when I try to load library(Rcmdr). I am using R version 4.3.3. I have tried to upload the packages, uninstall them and intalling them again and nothing. Loading required package: splines Loading

Re: [R] Problem with compatible library versions

2023-10-13 Thread Sabine Braun
Thank you very much :-)), this worked! Now the loaded libraries are compatible with each other. Best regards Sabine Braun Am 11.10.2023 um 14:08 schrieb Richard O'Keefe: > There is a fairly straightforward way to load older versions > of packages, and that is to use the 'groundhog' package. > A

Re: [R] Problem with compatible library versions

2023-10-12 Thread Richard O'Keefe
program that I write today would still run > without changes in 10 years? > Tim > > -Original Message- > From: R-help On Behalf Of Richard O'Keefe > Sent: Wednesday, October 11, 2023 8:08 AM > To: Uwe Ligges > Cc: r-help@r-project.org > Subject: Re: [R] Proble

Re: [R] Problem with compatible library versions

2023-10-11 Thread Uwe Ligges
#x27;Keefe Sent: Wednesday, October 11, 2023 8:08 AM To: Uwe Ligges Cc: r-help@r-project.org Subject: Re: [R] Problem with compatible library versions [External Email] There is a fairly straightforward way to load older versions of packages, and that is to use the 'groundhog' package. A

Re: [R] Problem with compatible library versions

2023-10-11 Thread Ebert,Timothy Aaron
Is that a method where a program that I write today would still run without changes in 10 years? Tim -Original Message- From: R-help On Behalf Of Richard O'Keefe Sent: Wednesday, October 11, 2023 8:08 AM To: Uwe Ligges Cc: r-help@r-project.org Subject: Re: [R] Problem with compa

Re: [R] Problem with compatible library versions

2023-10-11 Thread Richard O'Keefe
There is a fairly straightforward way to load older versions of packages, and that is to use the 'groundhog' package. As the first sentence of https://groundhogr.com/ puts it: Make your R scripts reproducible by replacing library(pkg) with groundhog.library(pkg, date). pkg can be a vector of

Re: [R] Problem with compatible library versions

2023-10-11 Thread Uwe Ligges
On 10.10.2023 17:34, Sabine Braun wrote: On the github website I have reported several bugs with new versions of the tidyverse group (probably dplyr) which prevent me from using R normally. I wanted to go back to older versions but this seems not bo be easy. I downloaded R 4.1.2. and Rtools 40

[R] Problem with compatible library versions

2023-10-10 Thread Sabine Braun
On the github website I have reported several bugs with new versions of the tidyverse group (probably dplyr) which prevent me from using R normally. I wanted to go back to older versions but this seems not bo be easy. I downloaded R 4.1.2. and Rtools 40 but the library versions installed are st

Re: [R] Problem with filling dataframe's column

2023-06-14 Thread avi.e.gross
2023 10:34 PM To: avi.e.gr...@gmail.com Cc: Bert Gunter ; R-help@r-project.org Subject: Re: [R] Problem with filling dataframe's column Consider m <- list(foo=c(1,2),"B'ar"=as.matrix(1:4,2,2),"!*#"=c(FALSE,TRUE)) It is a collection of elements of different t

Re: [R] Problem with filling dataframe's column

2023-06-14 Thread Richard O'Keefe
times be a good think. As far as I can tell, external > interface seem the same for now. > > One issue with R for a long time was how they did not do something more > like a Python dictionary and it looks like … > > ABOVE > > From: Bert Gunter > Sent: Tuesday, June 13,

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread avi.e.gross
and it looks like … ABOVE From: Bert Gunter Sent: Tuesday, June 13, 2023 6:15 PM To: avi.e.gr...@gmail.com Cc: javad bayat ; R-help@r-project.org Subject: Re: [R] Problem with filling dataframe's column Below. On Tue, Jun 13, 2023 at 2:18 PM mailto:avi.e.gr...@gmail.com>

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Bert Gunter
ot; and others like me call programming and that don't necessarily fit well together. > > > -Original Message- > From: R-help r-help-boun...@r-project.org On Behalf Of javad bayat > Sent: Tuesday, June 13, 2023 3:47 PM > To: Eric Berger ericjber...@gmail.com <mail

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread avi.e.gross
day, June 13, 2023 3:47 PM To: Eric Berger ericjber...@gmail.com <mailto:ericjber...@gmail.com> Cc: R-help@r-project.org <mailto:R-help@r-project.org> Subject: Re: [R] Problem with filling dataframe's column Dear all; I used these codes and I get what I wanted. Sincerely pat = c(&q

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Bill Dunlap
It is safer to use !grepl(...) instead of -grep(...) here. If there are no matches, the latter will give you a zero-row data.frame while the former gives you the entire data.frame. E.g., > d <- data.frame(a=c("one","two","three"), b=c(10,20,30)) > d[-grep("Q", d$a),] [1] a b <0 rows> (or 0-lengt

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Rui Barradas
Às 17:18 de 13/06/2023, javad bayat escreveu: Dear Rui; Hi. I used your codes, but it seems it didn't work for me. pat <- c("_esmdes|_Des Section|0") dim(data2) [1] 281549 9 grep(pat, data2$Layer) dim(data2) [1] 281549 9 What does grep function do? I expected the funct

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread javad bayat
Dear all; I used these codes and I get what I wanted. Sincerely pat = c("Level 12","Level 22","0") data3 = data2[-which(data2$Layer == pat),] dim(data2) [1] 281549 9 dim(data3) [1] 244075 9 On Tue, Jun 13, 2023 at 11:36 AM Eric Berger wrote: > Hi Javed, > grep returns the positions of

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Eric Berger
Hi Javed, grep returns the positions of the matches. See an example below. > v <- c("abc", "bcd", "def") > v [1] "abc" "bcd" "def" > grep("cd",v) [1] 2 > w <- v[-grep("cd",v)] > w [1] "abc" "def" > On Tue, Jun 13, 2023 at 8:50 AM javad bayat wrote: > > Dear Rui; > Hi. I used your codes, but it

Re: [R] Problem with filling dataframe's column

2023-06-12 Thread javad bayat
Dear Rui; Hi. I used your codes, but it seems it didn't work for me. > pat <- c("_esmdes|_Des Section|0") > dim(data2) [1] 281549 9 > grep(pat, data2$Layer) > dim(data2) [1] 281549 9 What does grep function do? I expected the function to remove 3 rows of the dataframe. I do no

Re: [R] Problem with filling dataframe's column

2023-06-12 Thread Rui Barradas
Às 23:13 de 12/06/2023, javad bayat escreveu: Dear Rui; Many thanks for the email. I tried your codes and found that the length of the "Values" and "Names" vectors must be equal, otherwise the results will not be useful. For some of the characters in the Layer column that I do not need to be fill

Re: [R] Problem with filling dataframe's column

2023-06-11 Thread avi.e.gross
mutate() or other methods. -Original Message- From: R-help On Behalf Of javad bayat Sent: Sunday, June 11, 2023 4:05 PM To: R-help@r-project.org Subject: [R] Problem with filling dataframe's column Dear R users; I am trying to fill a column based on a specific value in another colum

Re: [R] Problem with filling dataframe's column

2023-06-11 Thread Rui Barradas
Às 13:18 de 11/06/2023, Rui Barradas escreveu: Às 22:54 de 11/06/2023, javad bayat escreveu: Dear Rui; Many thanks for your email. I used one of your codes, "data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works correctly for me. Actually I need to expand the codes so as to conside

Re: [R] Problem with filling dataframe's column

2023-06-11 Thread Rui Barradas
Às 22:54 de 11/06/2023, javad bayat escreveu: Dear Rui; Many thanks for your email. I used one of your codes, "data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works correctly for me. Actually I need to expand the codes so as to consider all "Levels" in the "Layer" column. There are

Re: [R] Problem with filling dataframe's column

2023-06-11 Thread javad bayat
Dear Rui; Many thanks for your email. I used one of your codes, "data2$LU[which(data2$Layer == "Level 12")] <- "Park"", and it works correctly for me. Actually I need to expand the codes so as to consider all "Levels" in the "Layer" column. There are more than hundred levels in the Layer column. If

Re: [R] Problem with filling dataframe's column

2023-06-11 Thread Rui Barradas
Às 21:05 de 11/06/2023, javad bayat escreveu: Dear R users; I am trying to fill a column based on a specific value in another column of a dataframe, but it seems there is a problem with the codes! The "Layer" and the "LU" are two different columns of the dataframe. How can I fix this? Sincerely

[R] Problem with filling dataframe's column

2023-06-11 Thread javad bayat
Dear R users; I am trying to fill a column based on a specific value in another column of a dataframe, but it seems there is a problem with the codes! The "Layer" and the "LU" are two different columns of the dataframe. How can I fix this? Sincerely for (i in 1:nrow(data2$Layer)){ if (d

Re: [R] Problem with integrate(function(x) x^3 / sin(x), -pi/2, pi/2)

2023-01-07 Thread Ivan Krylov
On Sun, 8 Jan 2023 05:24:05 +0200 Leonard Mada via R-help wrote: > pracma::integral(function(x) x^3 / sin(x), -pi/2, pi/2 ) > # 3.385985 Note that at least one implementation used by pracma::integral has the same problem: pracma::integral(function(x) x^3/sin(x), -pi/2, pi/2, no_intervals=7) # [

Re: [R] Problem with integrate(function(x) x^3 / sin(x), -pi/2, pi/2)

2023-01-07 Thread Andrew Simmons
`subdivisions` is the maximum number of subintervals. Looking here https://github.com/wch/r-source/blob/79298c499218846d14500255efd622b5021c10ec/src/appl/integrate.c#L1275 I'm not surprised that changing `subdivisions` has no effect on the outcome. The integration method from {pracma} might work,

Re: [R] Problem with integrate(function(x) x^3 / sin(x), -pi/2, pi/2)

2023-01-07 Thread Andrew Simmons
You're dividing 0 by 0, giving you NaN, perhaps you should try function(x) ifelse(x == 0, 0, x^3/sin(x)) On Sat, Jan 7, 2023, 22:24 Leonard Mada via R-help wrote: > Dear List-Members, > > I encounter a problem while trying to integrate the following function: > > integrate(function(x) x^3 / sin

[R] Problem with integrate(function(x) x^3 / sin(x), -pi/2, pi/2)

2023-01-07 Thread Leonard Mada via R-help
Dear List-Members, I encounter a problem while trying to integrate the following function: integrate(function(x) x^3 / sin(x), -pi/2, pi/2) # Error in integrate(function(x) x^3/sin(x), -pi/2, pi/2) : #  non-finite function value # the value should be finite: curve(x^3 / sin(x), -pi/2, pi/2) int

Re: [R] Problem with Windows clipboard and UTF-8

2022-10-13 Thread Tomas Kalibera
Hi Andrew, On 9/30/22 15:05, Andrew Hart via R-help wrote: Hi everyone, Recently I upgraded to R 4.2.1 which now uses UTF-8 internally as its native encoding. Very nice. However, I've discovered that if I use writeClipboard to try and move a string containing accented characters to the Windo

Re: [R] Problem with Windows clipboard and UTF-8

2022-09-30 Thread Rui Barradas
Hello, I can reproduce this. C:\Users\ruipb>R -q -e "writeClipboard('categoría'); sessionInfo()" > writeClipboard('categoría'); sessionInfo() R version 4.2.1 (2022-06-23 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22000) Matrix products: default local

[R] Problem with Windows clipboard and UTF-8

2022-09-30 Thread Andrew Hart via R-help
Hi everyone, Recently I upgraded to R 4.2.1 which now uses UTF-8 internally as its native encoding. Very nice. However, I've discovered that if I use writeClipboard to try and move a string containing accented characters to the Windows clipboard and then try and paste that into another applic

Re: [R] Problem with installing packages in R

2022-09-15 Thread Eric Berger
Can you bring up R in a shell? Do you get the same message? (Also, set your email to send plain text. HTML versions are deleted.) On Thu, Sep 15, 2022 at 11:27 AM Farah Al Saifi wrote: > > Dear Sir/Madam > > After the update of the new version of R 4.2.1, an error message ( Error in > nchar(ho

[R] Problem with installing packages in R

2022-09-15 Thread Farah Al Saifi
Dear Sir/Madam After the update of the new version of R 4.2.1, an error message ( Error in nchar(homeDir): invalid multibyte string, element 1) appears every time i open RStudio. Also the following warning message appears in the console: In normalizePath (path.expand(path), winslash, mustwork

Re: [R] Problem with data distribution

2022-02-17 Thread Ebert,Timothy Aaron
: Thursday, February 17, 2022 4:54 PM To: Bert Gunter Cc: r-help mailing list Subject: Re: [R] Problem with data distribution [External Email] :) :) On Thu, Feb 17, 2022 at 10:37 PM Bert Gunter wrote: > imo, with such simple data, a plot is mere chartjunk. A simple table(= > the distri

Re: [R] Problem with data distribution

2022-02-17 Thread Neha gupta
gt; (Why would you want to plot a vector of all zeros, btw?) > > > > > > > > > > > > library(dplyr) > > > > > > boxplot(filter(data, bug == 0))# nonsense > > > boxplot(filter(data, bug > 0), range = 0) > > > > > > #

Re: [R] Problem with data distribution

2022-02-17 Thread Neha gupta
: > > That is all the code I have. How can I provide a reproducible code ? > > > > How can I save this result? > > > > On Thu, Feb 17, 2022 at 8:00 PM Ebert,Timothy Aaron > wrote: > > > >> You pipe the filter but do not save the result. A reproducible example &

Re: [R] Problem with data distribution

2022-02-17 Thread Neha gupta
Dear John, thanks a lot for the detailed answer. Yes, I am not an expert in R language and when a problem comes in, I google it or post it on these forums. (I have just a little bit experience of ML in R). On Thu, Feb 17, 2022 at 8:21 PM John Fox wrote: > Dear Nega gupta, > > On 2022-02-17 1:

Re: [R] Problem with data distribution

2022-02-17 Thread John Fox
Dear Nega gupta, In the last point, I meant to say, "Finally, it's better to post to the list in plain-text email, rather than html (as the posting guide suggests)." (I accidentally inserted a "not" in this sentence.) Sorry, John On 2022-02-17 2:21 p.m., John Fox wrote: Dear Nega gupta, O

Re: [R] Problem with data distribution

2022-02-17 Thread John Fox
Dear Neha gupta, I hope that I'm not overstepping my role when I say that googling solutions to specific problems isn't an inefficient way to learn a programming language, and will probably waste your time in the long run. There are many good introductions to R. Best, John On 2022-02-17 2:

Re: [R] Problem with data distribution

2022-02-17 Thread Rui Barradas
e- From: R-help On Behalf Of Neha gupta Sent: Thursday, February 17, 2022 1:55 PM To: r-help mailing list Subject: [R] Problem with data distribution [External Email] Hello everyone I have a dataset with output variable "bug" having the following values (at the bottom of this email). M

Re: [R] Problem with data distribution

2022-02-17 Thread Neha gupta
- > From: R-help On Behalf Of Neha gupta > Sent: Thursday, February 17, 2022 1:55 PM > To: r-help mailing list > Subject: [R] Problem with data distribution > > [External Email] > > Hello everyone > > I have a dataset with output variable "bug" having t

Re: [R] Problem with data distribution

2022-02-17 Thread Ebert,Timothy Aaron
You pipe the filter but do not save the result. A reproducible example might help. Tim -Original Message- From: R-help On Behalf Of Neha gupta Sent: Thursday, February 17, 2022 1:55 PM To: r-help mailing list Subject: [R] Problem with data distribution [External Email] Hello everyone

[R] problem with switching windows in RSelenium..

2021-12-22 Thread akshay kulkarni
dear Kim, Hope you are doing well. I am Akshay, from bengaluru, INDIA. I am stock trader and am using R for my research. More specifically, I am using RSelenium to scrape news articles. I am stuck in the problem related to RSelenium. I am not able to switch windows in Rselenium

[R] problem with RSelenium....

2021-12-18 Thread akshay kulkarni
dear members, I am using RSelenium. I have downloaded the java binary standalone server. I am running it in my windows powershell with the following command: java -jar selenium-server-standalone-4.0.0-alpha-2.jar (note that the command doesn't get finished in the pow

Re: [R] Problem with lm Giving Wrong Results

2021-12-03 Thread Labone, Thomas
Health University of South Carolina Columbia, South Carolina USA From: Sarah Goslee Sent: Friday, December 3, 2021 11:00 AM To: Labone, Thomas Cc: Bill Dunlap ; r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results It might also be a BLAS

Re: [R] Problem with lm Giving Wrong Results

2021-12-03 Thread Sarah Goslee
t;Min. 1st Qu. MedianMean 3rd Qu.Max. > 0.3767 0.8204 0.9659 0.9947 1.1372 2.4772 > > > > > Thomas R. LaBone > PhD student > Department of Epidemiology and Biostatistics > Arnold School of Public Health > University of South Carolina > Columbia, South Carolina USA > > >

Re: [R] Problem with lm Giving Wrong Results

2021-12-03 Thread Labone, Thomas
h Carolina Columbia, South Carolina USA From: Labone, Thomas Sent: Thursday, December 2, 2021 11:53 AM To: Bill Dunlap Cc: r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results > summary(fit) Call: lm(formula = log(k) ~ Z) Residuals:

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
Cc: r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results On the 'bad' machines, what did you get for summary(fit) summary(k) summary(Z) summary(gm*gsd^Z) ? -Bill On Thu, Dec 2, 2021 at 6:18 AM Labone, Thomas mailto:lab...@email.sc.edu>> wrote: In t

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Duncan Murdoch
On 02/12/2021 5:50 a.m., Labone, Thomas wrote: In the code below the first and second plots should look pretty much the same, the only difference being that the first has n=1000 points and the second n=1 points. On two of my Linux machines (info below) the second plot is a horizontal line

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Bill Dunlap
On the 'bad' machines, what did you get for summary(fit) summary(k) summary(Z) summary(gm*gsd^Z) ? -Bill On Thu, Dec 2, 2021 at 6:18 AM Labone, Thomas wrote: > In the code below the first and second plots should look pretty much the > same, the only difference being that the first h

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Ivan Krylov
On Thu, 2 Dec 2021 14:34:42 + "Labone, Thomas" wrote: > Can someone point me to the procedure for switching from the Intel > Math Library back to the standard math library so that I can see if > the problem is associated with using MKL? Depends on how you have installed it. You mentioned usi

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
University of South Carolina Columbia, South Carolina USA From: J C Nash Sent: Thursday, December 2, 2021 9:31 AM To: Labone, Thomas ; r-help@r-project.org Subject: Re: [R] Problem with lm Giving Wrong Results I get two similar graphs. https://protect2

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread J C Nash
I get two similar graphs. https://web.ncf.ca/nashjc/jfiles/Rplot-Labone-4095.pdf https://web.ncf.ca/nashjc/jfiles/RplotLabone10K.pdf Context: R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Linux Mint 20.2 Matrix products: default BLAS: /usr/lib/x86_64-linu

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Eric Berger
Hi Thomas, I could not reproduce your problem. Both examples worked fine for me. Here is my setup: R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK

[R] Problem with lm Giving Wrong Results

2021-12-02 Thread Labone, Thomas
In the code below the first and second plots should look pretty much the same, the only difference being that the first has n=1000 points and the second n=1 points. On two of my Linux machines (info below) the second plot is a horizontal line (incorrect answer from lm), but on my Windows 10

Re: [R] problem with creation of /doc/index.html

2021-11-12 Thread Bert Gunter
I believe the R-package-devel list is where you should post this, not here (though you might get lucky here). See here for details: https://www.r-project.org/mail.html Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Ber

[R] problem with creation of /doc/index.html

2021-11-11 Thread Oleksandr Ocheredko via R-help
I use macOS BigSur v.11.5 R v.4.0.5 macOS package «ltable» does power analysis based on GSL-2.7 Xcode v.13.1 It goes smoothly with all OK on Checking, building, installing both with R and RStudio v. 1.3.1093 The only problem appears with Installing package in RStudio immediately after deleting i

Re: [R] problem with plotting clustered data with convex hull using ggfortify

2021-10-24 Thread Karl Schilling
Dear Mr Barradas, thank you so much. After going back to the 4.1.1 version, the convex hulls were plotted again (R 4.1.0. Windows). Will forward all this to the package maintainer. But for the moment, your hint is of great help. Thank you, all my best Karl On 25.10.2021 00:32, Rui Barrada

Re: [R] problem with plotting clustered data with convex hull using ggfortify

2021-10-24 Thread Rui Barradas
Hello, R 4.1.1 on Ubuntu 20.04.3 LTS. I can reproduce this error. It happens with ggfortify 0.4.12 but not with 0.4.11. First ggfortify 0.4.11, notice the warnings. rui@rui:~$ R -q -f rhelp.R > library(ggfortify) Loading required package: ggplot2 > library(cluster) > > autoplot(fanny(iris[-

  1   2   3   4   5   6   7   8   9   10   >