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 installing some r-packages via spack

2024-11-26 Thread Eric Berger
I have never used Spack but I took a quick look at their website. They have the option to install binaries. Perhaps this could work for you and avoid the compilation error. Here is where they describe how to do it: https://spack.io/spack-binary-packages/ On Wed, Nov 27, 2024 at 9:29 AM Oren Shani

[R] Problem installing some r-packages via spack

2024-11-26 Thread Oren Shani
Hi All, This occurs when I try to install certain r packages via the Spack package manager (the example is for DelayedArray): 70** R 71** inst 72** byte-compile and prepare package for lazy loading >> 73Error: objects 'crossprod', 'tcrossprod' are not exported by

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 loading BiodiversityR, Error: package ‘tcltk’ could not be loaded

2024-07-14 Thread Ivan Krylov via R-help
В Sat, 13 Jul 2024 16:04:17 +0100 Adam Hillier пишет: > error: X11 library is missing: install XQuartz from www.xquartz.org Does the problem go away if you install XQuartz from www.xquartz.org? "R installation and administration" section 4 also documents the requirement to have XQuartz instal

[R] Problem loading BiodiversityR, Error: package ‘tcltk’ could not be loaded

2024-07-14 Thread Adam Hillier
Hi, I get the following error when trying to load the BiodiversityR package > library(> library(BiodiversityR) Loading required package: tcltk tcltk DLL is linked to '/opt/X11/lib/libX11.6.dylib' Error: package or namespace load failed for ‘tcltk’: .onLoad failed in loadNamespace() for 'tcltk',

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

[R] PROBLEM RESOLED::code for year month day hr format

2024-06-19 Thread Jibrin Alhassan
The help I sought on code for year month day and hr format for solar wind hourly data has been resolved. Thank you all for your time, patience and wonderful contributions. Jibrin Alhassan. On Mon, Jun 17, 2024, 9:26 PM Jibrin Alhassan wrote: > Hello Rui, > Thanks for your kind and unrelenting

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 when trying to install packages

2024-03-18 Thread peter dalgaard
2 things: 1) utils::install.packages() sometimes helps if the Rstudio version got wedged somehow. 2) You seem to be missing several Recommended packages (lattice, MASS, Matrix, nlme, cluster,). Did you install R without those? -pd > On 16 Mar 2024, at 05:09 , javad bayat wrote: > >

Re: [R] Problem when trying to install packages

2024-03-16 Thread Uwe Ligges
On 16.03.2024 10:48, javad bayat wrote: Dear all; I found a useful video on youtube that has explained how to install Rtools. I followed the instructions and the problem was solved. " Installing R version 4.0 + RTools 4.0 + RStudio For Data Science (#R ?? A recent set of released software wou

Re: [R] Problem when trying to install packages

2024-03-16 Thread javad bayat
Dear all; I found a useful video on youtube that has explained how to install Rtools. I followed the instructions and the problem was solved. " Installing R version 4.0 + RTools 4.0 + RStudio For Data Science (#R #RTools #RStudio #DataScience) - YouTube

Re: [R] Problem when trying to install packages

2024-03-15 Thread Bert Gunter
Though Navigator may mess up any Rtools stuff because it handles the directory trees where packages and dependencies are located, does it not? If so, maybe just reinstall RStudio directly from its website to proceed. Just a guess obviously. Bert On Sat, Mar 16, 2024, 05:09 javad bayat wrote: >

Re: [R] Problem when trying to install packages

2024-03-15 Thread Bert Gunter
? Google it! "How to install packages using Rtools" Bert On Sat, Mar 16, 2024, 05:09 javad bayat wrote: > Dear Rui; > Many thanks for your reply. I have installed Rtools (rtools43-5958-5975) on > my PC and I have R version 4.3.3 and 4.3.2 to install. Also I have > installed Rstudio through An

Re: [R] Problem when trying to install packages

2024-03-15 Thread javad bayat
Dear Rui; Many thanks for your reply. I have installed Rtools (rtools43-5958-5975) on my PC and I have R version 4.3.3 and 4.3.2 to install. Also I have installed Rstudio through Anaconda Navigator. But I do not know how to use Rtools for installing the R packages. I would be more than happy if yo

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 in R code

