similar to: Looking for a function or a set of steps

Displaying 20 results from an estimated 20000 matches similar to: "Looking for a function or a set of steps"

2025 May 28
1
Looking for a function or a set of steps
Paul, Perhaps slightly better and more concise is y <- -x + 1 Why multiply? Of course it may be optimized in some cases. On Tue, May 27, 2025, 3:36?AM Paul Zachos <paz at acase.org> wrote: > Wow! Amazing stuff. > It will take me a while to digest all that you have offered here. > > I came up with a simple solution myself: > y<- (-1*x)+1 > > Thank you >
2025 May 19
3
Looking for a function or a set of steps
?s 18:40 de 18/05/2025, paul zachos via R-help escreveu: > Dear R Community > > I am an R beginner > > I have a vector of ?1?s and ?0?s > > x > [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 > [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 > [55] 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0 > [82] 1 1 1 0 1 0 0 1 0 0 1 1 1 1 1
2025 May 29
1
Looking for a function or a set of steps
What's wrong with 1-x ? Sent from my iPad > On 28 May 2025, at 21:41, Avi Gross <avi.e.gross at gmail.com> wrote: > > ?Paul, > > Perhaps slightly better and more concise is > > y <- -x + 1 > > Why multiply? Of course it may be optimized in some cases. > >> On Tue, May 27, 2025, 3:36?AM Paul Zachos <paz at acase.org> wrote: >>
2025 May 19
1
Looking for a function or a set of steps
Hello, You are right, I didn't think about that one. Here is another, esoteric, way. With `+` substituting for as.integer: +!x Hope this helps, Rui Barradas ?s 09:10 de 19/05/2025, Goodale, Tom escreveu: > Surely doing > > y <- 1 - x > > would be the simplest way? > > Best, > Tom > >> -----Original Message----- >> From: R-help
2025 May 19
1
Looking for a function or a set of steps
Hello, And a test for equality of all solutions so far. do.call( identical, list( 1L - x, +!x, as.integer(!x), as.integer(xor(x, 1L)) ) ) #> [1] TRUE Hope this helps, Rui Barradas ?s 16:34 de 19/05/2025, Rui Barradas escreveu: > Hello, > > You are right, I didn't think about that one. > Here is another, esoteric, way. > With `+`
2025 May 19
1
Looking for a function or a set of steps
1-x > On 18.05.2025, at 19:40, paul zachos via R-help <r-help at r-project.org> wrote: > > Dear R Community > > I am an R beginner > > I have a vector of ?1?s and ?0?s > > x > [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 > [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 > [55] 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 0
2025 May 19
1
Looking for a function or a set of steps
On Sun, 18 May 2025 13:40:31 -0400 paul zachos via R-help <r-help at r-project.org> wrote: > Dear R Community > > I am an R beginner > > I have a vector of ?1?s and ?0?s > > x > [1] 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 > [28] 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 1 > [55] 0 0 1 0 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 0
2025 May 19
1
Looking for a function or a set of steps
Rolf, If it is homework, I have to wonder at what level the class is before any of the proposed answers would be considered acceptable by the instructor. For a true beginner who has not even learned that much of R is vectorized, we are back to perhaps using a manual loop with indices and ... I will say that these days, I see too many assignments handed in by novices, such as 12-year-old kids
2025 Mar 28
1
Problem with minimization that I failed to understand
?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:34, Duncan Murdoch <murdoch.duncan at gmail.com>
2025 Feb 05
4
Looking for simple line-splitting code
If I have this object: x <- c("abc\ndef", "", "ghi") and I write it to a file using `writeLines(x, "test.txt")`, my text editor sees a 5 line file: 1: abc 2: def 3: 4: ghi 5: which is what I'd expect: the last line in the editor is empty. If I use `readLines("test.txt")` on that file, I get the vector
2024 Oct 18
1
DPLYR Multiple Mutate Statements On Same DataFrame
?s 22:50 de 17/10/2024, Sparks, John escreveu: > Hi R Helpers, > > I have been looking for an example of how to execute different dplyr mutate statements on the same dataframe in a single step. I show how to do what I want to do by going from df0 to df1 to df2 to df3 by applying a mutate statement to each dataframe in sequence, but I would like to know if there is a way to execute this
2025 Mar 28
3
Problem with minimization that I failed to understand
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 <murdoch.duncan at gmail.com> wrote: > I haven't run your code, but since Kendall correlation is based on >
2025 Mar 27
1
Problem with minimization that I failed to understand
?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(StartingValue) > ## FALSE > > Below is the corrected code that can
2025 Feb 05
1
Looking for simple line-splitting code
A 3rd option could be scan(text=x, what="", blank.lines.skip=FALSE) (all because readLines() doesn't obey the text=x convention, perhaps it should? I'm unsure whether the textConnection is left open in Rui's method.) -pd > On 5 Feb 2025, at 15:35 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > Thanks to Rui, Peter and Tanvir! Peter's seems
2024 Oct 17
2
DPLYR Multiple Mutate Statements On Same DataFrame
Hi R Helpers, I have been looking for an example of how to execute different dplyr mutate statements on the same dataframe in a single step. I show how to do what I want to do by going from df0 to df1 to df2 to df3 by applying a mutate statement to each dataframe in sequence, but I would like to know if there is a way to execute this in a single step; so simply go from df0 to df1 while executing
2025 Mar 27
1
Problem with minimization that I failed to understand
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 can be reproduced: MyDat = structure(list(c(50L, 0L, 0L, 50L, 75L, 100L, 50L, 0L, 50L, 0L, 25L,
2017 Oct 11
3
dput(treat)
I got advice here that I didn't understand! Can I ask to explain me the meaning of this procedure: first get the structure, and then assign it back. For what? Thanks!? (Great thanks to Moderator/Admin!) You should learn to post in plain text and use dput to present your data structures. At your console do this dput(treat) # and this will appear. Copy it to your plain-text message:
2025 Apr 07
4
An opinion question, please
Hello everyone! I have an opinion question please. If I?m writing a new package, would you recommend using S3 or S4 structure, please? I know I will get lots of opinions, but that?s fine. Thanks, Erin Erin Hodgess, PhD mailto: erinm.hodgess at gmail.com [[alternative HTML version deleted]]
2012 Mar 09
6
unir 2 dataframe con con igual caso pero distinto valor en igual variable
Estimados usarios de R: Tengo una base de datos madre en formato .sav de SPSS y la quiero modificar usando datos de otras base de datos .sav y otra en .csv a las que llamare hijos. No tengo problema en convertirlas en data.frame. Todos los archivos tienen en comĂșn una variable que es Ășnica. En aquellos casos que les falta un valor a una variable en el archivo madre lo relleno con el valor del
2016 Dec 30
1
FreeBSD / dovecot 2.2.27 / libwrap
It works ! It was THAT easy ! Can you suggest how to replace the hair I pulled out ? :-) On 2016-12-29 5:27 PM, Larry Rosenman wrote: > login_access_sockets = tcpwrap > > service tcpwrap { > unix_listener login/tcpwrap { > group = $default_login_user > mode = 0600 > user = $default_login_user > } > } > > > > On Thu, Dec 29, 2016 at