Re: [R] "use of NULL environment is defunct" when trying to lock a reference class

2018-08-28 Thread Ivan Krylov
Hi Eric, Thank you for your answer! On Mon, 27 Aug 2018 21:48:50 +0300 Eric Berger wrote: > you might want to consider the more recent R6 package Indeed, R6 has private fields which fits my idea of an object with mutable state even better. My original problem seems to be solved and I'm

[R] "use of NULL environment is defunct" when trying to lock a reference class

2018-08-27 Thread Ivan Krylov
Hi! I'm trying to create a persistent memoising class with a destructor and an option to evaluate cache misses in parallel. I want to lock all its fields because it doesn't make sense to change them after the filename, the environment object and the function are set in the object. (I'm not sure

Re: [R] histogram in GNU R....

2018-09-07 Thread Ivan Krylov
On Fri, 7 Sep 2018 08:26:22 + akshay kulkarni wrote: > when I type hist(xht), it goes to the next prompt. More importantly, > there is no error message. So, the most probable conclusion is that > the command gets executed Yes, hist() returns its value invisibly (try typing "? invisible" in

Re: [R] getting 21 very different colours

2018-09-11 Thread Ivan Krylov
On Tue, 11 Sep 2018 07:34:51 + Federico Calboli wrote: > Is there a way of getting a set of 21 colours that maximises the > differences between them? In my limited experience, getting even 10 colours to look different enough is a serious undertaking. Take a look at RColorBrewer:

Re: [R] regexp mystery

2018-10-16 Thread Ivan Krylov
On Tue, 16 Oct 2018 08:36:27 + PIKAL Petr wrote: > > dput(x[11]) > "et odYezko: 3 \fas odYezku: 15 s" > gsub("^.*: (\\d+).*$", "\\1", x[11]) > works for 3 This regular expression only matches one space between the colon and the number, but you have more than one of

Re: [R] Cannot use R on Windows when installed to an external drive with a space in the path

2018-10-22 Thread Ivan Krylov
This is a bin\R.exe + bin\Rscript.exe bug. On Windows, where the system call to create a process only takes one command line string instead of an array of command line parameters[0] (and the C runtimes usually call CommandLineToArgvW[1] behind the scenes to get an array back), execv() does

Re: [R] Encoding issue

2018-11-05 Thread Ivan Krylov
On Mon, 5 Nov 2018 08:36:13 -0500 (EST) Sebastien Bihorel wrote: > [1] "râs" Interesting. This is what I get if I decode the bytes 72 e2 80 99 73 0a as latin-1 instead of UTF-8. They look like there is only three characters, but, actually, there is more: $ perl -CSD -Mcharnames=:full

Re: [R] Potential R bug in identical

2019-01-17 Thread Ivan Krylov
On Thu, 17 Jan 2019 21:05:07 + Layik Hama wrote: > Why would `identical(str, "Accident_Index", ignore.case = TRUE)` > behave differently on Linux/MacOS vs Windows? Because str is different from "Accident_Index" on Windows: it was decoded from bytes to characters according to different rules

Re: [R] Potential R bug in identical

2019-01-17 Thread Ivan Krylov
On Thu, 17 Jan 2019 14:55:18 + Layik Hama wrote: > There seems to be some weird and unidentifiable (to me) characters in > front of the `Accidents_Index` column name there causing the length > to be 17 rather than 14 characters. Repeating the reproduction steps described at the linked pull

[R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Ivan Krylov
Hi! I needed to generalize a loss function being optimized inside another function, so I made it a function argument with a default value. It worked without problems, but later I noticed that the inner function, despite being defined in the function arguments, somehow closes over a variable

Re: [R] Help with if else branching print out

2018-12-18 Thread Ivan Krylov
On Tue, 18 Dec 2018 08:56:23 + Andrew wrote: > How do I: > > (a) reduce the gap between the reported number (i.e., 17, 9, 13) in > each of the lines? and > > (b) ensure that in the case of the second run using 9 as the input, > the print is not over two lines? Build a single string from

Re: [R] Problem with system() and source on linux

2018-12-20 Thread Ivan Krylov
On Thu, 20 Dec 2018 12:00:04 +0100 Agustin Lobo wrote: > For a given program, I need to set up its environment, which I > normally do with source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile > from the terminal. The problem with this approach is that in Unix-like systems, child processes cannot

Re: [R] User Interfaces for R

2019-01-10 Thread Ivan Krylov
On Wed, 9 Jan 2019 14:29:22 -0500 (EST) Bernard McGarvey wrote: > Can anyone point me to such an easy to use package to create GUIs for > R? If you want a traditional approach, a lot of R installations have Tcl/Tk support built in (i.e. capabilities('tcltk') is TRUE). This means that you can

Re: [R] User Interfaces for R

2019-01-11 Thread Ivan Krylov
On Thu, 10 Jan 2019 19:25:30 -0500 Duncan Murdoch wrote: > Eric's suggestion of Shiny is newer, and is a really well-designed > system. A fairly steep learning curve, but worth it. I understand the need for progress and I really like Shiny's API - it feels very declarative and easy to write,

Re: [R] sink() output to another directory

2018-09-14 Thread Ivan Krylov
В Thu, 13 Sep 2018 15:49:52 -0700 (PDT) Rich Shepard пишет: > sink('stat-summaries/estacada-wnw-precip.txt') > print(/summary(estacada_wnw_wx)) > sink() Just remove the slash from your print command (line 25 of rainfall-dubois-crk-all.r) because it's a syntax error (must be a typo). I.e. the

Re: [R] Help with setting locale

2018-09-16 Thread Ivan Krylov
On Fri, 14 Sep 2018 10:02:01 +0200 Kim Titcombe wrote: > I am based in Switzerland but work in English (Windows in English), > hence want English as default. Which Windows version do you use? Which languages/language packs do you have installed? -- Best regards, Ivan

Re: [R] Help with setting locale

2018-09-17 Thread Ivan Krylov
On Sun, 16 Sep 2018 21:18:45 +0200 Kim Titcombe wrote: > I have Windows 10. English version. Do you have any other problems, besides the warning message at startup? According to MSDN[1], the combination of English language and Swiss cultural rules should be supported in Windows 10 >= v1607

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-26 Thread Ivan Krylov
On Thu, 24 Jan 2019 06:53:20 -0800 Jeff Newmiller wrote: > It would be better to also make secret an argument to outside instead > of a local variable or to give up on supplying the inside function as > an argument. This was in a small, mostly self-contained one-off script that tested different

Re: [R] converting a character string to an object name

2019-03-29 Thread Ivan Krylov
On Fri, 29 Mar 2019 14:07:16 +0100 Assa Yeroslaviz wrote: > Is there a way to read for each sheet the name from names(wb) and > convert it to a name for the object? See `get` and `assign` functions for a way to use strings as object names. Generally, it might not be a good idea to do that (what

Re: [R] problem with nls....

2019-03-23 Thread Ivan Krylov
On Fri, 22 Mar 2019 12:29:14 + akshay kulkarni wrote: > How do I get the gradient, Hessian, and the jacobian of the > objective function created by call to the nls? nls() return value is a list containing an entry named `m`, which is an object of type "nlsModel". It doesn't seem to be

Re: [R] Just confirming (?): No way to "export" a (Quartz) plot...

2019-03-25 Thread Ivan Krylov
On Sun, 24 Mar 2019 23:35:30 -0700 David Goldsmith wrote: > No way to "export" a (Quartz) plot... > ...once I've got it the way I want it, (e.g., to a PNG) Well, there seems to be a quartz.save() function, but I cannot attest to its well-behavedness, not having a Mac to test it on. -- Best

Re: [R] String replace

2019-04-03 Thread Ivan Krylov
On Wed, 3 Apr 2019 15:01:37 +0100 Graham Leask via R-help wrote: Suppose that `BHC$Date` contains a string "M_24". You do: > BHC <-BHC %>% mutate ( Date = stringr :: str_replace ( Date , "M_2" , > "01-04-2017")) before you have a chance to do: > BHC <-BHC %>% mutate ( Date = stringr ::

Re: [R] Remove Even Number from A Vector

2019-03-03 Thread Ivan Krylov
Hi Darren, On Sat, 2 Mar 2019 22:27:55 + Darren Danyluk wrote: > It sounds like she is working with the very basics of this software, > and her task is to write the code which would result in the > extraction of "odd" data from a dataset of restaurant sales. Not a native English speaker

Re: [R] Unobtainable source code of specific functions

2019-03-14 Thread Ivan Krylov
On Thu, 14 Mar 2019 15:44:07 +0100 (CET) julien.lacr...@student.uliege.be wrote: > My question is therefore the following, how or where could I find > these source code ? (Note : I have the package Igraph installed) Functions wrapped in .Call() are implemented in a compiled language, with

Re: [R] Extract data of special character

2019-03-14 Thread Ivan Krylov
On Fri, 15 Mar 2019 03:06:28 +0800 roslinazairimah zakaria wrote: > how many of ATTRIBUTE related to TRAITS. The table() function can be used to count occurrences of each combination of factor levels. Does extracting the two columns by dd[,c('ATTRIBUTE','TRAIT')] and passing the result to

Re: [R] problem with nlsLM.....

2019-03-20 Thread Ivan Krylov
On Wed, 20 Mar 2019 09:43:11 + akshay kulkarni wrote: > But doesn't removing some of the parameters reduce the precision of > the relationship between the response variable and the > predictors(inefficient estimates of the coefficients)? No, it doesn't, since there is already more variables

Re: [R] problem with nlsLM.....

2019-03-20 Thread Ivan Krylov
On Wed, 20 Mar 2019 08:02:45 + akshay kulkarni wrote: > formulaDH5 <- as.formula(HM1 ~ (a + (b * ((HM2 + 0.3)^(1/2 + > (A*sin(w*HM3 + c) + C)) The problem with this formula is simple: the partial derivative with respect to `a` is the same as the partial derivative with respect to `C`.

Re: [R] System("source activate condaenv")

2019-03-20 Thread Ivan Krylov
On Wed, 20 Mar 2019 09:59:21 +0100 Sandra Elisabeth Chaudron wrote: > I am using the server version of RStudio and I have a script where I > want to activate the conda environment that I set up for a > bioinformatic tool called MinVar. > For that I use in my script the command: system("source >

Re: [R] Help with gsub function

2019-03-15 Thread Ivan Krylov
On Fri, 15 Mar 2019 19:45:27 + Bill Poling wrote: Hello Bill, > tb2a$TID2 <- gsub(tb2a$TID, pattern="-[0-0]{0,7}", replacement = "") Is the pattern supposed to mean something besides the "-" you want to remove? For the problem you describe, pattern="-" should be enough. It should locate

Re: [R] problem with nls....

2019-03-21 Thread Ivan Krylov
One of the assumptions made by least squares method is that the residuals are independent and normally distributed with same parameters (or, in case of weighted regression, the standard deviation of the residual is known for every point). If this is the case, the parameters that minimize the sum

Re: [R] Difficulty with "\\" in string functions....

2019-02-11 Thread Ivan Krylov
On Mon, 11 Feb 2019 15:01:16 -0500 (EST) Bernard McGarvey wrote: > Now I try to split it using > > > str_split(Fname1,"\\") > > > but this returns an error > > > Error in stri_split_regex(string, pattern, n = n, simplify = > simplify, : Unrecognized backslash escape sequence in pattern. >

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-24 Thread Ivan Krylov
Dear Jan & Duncan, Thanks for your replies! On Wed, 23 Jan 2019 09:56:25 -0500 Duncan Murdoch wrote: > Defaults of variables are evaluated in the evaluation frame of the > call. So the inside() function is created in the evaluation frame, > and it's environment will be that frame. > When it

Re: [R] load.wave

2019-02-02 Thread Ivan Krylov
Hello Nick Wray, Let me offer a simplified explanation of what's going on. Sorry if it's unnecessary. Sound is waves of pressure in the air. Devices like microphones can measure the changing pressure by converting it into voltage. Voltage can then be sampled by an analog-to-digital converter

Re: [R] list with list function

2019-02-04 Thread Ivan Krylov
On Mon, 4 Feb 2019 21:01:06 + (UTC) Andras Farkas via R-help wrote: > listA<-list(a,b,c) > listB<-list(d,e,f) > > what I would like to do with a function <...> as opposed to manually > is to derive the following answer > > listfinal<-list(a[-d],b[-e],c[-f]) The `Map` function, unlike

Re: [R] Greek characters in R studio

2019-04-09 Thread Ivan Krylov
On Mon, 8 Apr 2019 18:41:16 +0300 kostas zogopoulos wrote: > How do you read a csv file that contains greek characters as part of > the header (i.e. α, β etc) in R studio? Determine the character encoding used in the file (is it UTF-8, ISO8859-7 or something else?) and pass it as

Re: [R] picewise function in nls....

2019-04-18 Thread Ivan Krylov
On Thu, 18 Apr 2019 10:36:10 + akshay kulkarni wrote: > fx <- (x1 <= -2)*(x1^2) + (x1 > -2 && x1 < 2)*(x1^3) + (x1 > = > 2)*(x1^4) > > Can I include fx in an nls call to create something like this: > > NLS1 <- nls(y ~ a*(sin(x2) + fx), start = list(a = 2)) ? For now, you can, since

Re: [R] Extract data of special character

2019-03-15 Thread Ivan Krylov
В Fri, 15 Mar 2019 08:06:52 +0800 roslinazairimah zakaria пишет: > I want to draw boxplot for each individual score of the > attributes. You mean, a box per every possible ATTRIBUTE value? This is easily doable with the bwplot() function from library(lattice). -- Best regards, Ivan

Re: [R] how to separate string from numbers in a large txt file

2019-05-17 Thread Ivan Krylov
On Fri, 17 May 2019 11:36:22 -0700 Michael Boulineau wrote: > So, who knows what happened with the  at the beginning of [1] > directly above. perl -Mutf8 -MEncode=encode,decode -Mcharnames=:full \ -E'say charnames::viacode ord decode utf8 => encode latin1 => ""' # ZERO WIDTH NO-BREAK

Re: [R] Open a file which name contains a tilde

2019-06-06 Thread Ivan Krylov
On Wed, 5 Jun 2019 18:07:15 +0200 Frank Schwidom wrote: > +> path.expand("a ~ b") > [1] "a /home/user b" > How can I switch off any file crippling activity? It doesn't seem to be possible if readline is enabled and works correctly. Calls to path.expand [1] end up [2] in R_ExpandFileName

Re: [R] Parallel processes collapse into one

2019-06-06 Thread Ivan Krylov
On Mon, 3 Jun 2019 06:37:46 +0200 Nicola Lunardon wrote: > R seems to be running, but simulations do not progress further. Have you tried message() (or REprintf() in C code) to narrow down the specific part of the code where simulations stop in their progress? It's less convenient than a good

Re: [R] Increasing number of observations worsen the regression model

2019-05-27 Thread Ivan Krylov
On Sat, 25 May 2019 14:38:07 +0200 Raffa wrote: > I have tried to ask for example in CrossValidated > > > but the code works for them. Any help? In the comments you note that the

Re: [R] reg expr that retains only bracketed text from strings

2019-06-12 Thread Ivan Krylov
On Wed, 12 Jun 2019 15:45:04 +1000 nevil amos wrote: > # my desired desired output: > #[1] "" "(B)" "(C)" (function(s) regmatches( s, gregexpr('\\([^)]+\\)', s) ))(c("ABC","A(B)C","AB(C)")) # [[1]] # character(0) # # [[2]] # [1] "(B)" # # [[3]] # [1] "(C)" This matches

Re: [R] cygwin clipboard

2019-05-21 Thread Ivan Krylov
On Tue, 21 May 2019 09:55:21 -0500 Ed Siefker wrote: > I'd like to be able to access the windows clipboard from R under > Cygwin. Searching for "cygwin windows clipboard" offers reading from and writing to /dev/clipboard as a file and getclip.exe / putclip.exe from cygutils-extra package[*]

Re: [R] Pause script at input from terminal (interactive use)

2019-04-19 Thread Ivan Krylov
On Thu, 18 Apr 2019 16:10:41 +0200 Luigi Marongiu wrote: > It is possible to launch R scritps in the interactive mode in the > first place? and if yes, how? One option would be to use littler with its -i (--interactive) option. -- Best regards,

Re: [R] picewise function in nls....

2019-04-19 Thread Ivan Krylov
On Fri, 19 Apr 2019 10:12:06 + akshay kulkarni wrote: > But what do you mean by "since fx does not depend on any of the > parameters you optimize in the nls() call."? Can you give an example? By "parameters you optimize in the nls() call" I mean `a`. `a` does not seem to be used in the

Re: [R] read.xls without row number, column numbers, or factors

2019-07-02 Thread Ivan Krylov
On Mon, 01 Jul 2019 20:13:34 -0400 ast...@mathnmaps.com wrote: > Is there a way to use read.xls to copy a portion of a single row of > an XLS spreadsheet to a list, without getting assigning row and > column numbers, and, if the data consists of strings, without > assigning levels? If you mean

Re: [R] Error in installing pbmcapply / WhatIf

2019-06-27 Thread Ivan Krylov
On Thu, 27 Jun 2019 12:48:50 +0530 Ashim Kapoor wrote: > R version 3.3.3 (2017-03-06) > process.c:10:23: error: unknown type name ‘DllInfo’ DllInfo is defined in R_ext/Rdynload.h [1]. process.c only includes Rinternals.h [2], which has been including R_ext/Rdynload.h since September 2016 [3].

Re: [R] pkg reticulate + python3 + MSYS2 (windows)

2019-09-15 Thread Ivan Krylov
On Sat, 14 Sep 2019 15:18:54 -0300 Cleber Borges wrote: > python37.dll - Não foi possível encontrar o módulo especificado. This might mean that python37.dll depends on another DLL which could not be found. You might have to add C:/msys64/mingw64/bin/ and/or another directory to the PATH

Re: [R] regex

2019-09-17 Thread Ivan Krylov
On Tue, 17 Sep 2019 10:14:24 +0300 Ivan Krylov wrote: > '\\[.*\\]' Sorry, I forgot to take it into account that you don't want the [] in your units, either. That's still doable, but requires so-called look-around assertions in the regular expression: '(?<=\\[).*(?=\\])' This should mat

Re: [R] regex

2019-09-17 Thread Ivan Krylov
On Tue, 17 Sep 2019 08:48:43 +0200 Ivan Calandra wrote: > CSVs <- list.files(path=..., pattern="\\.csv$") > w.files <- CSVs[grep(pattern="_w_", CSVs)] > > Of course, what I would like to do is list only the interesting files > from the beginning, rather than subsetting the whole list of

Re: [R] R wrong, Python rigth in calcution

2019-09-17 Thread Ivan Krylov
On Wed, 18 Sep 2019 00:02:47 +0200 Martin Møller Skarbiniks Pedersen wrote: > I know I can use gmp and R will do it correctly. Which is equivalent to what Python does: it uses so-called long arithmetic, allowing scalar variables with as many digits as it fits in the computer memory. R by

Re: [R] bizarre color space conversion problem

2019-07-18 Thread Ivan Krylov
This is, indeed, bizzare! On Thu, 18 Jul 2019 10:35:57 -0400 Sarah Goslee wrote: > I've gotten as far as locating the problem in this line from > grDevices::convertColor() > > xyz <- from$toXYZ(color, from.ref.white) So if you manually feed the arguments: Lab <-

Re: [R] bizarre color space conversion problem

2019-07-18 Thread Ivan Krylov
On Thu, 18 Jul 2019 11:50:17 -0400 Sarah Goslee wrote: > The problem is in the conversion from RGB to Lab. Hmm. Assuming defaults and skipping all checks, convertColor(red.rgb, from = "sRGB", to = "Lab") amounts to the following: red.rgb <- t(col2rgb(rep('red',8), alpha = 0)/255) # let's hope

Re: [R] bizarre color space conversion problem

2019-07-18 Thread Ivan Krylov
On Thu, 18 Jul 2019 13:30:09 -0400 Sarah Goslee wrote: > I'm not even remotely a hardware expert: if the difference is due to > changes in the instruction set, I assume that has potential > consequences for other things, and I just happened to spot it in this > particular case because it's

Re: [R] "rgb()" problem

2019-07-26 Thread Ivan Krylov
On Fri, 26 Jul 2019 08:27:07 + "Röver, Christian" wrote: > The apparently buggy version in this case seems to return white > instead of red. I think it's red, but fully transparent. Alpha follows the same rules as red, green and blue components; it is expected to be in range [0;

Re: [R] [SPAM] Re: The "--slave" option

2019-09-19 Thread Ivan Krylov
On Thu, 19 Sep 2019 11:51:13 +0200 Benjamin Lang wrote: > A new user, wanting to reduce output from R, would probably reach for > “-q” or “—quiet”. Not to argue against your point, but note that (1) --quiet is already a flag which means something else and (2) --slave is not only a command line

Re: [R] Problem related to multibyte string in CSV file

2019-11-14 Thread Ivan Krylov
On Thu, 14 Nov 2019 09:34:30 -0800 Dennis Fisher wrote: > Warning message: > In readLines(FILE, n = 1) : line 1 appears to contain an > embedded nul <...> > print(STRING) > [1] "\xff\xfet” Most probably, this means that the FILE is UCS-2LE-encoded (or maybe UTF-16).

Re: [R] Problem comparing two strings

2019-11-18 Thread Ivan Krylov
On Mon, 18 Nov 2019 16:11:44 +0100 "Björn Fisseler" wrote: > It's obviously the umlaut "ä" in this example which is encoded with > two respectively three bytes. The question is how to change this? Welcome to the wonderful world of Unicode-related problems! It is, indeed, possible to represent

Re: [R] Errors in R package installation

2019-12-13 Thread Ivan Krylov
On Thu, 12 Dec 2019 15:48:13 + David Stevens wrote: > Certain R packages will not install properly on my Windows 10 > computer. Certain, but not all? Which packages are you able to install on that computer? > Warning: invalid package 'C:\Users\David' > Warning: invalid package >

Re: [R] Errors in R package installation

2019-12-13 Thread Ivan Krylov
On Fri, 13 Dec 2019 13:19:54 + David Stevens wrote: > There are binary versions available but the source versions are > later: Okay, that would be the reason why would R on Windows try to install a source package instead of a binary package. One can also see that callr has just been

Re: [R] Errors in R package installation

2019-12-13 Thread Ivan Krylov
On Fri, 13 Dec 2019 14:21:06 + David Stevens wrote: > ** byte-compile and prepare package for lazy loading > Fatal error: cannot open file 'C:\Users\David': No such file or > directory > > ERROR: lazy loading failed for package 'rmarkdown' Oh. Sorry, that seems to be yet another place

Re: [R] install package av on centos 7

2019-12-13 Thread Ivan Krylov
On Mon, 9 Dec 2019 18:03:17 + "Schneider, Dominik" wrote: > (base) [dominik@cppc-server ffmpeg]$ ffmpeg > ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers According to SystemRequirements of av [*], it needs ffmpeg >= 3.2. There is FFmpeg 3.4.7 for RHEL 7 in the RPM Fusion

Re: [R] How to create a new data.frame based on calculation of subsets of an existing data.frame

2019-12-17 Thread Ivan Krylov
Hello Ioanna! Please don't post the same question 4 times in a row. One is just enough; you can see it posted successfully in the R-help archives: https://stat.ethz.ch/pipermail/r-help/2019-December/465108.html On Tue, 17 Dec 2019 19:38:02 + Ioanna Ioannou wrote: > VC <- 0.01*( subset(D,

Re: [R] Help to write the R-code, please

2019-12-05 Thread Ivan Krylov
It might be easier to implement in R if you employ the base functions that take arrays and operate on them as if they represented sets. See the help() for "union", "intersect", "setdiff", "setequal" and the operator "%in%". -- Best regards, Ivan __

Re: [R] readxl question

2019-12-05 Thread Ivan Krylov
On Thu, 5 Dec 2019 15:39:56 + Thomas Subia wrote: > date <- lapply(files, read_excel, sheet="Sheet1", range=("B5")) > date_df <- as.data.frame(date) > trans_date <-t(date_df) > mydates <- list(trans_date) This feels a bit excessive for what looks like a one-dimensional string vector. Why is

Re: [R] Help with Identify the number (Count) of values that are less than 5 char and replace with 99999

2019-12-16 Thread Ivan Krylov
On Mon, 16 Dec 2019 13:24:36 + Bill Poling wrote: > Using the nchar function (I converted the Factor to a character > column first) I get the first 1K values. <...> > 1. Identify the number (Count) of values that are less than 5 char > (i.e. 2 char = 150, 3 char = 925, 4 char = 1002) Use

Re: [R] [EXTERNAL] Re: "chi-square" | "chi-squared" | "chi squared" | "chi square" ?

2019-10-21 Thread Ivan Krylov
On Fri, 18 Oct 2019 15:25:59 -0700 "Dalthorp, Daniel via R-help" wrote: > I'd like to see the statistics on it before jumping to a conclusion > that the American preference is "chi-square" and the British > preference is "chi-squared". One way to get some data on this would be to count Scopus

Re: [R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Ivan Krylov
On Tue, 29 Oct 2019 13:55:27 +0100 Witold E Wolski wrote: > Since R knows how to parse expressions these type of expressions I > would like to reuse some existing functions and not to use gsub or > strsplit etc. You might be interested in the `parse` function: x <- "(a+b) * c/(d * (e - f))"

Re: [R] save() unable to find object

2019-10-31 Thread Ivan Krylov
On Thu, 31 Oct 2019 14:39:48 +0530 Christofer Bogaso wrote: > Error in save("Date", paste("AAA", format(Date, "%d"), sep = ""), file > = "Save.RData") : > object ‘paste("AAA", format(Date, "%d"), sep = "")’ not found save() uses non-standard evaluation [*], which means that, instead of just

Re: [R] Why does `[<-.matrix` not exist in base R

2019-11-24 Thread Ivan Krylov
Hello David, On Sat, 23 Nov 2019 11:58:42 -0500 David Disabato wrote: > For example, if I want to add a new column to a data.frame, I can do > something like `myDataFrame[, "newColumn"] <- NA`. Arguably, iterative growth of data structures is not the "R style", since it may lead to costly

Re: [R] Requesting Assistance with a Backend Question

2019-09-25 Thread Ivan Krylov
On Tue, 24 Sep 2019 22:35:39 + "Caughman, Vanessa (OATH)" wrote: > Does this application require any access, on the backend, when > processing or performing analytics; to any parts of the Cloud > environment. The answer is: no, but see the fine print. Core R code (i.e. the one you can get

Re: [R] Creating a histogram from a frequency vector

2019-10-09 Thread Ivan Krylov
On Wed, 9 Oct 2019 16:12:57 +0100 (BST) Nick Wray via R-help wrote: > I have a vector like say 73,53,42,67,41,50 where these numbers are > the number of occurrences of the data values 1,2,3,4,5,6 > I can't see an elegant way <...> of creating a histogram from this > data set. Is there one? A

Re: [R] issue with numeric

2019-12-18 Thread Ivan Krylov
On Wed, 18 Dec 2019 12:25:24 -0600 Ana Marija wrote: > Error in cor(D[, 18 + exon_offset], D[, 19 + exon_offset]) : > 'x' must be numeric Try str(a) to find out the types of the columns. A stray typo could make a representation of a number impossible to parse and make the whole column

Re: [R] Something is wrong; all the MAE metric values are missing

2019-12-25 Thread Ivan Krylov
Try printing the value of `param` in your `obj` function before calling train() or getTrainPerf(). Optimizers are prone to giving unexpected values [*] in trying to lower the loss function. It might be the case of an unconstrained optimizer leaving the realm of the feasible because no-one told it

Re: [R] make check fails -- how to debug

2020-02-12 Thread Ivan Krylov
On Tue, 11 Feb 2020 21:26:33 + "Barris, Wes" wrote: > running code in '../../tests/reg-packages.R' ...make[3]: *** > [reg-packages.Rout] Error 1 tests/Makefile.common has the following in the .R.Rout rule: @$(ECHO) $(ECHO_N) "running code in '$<' ...$(ECHO_C)" > $@.log

Re: [R] make check fails -- how to debug

2020-02-12 Thread Ivan Krylov
On Wed, 12 Feb 2020 14:20:55 + "Barris, Wes" wrote: > I'm not sure exactly what part of this is the fatal error: One of the tests is building the package contained in tests/Pkgs/exSexpr. For some reason, R CMD build failed to produce a tarball for this package. Try running it yourself and

Re: [R] How to parallelize a process called by a socket connection

2020-02-02 Thread Ivan Krylov
On Sat, 1 Feb 2020 11:24:51 -0800 James Spottiswoode wrote: > while(TRUE){ > con <- socketConnection(host="localhost", port = > server_port, blocking=TRUE, server=TRUE, open="r+", timeout = > 1) > data <- readLines(con, 1L, skipNul = T, ok = T) > response <-

Re: [R] How to create a vector by searching information in multiple data.tables in r?

2020-01-31 Thread Ivan Krylov
On Fri, 31 Jan 2020 18:06:00 + Ioanna Ioannou wrote: > I want to extract e.g., the country from all these files. How can i > add NA for the files for which the country is not mentioned? I am starting from the beginning, since I don't know what you have tried and where exactly you are stuck.

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-05 Thread Ivan Krylov
On Wed, 5 Feb 2020 09:15:16 -0600 Ana Marija wrote: > I tried to solve the task via following code: > all_results <- lapply(manyorders, function(ord) { # ... > list(fit = fit, y1 = y1) > }) > and I wrote all_results in a file > write.table(all_results, file="all_res", sep = " ", row.names =

Re: [R] how to read a database in R?

2020-02-01 Thread Ivan Krylov
On Fri, 31 Jan 2020 17:02:16 -0600 Ana Marija wrote: > I have a database DGN-WB_0.5.db is there is a way to explore its > content in R? My psychic debugging powers tell me that it's an SQLite database, so the answer to your question is: yes, it should be possible to both find out the schema

Re: [R] RegExpr: Help match quote inside a set

2020-02-21 Thread Ivan Krylov
On Fri, 21 Feb 2020 13:17:59 +0100 Martin Møller Skarbiniks Pedersen wrote: > "[.,;\"-']" Note that there is an - between " and ', which transforms your regular expression into a range (all characters between " and ') instead of a set. Move the - right in front of the closing bracket ] to make

Re: [R] Survey package/svyby source code help

2020-02-11 Thread Ivan Krylov
On Tue, 11 Feb 2020 02:33:45 + AndertechLLC--- via R-help wrote: > When debugging the code I am not following the generation of values > in the results object attr(*, "var")" after line 57 completes. These > values are fed into line 74 (rval <- t(sapply(results, unwrap))). Which version of

Re: [R] Survey package/svyby source code help

2020-02-11 Thread Ivan Krylov
On Tue, 11 Feb 2020 15:23:14 + andertech...@protonmail.com wrote: > The attr(, "var") that I am interested in is displayed with > str(results) after the results object is declared. First line of the > subject code looks like: > > results <- (if (multicore) parallel::mcapply else

Re: [R] make check fails -- how to debug

2020-02-12 Thread Ivan Krylov
On Wed, 12 Feb 2020 19:32:34 + "Barris, Wes" wrote: > I'm only trying to install the latest version on our servers for our > users. Are you allowed to use EPEL? This seems to be the officialy supported way of installing latest R on CentOS [1]. It might be a good idea to ask in R-SIG-Fedora

Re: [R] Data Carpentry - Creating a New SQLite Database

2020-01-10 Thread Ivan Krylov
On Fri, 10 Jan 2020 11:31:58 -0700 "Phillip Heinrich" wrote: > below is the text from the tutorial. The black type is from the > tutorial. The green and blue is the suggested R code. My comments > are in red R-help is a plain text mailing list, so the markup has been stripped off (and since

Re: [R] how to save Rdata into .csv file

2020-01-22 Thread Ivan Krylov
On Wed, 22 Jan 2020 11:19:25 -0600 Ana Marija wrote: > I have my normalized data matrix in > file:normalizedDataMatrix_filtered.RData > > how do I have that in .csv format? Have you tried using the function load() to load the saved data, then write.csv() or write.csv2() to create the CSV file?

Re: [R] Split

2019-12-23 Thread Ivan Krylov
On Mon, 23 Dec 2019 17:56:35 +0300 Medic wrote: > I would like to split > mydata$var > by > mydata$group #to get var1 and var2 There is the split() function that does exactly that (except it returns a list instead of multiple variables)... > And then get > summary (var1, var2) #this is my

Re: [R] R CMD Batch on Windows and use of the ampersand

2019-12-25 Thread Ivan Krylov
On Wed, 25 Dec 2019 09:13:28 -0800 Erin Hodgess wrote: > We know that > > R CMD BATCH infile outfile & > > On Linux or Mac will let you continue interactively from the command > line. This is a property of the command line shell being used, not of R CMD BATCH itself. One way to do the same on

Re: [R] spurious locking of packages

2020-01-08 Thread Ivan Krylov
On Fri, 27 Dec 2019 15:27:01 -0500 "Jan Galkowski" wrote: > *emoa* is a stand-in for whatever package faulted during the load. (I > also have no idea why *EMD* is locked in the above.) Both packages mentioned have NeedsCompilation: yes. Could it be the case that some anti-virus software is

Re: [R] 2 docker containers with R ?

2020-04-11 Thread Ivan Krylov
On Sat, 11 Apr 2020 03:44:51 -0700 Bogdan Tanasa wrote: > how could I have Seurat2 and Seurat3 on the same machine What I would try first is to install Seurat2 and Seurat3 in separate library directories: add the `lib` argument to install.packages when installing a given version and `lib.loc`

Re: [R] Span for loess regression

2020-04-15 Thread Ivan Krylov
On Tue, 14 Apr 2020 21:00:34 + (UTC) varin sacha via R-help wrote: > Here below a reproducible example. I don't get the result. Thanks for providing a concise piece of code. The code doesn't return any visible results because the bestLoess function created by it is never called. To get the

Re: [R] Web-scraping newbie - dynamic table into R?

2020-04-21 Thread Ivan Krylov
On Sun, 19 Apr 2020 at 22:34, Julio Farach wrote: > But, I'm seeking the last 10 draws shown on the "Winning Numbers," or > 4th tab. The "Network" tab in browser developer tools (usually accessible by pressing F12) demonstrates that the "Winning Numbers" are fetched in JSON format by means of

Re: [R] Help needed: gdal-configuration to install sf package in Mac OS Catalina

2020-04-06 Thread Ivan Krylov
On Sun, 5 Apr 2020 23:27:08 -0500 Bijesh Mishra wrote: > configure: error: gdal-config not found or not executable. This would mean that gdal [1], which is a dependency of the sf package, is not installed (or not available on $PATH, or...). If you use Homebrew [2], try running 'brew install

Re: [R] Question about nlminb function

2020-04-03 Thread Ivan Krylov
On Thu, 2 Apr 2020 10:26:07 + "Lim, Hwanggyu" wrote: > when n-1th estimates and nth estimates have absolute differences > less than 0.001 for all three parameters, the iteration must stop > I am using nlminb optimization function nlminb function uses the PORT library. According to [1], the

Re: [R] ncol() vs. length() on data.frames

2020-03-31 Thread Ivan Krylov
On Tue, 31 Mar 2020 14:47:54 +0200 Ivan Calandra wrote: > On a simple data.frame (i.e. each element is a vector), ncol() and > length() will give the same result. > Are they just equivalent on such objects, or are they differences in > some cases? I am not aware of any exceptions to

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Krylov
On Thu, 2 Apr 2020 10:30:29 +0200 Ivan Calandra wrote: > The problem I then have is to specify the path for 'raw_data' and > 'derived_data' <...> And these folders are not subfolders of > the working directory '~/analysis/scripts'. > I would like to avoid absolute paths of course Is there a

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Krylov
On Thu, 2 Apr 2020 11:02:56 +0200 Ivan Calandra wrote: > I do not know this ".." command (could you please show me how to use > it in a relative path?), but it sounds like a good start. Each '..' in the path moves you up one level in the directory tree. Here I use '..' once to access the

Re: [R] Fit Gaussian curve on my data ?

2020-04-25 Thread Ivan Krylov
On Sat, 25 Apr 2020 19:02:59 + (UTC) varin sacha via R-help wrote: > plot(function(d) > k*exp(-0.5*(d-m)^2/sd^2),col=2,add=TRUE,xlim=range(d)) Remove the `add=TRUE` or calculate the values manually and you'll see that the function value is zero because the values in `d` are too big compared

Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Ivan Krylov
On Wed, 29 Apr 2020 14:19:18 -0500 Ana Marija wrote: > My conditions for creating a new column PHENO would be this: > > if FLASER or PLASER =2 then PHENO=2 > otherwise PHENO=1 On Wed, 29 Apr 2020 15:30:45 -0400 "Patrick (Malone Quantitative)" wrote: > If you don't mind using tidyverse, you

Re: [R] PCRE configure problem with R-4.0.0

2020-05-04 Thread Ivan Krylov
First of all, you mentioned Linux Mint, so you might get better advice on R-SIG-Debian mailing list. On Mon, 4 May 2020 16:15:42 +1200 Patrick Connolly wrote: >There are quite a lot of packages in the repository for Linux Mint >17.2 with 'pcre' in the name and these are installed: >Apparantly

  1   2   3   4   5   >