2023-11-09 Thread Ivan Krylov
В Wed, 8 Nov 2023 16:03:15 +0530 Crown Flame пишет: > for(i in 1:8) > { > LST_city <- extract(LST, c(lon[i],lat[i]), fun = mean, buffer = > 1, na.rm = TRUE) #error > } Three things you might need to change: 1. You are trying to assign the output of extract() to the same variable LST_cit

[R] Problem in R code

2023-11-09 Thread Crown Flame
Good afternoon, I have been working on my thesis project on the topic "Urban Heat Island Pattern in India". To achieve the results I am applying a* two-dimensional Gaussian fit* on an LST raster of 1 km spatial resolution but I am facing two errors in the following code. library(raster) LST <- ras

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] R - Problem retrieving memory used after gc() using arrow library

2023-08-16 Thread Ivan Krylov
On Wed, 16 Aug 2023 11:22:00 +0200 Kévin Pemonon wrote: > I'd like to understand why there's a difference in memory used > between the Windows task manager and R's memory.size(max=F) function. When R was initially ported to Windows, then-popular version of the system memory allocator was not a g

[R] R - Problem retrieving memory used after gc() using arrow library

2023-08-16 Thread Kévin Pemonon
Hello, I'm using R versions 4.1.3 on Windows 10 and I'm having a problem with memory usage. Currently, I need to use the arrow and dplyr libraries in a program and when I compare the memory used between the windows task manager and the memory.size(max=F) function, the one given by the windows tas

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

[R] problem in arfima in forecast...

2023-04-25 Thread akshay kulkarni
Dear members, I am using the forecast package for arfima modelling. THe following is the code: > arfima(ygrpch(OHLCDataEP[[1]])) Call: arfima(y = ygrpch(OHLCDataEP[[1]])) *** Warning during (fdcov) fit: unable to compute correlation matrix; maybe change 'h' Coef

Re: [R] problem installing RUcausal library

2023-04-23 Thread Jeff Newmiller
Perhaps read the Posting Guide, note that there is a special mailing list for MacOSX-specific questions, and post there instead? You don't appear to have installed gfortran. I am aware that there are specific instructions for getting that installed in MacOS that you need to find and follow [1].

Re: [R] problem installing RUcausal library

2023-04-23 Thread Ivan Krylov
В Sat, 22 Apr 2023 19:41:59 + (UTC) varin sacha via R-help пишет: > Working with a MAC, I have tried to install the RUcausal library > (copy and paste the installation command). For Mac-related problems, try r-sig-...@r-project.org. > ld: warning: directory not found for option > '-L/opt/R/

[R] problem installing RUcausal library

2023-04-22 Thread varin sacha via R-help
Me again ! How to solve this? At the end of this page there is the installation command : https://gitlab.science.ru.nl/gbucur/RUcausal/-/blob/master/README.Rmd Working with a MAC, I have tried to install the RUcausal library (copy and paste the installation command). It is written that the pack

Re: [R] problem installing RGBL library

2023-04-22 Thread varin sacha via R-help
Bert, Thanks ! It works ! Best, Le samedi 22 avril 2023 à 19:42:18 UTC+2, Bert Gunter a écrit : Is lvida.R in your working directory? Try using the full path name to the file instead in source() -- Bert On Sat, Apr 22, 2023 at 9:38 AM varin sacha via R-help wrote: > > The proble

Re: [R] problem installing RGBL library

2023-04-22 Thread Bert Gunter
Is lvida.R in your working directory? Try using the full path name to the file instead in source() -- Bert On Sat, Apr 22, 2023 at 9:38 AM varin sacha via R-help wrote: > > The problem is that I am trying to run this R code : > https://github.com/dmalinsk/lv-ida/blob/master/example.R > > > So I

Re: [R] problem installing RGBL library

2023-04-22 Thread varin sacha via R-help
The problem is that I am trying to run this R code : https://github.com/dmalinsk/lv-ida/blob/master/example.R   So I run : library(pcalg) library(igraph) library(RBGL) source("lvida.R") Here is what I get : source("lvida.R") Error in file(filename, "r", encoding = encoding) :   cannot open the

Re: [R] problem installing RGBL library

2023-04-22 Thread Eric Berger
looks fine. what's the problem? On Sat, Apr 22, 2023 at 7:27 PM varin sacha wrote: > Eric, > > Here it is : > > > library(RBGL) > Loading required package: graph > Loading required package: BiocGenerics > > Attaching package: ‘BiocGenerics’ > > The following objects are masked from ‘package:igra

Re: [R] problem installing RGBL library

2023-04-22 Thread varin sacha via R-help
Eric, Here it is : library(RBGL) Loading required package: graph Loading required package: BiocGenerics Attaching package: ‘BiocGenerics’ The following objects are masked from ‘package:igraph’:   normalize, path, union The following objects are masked from ‘package:stats’:   IQR, mad, sd, v

Re: [R] problem installing RGBL library

2023-04-22 Thread Eric Berger
What happens with the command > library(RBGL) On Sat, Apr 22, 2023 at 7:08 PM varin sacha via R-help wrote: > Dear R-experts, > > How to solve that problem? > > My R version is 4.2.1 > > Here below trying to install RGBL library found here : > https://bioconductor.org/packages/release/bioc/htm

[R] problem installing RGBL library

2023-04-22 Thread varin sacha via R-help
Dear R-experts, How to solve that problem? My R version is 4.2.1 Here below trying to install RGBL library found here :  https://bioconductor.org/packages/release/bioc/html/RBGL.html So, I run this R code : if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocM

Re: [R] Problem of intercept?

2023-02-22 Thread varin sacha via R-help
Dear Peter, Bert and Timothy, Really appreciated your help. I guess Peter's comments were the nearest of what I was trying to do. I have tried but it still does not work. I mean the graph is showing the coefficients I am not expecting ! I will try to explain.  Starting from the equation : Y = b0

Re: [R] Problem of intercept?

2023-02-22 Thread peter dalgaard
Not sure what you are trying to do here. The immediate issue is that you are getting 'y' on the RHS, because that is the 1st column in Dataset. So "for (i in 2:3)" might be closer to intention. However, a 0/1 regresson with no intercept implies that the mean for the "0" group is zero, and with

Re: [R] Problem of intercept?

2023-02-21 Thread Bert Gunter
Sigh... In a linear model with qualitative predictor variables, models with and without intercepts are just different parameterizations of the *same* model. -- they produce exactly the same predicted responses. So what do you mean? Search on "contrasts in linear models R" and similar for an expl

[R] Problem of intercept?

2023-02-21 Thread varin sacha via R-help
Dear R-experts, Here below my R code working with quite a few warnings.  x11 and x12 are dichotomous variable (0=no and 1=yes). I substract 1 to ignore intercept. I would like not to ignore intercept. How to modify my R code because if I just remove -1 it does not work? y= c(32,45,65,34,23,43,

Re: [R] Problem to run python code in r markdown

2023-01-20 Thread avi.e.gross
lled somewhere on your machine. When you get things aligned, you will be fine. -Original Message- From: R-help On Behalf Of Kai Yang via R-help Sent: Friday, January 20, 2023 11:20 AM To: R-help Mailing List Subject: [R] Problem to run python code in r markdown Hi Team,I'm

Re: [R] Problem to run python code in r markdown

2023-01-20 Thread Milan Glacier
Maybe it is the order. You called py_install() first and then called use_condaenv(). Perhaps you need to switch to your conda env first and then call py_install(). On 01/20/23 16:20, Kai Yang via R-help wrote: Hi Team,I'm trying to run python in R markdown (flexdashboard). The code is below: t

Re: [R] Problem to run python code in r markdown

2023-01-20 Thread Eric Berger
You don't specify what platform you are on (linux / Windows / other), and what tools you are using. I am running a linux system and I have virtual environments set up. I set the environment variable RETICULATE_PYTHON to point to python (in my virtual environment). I am using RStudio, and I use the

[R] Problem to run python code in r markdown

2023-01-20 Thread Kai Yang via R-help
Hi Team,I'm trying to run python in R markdown (flexdashboard). The code is below: try Python= ```{r, include=FALSE, echo=TRUE}library(reticulate)py_install("numpy") use_condaenv("base") ``` ```{python}import numpy as np``` I got error message below: Error in py_call_impl(callable, 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

  1   2   3   4   5   6   7   8   9   10   >