Re: [R] function import file csv Openair

2024-04-30 Thread Avi Gross
Unless the functionality to read in a CSV file had special functionality, it probably is simple enough to read it in using other available functions like read.csv() or others available. Many packages have functions they later remove as not really needed or if others are available. On Tue, Apr

Re: [R] function import file csv Openair

2024-04-30 Thread Ivan Krylov via R-help
Dear Evelina Ballato, В Tue, 30 Apr 2024 10:36:32 + Evelina Ballato пишет: > In the Openair package it is possible to restore the import csv file > function? This question is best addressed to the maintainer of the package (see the output of maintainer("openair")) if not to their GitHub

[R] function import file csv Openair

2024-04-30 Thread Evelina Ballato
In the Openair package it is possible to restore the import csv file function? it has been removed in the latest versions. Infinitely grateful Evelina Ballato Evelina Ballato Arpa Piemonte Dipartimento Territoriale Piemonte Nord Est - sede di Omegna

[R] Function environments serialize to a lot of data until they don't

2024-03-08 Thread Ivan Krylov via R-help
Hello R-help, I've noticed that my 'parallel' jobs take too much memory to store and transfer to the cluster workers. I've managed to trace it to the following: # `payload` is being written to the cluster worker. # The function FUN had been created as a closure inside my package:

Re: [R] Function with large nested list

2023-12-18 Thread avi.e.gross
parentheses of brace or bracket or sometimes quotes or using the wrong kind of quote as in copying from a program like Microsoft Word. -Original Message- From: R-help On Behalf Of Emily Bakker Sent: Monday, December 18, 2023 4:56 AM To: r-help@r-project.org Subject: [R] Function

Re: [R] Function with large nested list

2023-12-18 Thread Michael Dewey
Dear Emily Comment in-line On 18/12/2023 09:56, Emily Bakker wrote: Hello list, I want to make a large rulebased algorithm, to provide decision support for drug prescriptions. I have defined the algorithm in a function, with a for loop and many if statements. The structure should be as

Re: [R] Function with large nested list

2023-12-18 Thread Ivan Krylov
В Mon, 18 Dec 2023 09:56:16 + Emily Bakker пишет: > When i try to run the function definiton, the command never > "completes" in de console. How do you run the function definition? I copied and pasted your example into a character variable and gave it to parse(text = ...). It parsed

[R] Function with large nested list

2023-12-18 Thread Emily Bakker
Hello list, I want to make a large rulebased algorithm, to provide decision support for drug prescriptions. I have defined the algorithm in a function, with a for loop and many if statements. The structure should be as follows: 1. Iterate over a list of drug names. For each drug: 2. Get some

Re: [R] Could you manually replicate execution of a R function

2023-09-22 Thread Brian Smith
Hi Ivan, Thanks for pointing this out. It now matches. Thanks and regards, On Thu, 21 Sept 2023 at 13:04, Ivan Krylov wrote: > > On Tue, 19 Sep 2023 23:09:18 +0530 > Brian Smith wrote: > > > C = rep(0, length(D)) > > N = length(D) > > In the VaRDurTest function, there's additional code

Re: [R] Could you manually replicate execution of a R function

2023-09-21 Thread Ivan Krylov
On Tue, 19 Sep 2023 23:09:18 +0530 Brian Smith wrote: > C = rep(0, length(D)) > N = length(D) In the VaRDurTest function, there's additional code between these two expressions that deals with censoring if head(VaR.ind, 1) == 0 or tail(VaR.ind, 1) == 0. Both of these are true for your input

Re: [R] Could you manually replicate execution of a R function

2023-09-20 Thread Jorgen Harmse via R-help
leading �{�, and parse(text=�.) to break the function into expressions. That might be easier than copy-pasting function code. Regards, Jorgen Harmse. Message: 1 Date: Tue, 19 Sep 2023 23:09:18 +0530 From: Brian Smith To: r-help@r-project.org Subject: [R] Could you manually replicate execution of a R f

[R] Unable to manually replicate execution of a R function

2023-09-20 Thread Brian Smith
Hi, ** In may earlier post there were some typo, so reposting the same after correction** I am trying to replicate a function from rugarch package manually. Below is the calculation based on the function, library(rugarch) data(dji30ret) spec = ugarchspec(mean.model = list(armaOrder = c(1,1),

[R] Could you manually replicate execution of a R function

2023-09-19 Thread Brian Smith
Hi, I have trying to replicate a function from rugarch package manually. Below is the calculation based on the function, library(rugarch) data(dji30ret) spec = ugarchspec(mean.model = list(armaOrder = c(1,1), include.mean = TRUE), variance.model = list(model = "gjrGARCH"), distribution.model =

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-22 Thread akshay kulkarni
Sent: Friday, January 20, 2023 11:29 PM To: r-help@r-project.org ; akshay kulkarni ; Jorgen Harmse ; r-help@r-project.org ; williamwdun...@gmail.com Subject: Re: [R] function doesn't exists but still runs. (akshay kulkarni) This is not a "problem" ... it is a "feature"

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread Jeff Newmiller
is the private environment, so you can use it to >see all the private objects and everything in the ancestor environments. You >can repeat the trick to see private environments of packages you didn't >directly pull in. I think you can even unlock bindings and do ghastly thi

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread akshay kulkarni
: R help Mailing list Subject: Re: [R] function doesn't exists but still runs. Message-ID: Content-Type: text/plain; charset="utf-8" Look into R's scoping rules. E.g., https://bookdown.org/rdpeng/rprogdatascience/scoping-rules-of-r.html. * When a function looks up a na

Re: [R] function doesn't exists but still runs.....

2023-01-20 Thread akshay kulkarni
From: Bill Dunlap Sent: Friday, January 20, 2023 5:32 AM To: akshay kulkarni Cc: R help Mailing list Subject: Re: [R] function doesn't exists but still runs. Look into R's scoping rules. E.g., https://bookdown.org/rdpeng/rprogdatascience/scoping-rules-of-r.html. * When a function looks up

Re: [R] function doesn't exists but still runs.....

2023-01-20 Thread akshay kulkarni
Dear Greg, THanks for a very well pointed answer. THanking you, yours sincerely AKSHAY M KULKARNI From: Greg Snow <538...@gmail.com> Sent: Friday, January 20, 2023 10:28 PM To: akshay kulkarni Cc: R help Mailing list Subject:

Re: [R] function doesn't exists but still runs.....

2023-01-20 Thread Greg Snow
A little simpler answer than the others. Look at package Namespaces. When a package is created, the NAMESPACE file defines which functions in the package are exported (i.e. available for you to use), the other functions are "private" to the package meaning that other functions in the package can

Re: [R] function doesn't exists but still runs..... (akshay kulkarni)

2023-01-20 Thread Jorgen Harmse via R-help
sage: 17 Date: Thu, 19 Jan 2023 16:02:31 -0800 From: Bill Dunlap To: akshay kulkarni Cc: R help Mailing list Subject: Re: [R] function doesn't exists but still runs. Message-ID: Content-Type: text/plain; charset="utf-8" Look into R's scoping rules. E.g., https://b

Re: [R] function doesn't exists but still runs.....

2023-01-19 Thread Bill Dunlap
Look into R's scoping rules. E.g., https://bookdown.org/rdpeng/rprogdatascience/scoping-rules-of-r.html. * When a function looks up a name, it looks it up in the environment in which the function was defined. * Functions in a package are generally defined in the package's environment (although

[R] function doesn't exists but still runs.....

2023-01-19 Thread akshay kulkarni
dear members, I am using the RSelenium package which uses the function selenium() from the wdman package. The selenium function contains the function java_check at line 12. If I try to run it, it throws an error: > javapath <- java_check() Error in java_check() :

Re: [R] Function for Distribution Fitting

2022-10-26 Thread Ebert,Timothy Aaron
-help Sent: Wednesday, October 26, 2022 10:01 AM To: r-help@r-project.org Subject: Re: [R] Function for Distribution Fitting [External Email] "all possible probability distributions" I doubt that is a finite set. To select "a bunch of them" would seem to imply a reduction of tha

Re: [R] Function for Distribution Fitting

2022-10-26 Thread Gabor Grothendieck
A Cullen & Frey graph (fitdistrplus::descdist) can be used to compare certain common distributions. On Wed, Oct 26, 2022 at 9:42 AM Paul Bernal wrote: > > Dear friends from the R community, > > Hope you are all doing great. So far, whenever I need to perform > distribution fitting on a

Re: [R] Function for Distribution Fitting

2022-10-26 Thread Bert Gunter
Of course it's an infinite set! The OP should look here: https://cran.r-project.org/web/views/Distributions.html -- Bert On Wed, Oct 26, 2022 at 7:01 AM JRG via R-help wrote: > > "all possible probability distributions" > > I doubt that is a finite set. To select "a bunch of them" would seem

Re: [R] Function for Distribution Fitting

2022-10-26 Thread JRG via R-help
"all possible probability distributions" I doubt that is a finite set. To select "a bunch of them" would seem to imply a reduction of that set based on what's possible/promising/pertinent in your specific problem. IMHO, what's the "most suitable distribution" tends to depend partly on knowledge

[R] Function for Distribution Fitting

2022-10-26 Thread Paul Bernal
Dear friends from the R community, Hope you are all doing great. So far, whenever I need to perform distribution fitting on a particular dataset, I make use of R package fitdistrplus. However, distribution fitting using the fitdist() function from fitdistrplus is rather manual (you need to

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread Martin Maechler
>>>>> Rui Barradas >>>>> on Tue, 25 Jan 2022 14:22:47 + writes: > Hello, > Here are 3 functions that do what the question asks for. The first 2 are > tidyverse solutions, the last one a base R function. > I don't understand wh

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread Rui Barradas
Hello, Here are 3 functions that do what the question asks for. The first 2 are tidyverse solutions, the last one a base R function. I don't understand why the group_by and mutate, that's why I've included a 2nd tidyverse function. And the base R function follows the same lines of outputing

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread PIKAL Petr
nal Message- > From: R-help On Behalf Of Kai Yang via R-help > Sent: Tuesday, January 25, 2022 1:14 AM > To: R-help Mailing List > Subject: [R] function problem: multi selection in one argument > > Hello Team, > I can run the function below: > > library(tidyve

[R] function problem: multi selection in one argument

2022-01-24 Thread Kai Yang via R-help
Hello Team, I can run the function below: library(tidyverse) f2 <- function(indata, subgrp1){   indata0 <- indata   temp    <- indata0 %>% select({{subgrp1}}) %>% arrange({{subgrp1}}) %>%      group_by({{subgrp1}}) %>%     mutate(numbering =row_number(), max=max(numbering))   view(temp)  

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Definitely doable and you are on the right path and maybe even close. The error message you got showed your query as having the wrong info after the 'FROM' keyword ' SELECT * FROM c("BIODBX.MECCUNIQUE2", "BIODBX.QDATA_HTML_DUMMY", "BIODBX.SET_ITEMS", "BIODBX.SET_NAMES", "dbo.sysdiagrams",

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hi Eric, Thank you spent time to help me for this. Here is the thing: I was requested to manage a sql server for my group. the server has many schemas and the tables (>200). I use ODBC to connect the server and get the schema name + table name into a data frame. For each of schema + table on

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Jeff Newmiller
Not all advice received on the Internet is safe. https://xkcd.com/327 https://db.rstudio.com/best-practices/run-queries-safely It is not that much more difficult to do it right. On July 2, 2021 12:05:43 PM PDT, Eric Berger wrote: >Modify the summ() function to start like this > >summ <-

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Hard for me to tell without more details but it looks like the following has several bugs for (i in dbtable$Tot_table) { Tabname <- as.character(sqldf(sprintf("SELECT Tot_table FROM dbtable", i))) summ(Tabname) } Your sprintf() statement seems to use 'i' but actually does not. You probably

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello Eric, Following your suggestion, I modified the code as: summ <- function(Tabname){   query <- sprintf(" SELECT * FROM %s",Tabname)   res <- dbGetQuery(con, query)   view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.Tabname.html")   rm(res) } for (i in

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Modify the summ() function to start like this summ <- function(Tabname){ query <- sprintf(" SELECT * FROM %s",Tabname) res <- dbGetQuery(con, query) etc HTH, Eric On Fri, Jul 2, 2021 at 9:39 PM Kai Yang via R-help wrote: > Hello List, > > The previous post look massy. I repost my

[R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello List, The previous post look massy. I repost my question. Sorry, I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate report: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2") view(dfSummary(res), file =

[R] R function question

2021-07-02 Thread Kai Yang via R-help
Hello List,I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate repost: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2")view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.BIODBX.MECCUNIQUE2.html")rm(res)

Re: [R] Function of "matrix"

2020-10-22 Thread Bill Dunlap
> 10.1/0.1 was successfully calculated Note that 'computed as' is not the same as 'printed as'. Computations are done with 52 binary digits of precision and printing is, by default, done with 7 decimal digits of precision. See FAQ 7.31. > 101 - 10.1/0.1 [1] 1.421085e-14 >

Re: [R] Function of "matrix"

2020-10-22 Thread Patrick (Malone Quantitative)
(Neglected to cc the list--please reply-all to this version) What was the warning? I hazard a guess you've run into precision issues for binary representation, and the result of your division is not *exactly* 101. Pat On Thu, Oct 22, 2020 at 2:42 PM 奈良県奈良市 wrote: > > Dear R project team > > I

Re: [R] Function of "matrix"

2020-10-22 Thread Bert Gunter
1. Answers on this list are from volunteers who are not part of any R project team. We have no official status and what we say comes with no guarantees. 2. There is no such thing as a "matrix 'environment' ". 3. The answer to your question is "computer arithmetic." See FAQ 7.31. Someone may

[R] Function of "matrix"

2020-10-22 Thread 奈良県奈良市
Dear R project team I used the function of "matrix" as follows: matrix(c(1:3030), 10.1/0.1) However, in the function, matrix, 10.1/0.1 was regarded as 100 not as 101. Therefore, a warning message appeared. On the other hand, matrix(c(1:3030), 101) or matrix(c(1:3030), 10.1*10) was OK. Of course,

Re: [R] Function that finds elements from matrix, and saves the indices of the elements to another matrix

2020-09-14 Thread Rui Barradas
Hello, This is simple: which(A == 1, arr.ind = TRUE) Hope this helps, Rui Barradas Às 12:03 de 14/09/20, Tuomas Koponen escreveu: Hi all dear R-list users, This might sound a silly problem, but but for one reason or another it has proved unsolvable to me. I need to solve the following

Re: [R] Function that finds elements from matrix, and saves the indices of the elements to another matrix

2020-09-14 Thread Bert Gunter
Is this a homework problem? We try not to do others' homework here. Incidentally, this can easily be done much more efficiently without any for() loops. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley

[R] Function that finds elements from matrix, and saves the indices of the elements to another matrix

2020-09-14 Thread Tuomas Koponen
Hi all dear R-list users, This might sound a silly problem, but but for one reason or another it has proved unsolvable to me. I need to solve the following task. I have tried to use two nested for loops as a solution, but have not been able to made it work. It would be great, if someone could

Re: [R] function to return plots

2020-06-12 Thread Naresh Gurbuxani
Thanks for your quick response.  It works as I wanted.  From: Rui Barradas Sent: Friday, June 12, 2020 7:08 AM To: Naresh Gurbuxani ; r-help@r-project.org Subject: Re: [R] function to return plots   Hello, plot.list is a list, try '[[' to access its members. ('[' returns sub-lists.) plot

Re: [R] function to return plots

2020-06-12 Thread Rui Barradas
Hello, plot.list is a list, try '[[' to access its members. ('[' returns sub-lists.) plot(plot.list[[1]], position = c(0, 0, 1, 0.5), more = TRUE) #Works plot(plot.list[[2]], position = c(0, 0.5, 1, 1), more = FALSE) #Works Hope this helps, Rui Barradas Às 10:52 de 12/06/20, Naresh

Re: [R] function to return plots

2020-06-12 Thread Jim Lemon
Hi Naresh, The somewhat obscure syntax of lattice. print(plot.list[[1]]) print(plot.list[[2]]) Jim On Fri, Jun 12, 2020 at 7:53 PM Naresh Gurbuxani wrote: > > > I want to write a function that will return lattice plots. This simple > function output a list of two plots. These plots can be >

[R] function to return plots

2020-06-12 Thread Naresh Gurbuxani
I want to write a function that will return lattice plots. This simple function output a list of two plots. These plots can be individually shown on the console. But I am unable to put them on two panels of a single plot. What changes do I need to make to this function? Thanks, Naresh

Re: [R] Function Hints in Mac Dark Mode

2020-05-08 Thread Marc Schwartz via R-help
> On May 8, 2020, at 11:02 AM, Jeff Newmiller wrote: > > You seem to be confusing R and RStudio... so yeah, wrong mailing list. I > don't know exactly where you should post either. Perhaps the GitHub issues > page for RStudio? > > On May 6, 2020 12:54:43 PM PDT, Andrew Swift via R-help >

Re: [R] Function Hints in Mac Dark Mode

2020-05-08 Thread Andrew Swift via R-help
Marc, Yes, that is exactly the issue. I’ll post to r-sig-mac. On May 8, 2020, at 10:11 AM, Marc Schwartz mailto:marc_schwa...@me.com>> wrote: On May 8, 2020, at 11:02 AM, Jeff Newmiller mailto:jdnew...@dcn.davis.ca.us>> wrote: You seem to be confusing R and RStudio... so yeah, wrong

Re: [R] Function Hints in Mac Dark Mode

2020-05-08 Thread Jeff Newmiller
You seem to be confusing R and RStudio... so yeah, wrong mailing list. I don't know exactly where you should post either. Perhaps the GitHub issues page for RStudio? On May 6, 2020 12:54:43 PM PDT, Andrew Swift via R-help wrote: >Sorry, wasn’t sure exactly where to post this but I noticed

[R] Function Hints in Mac Dark Mode

2020-05-08 Thread Andrew Swift via R-help
Sorry, wasn’t sure exactly where to post this but I noticed that with R 4.0.0 when running a Mac in Dark Mode that the Function Hints at the bottom of the Console and Editor windows become invisible. Thanks. __ R-help@r-project.org mailing list --

Re: [R] function sample: diferences across R versions

2019-07-31 Thread Jose Claudio Faria
It works! Thanks, ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria UESC/DCET/Brasil joseclaudio.faria at gmail.com Telefones: 55(73)3680.5545 - UESC 55(73)99966.9100 - VIVO ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ If you have software to deal with statistics, you have

Re: [R] function sample: diferences across R versions

2019-07-30 Thread Jeff Newmiller
There seem to be a couple of ways to do this. Rngkind( sample.kind="Rounding" ) or RNGversion("3.5.2") per ?Random https://stat.ethz.ch/pipermail/r-help/2019-June/463109.html On July 30, 2019 5:31:13 PM PDT, Jose Claudio Faria wrote: >Thanks Patrick. > >I took a look at the documentation

Re: [R] function sample: diferences across R versions

2019-07-30 Thread Jose Claudio Faria
Thanks Patrick. I took a look at the documentation of the RNGkind and RNGversion functions but didn't understand how they work. Can you exemplify how I can, through them, to recapture the old behavior? Best, ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria UESC/DCET/Brasil

Re: [R] function sample: diferences across R versions

2019-07-30 Thread Patrick (Malone Quantitative)
Poorly phrased--makes it act differently with respect to set.seed() . On Tue, Jul 30, 2019 at 6:55 PM Patrick (Malone Quantitative) wrote: > > My understanding is that sample() in 3.6.0 did, in fact, change in > ways that detach it from set.seed(). > > You can use RNGkind() or RNGversion() to

Re: [R] function sample: diferences across R versions

2019-07-30 Thread Patrick (Malone Quantitative)
My understanding is that sample() in 3.6.0 did, in fact, change in ways that detach it from set.seed(). You can use RNGkind() or RNGversion() to recapture the old behavior. See https://cran.rstudio.com/bin/windows/base/NEWS.R-3.6.1.html in the section CHANGES IN R 3.6.0 . Also, please do not

[R] function sample: diferences across R versions

2019-07-30 Thread Jose Claudio Faria
Hi, I just noticed the difference in a teaching data generation script between version 3.6.1 and earlier. #! R version 3.4.3 set.seed(2019); sample(1:10, 1) [1] 8 #! R version 3.5.1patched set.seed(2019); sample(1:10, 1) [1] 8 #! R version 3.5.3patched set.seed(2019); sample(1:10, 1) [1] 8 #!

Re: [R] Only change one parameter(n times) in R function then get outputs (n times)

2019-06-10 Thread Thevaraja, Mayooran
>; Bert Gunter<mailto:bgunter.4...@gmail.com>; Thevaraja, Mayooran<mailto:m.thevar...@massey.ac.nz> Cc: r-help@r-project.org<mailto:r-help@r-project.org> Subject: Re: [R] Only change one parameter(n times) in R function then get outputs (n times) Sorry ... that should have been "s

Re: [R] Only change one parameter(n times) in R function then get outputs (n times)

2019-06-10 Thread Jeff Newmiller
(aka Berkeley Breathed in his "Bloom County" comic strip ) >> >> >>On Sun, Jun 9, 2019 at 3:14 PM Thevaraja, Mayooran >> >>wrote: >> >>> Hello Friends, >>> I have my own written an R function comparison >>>

Re: [R] Only change one parameter(n times) in R function then get outputs (n times)

2019-06-09 Thread Jeff Newmiller
; >"The trouble with having an open mind is that people keep coming along >and >sticking things into it." >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > >On Sun, Jun 9, 2019 at 3:14 PM Thevaraja, Mayooran > >wrote: > >> Hell

Re: [R] Only change one parameter(n times) in R function then get outputs (n times)

2019-06-09 Thread Bert Gunter
n 9, 2019 at 3:14 PM Thevaraja, Mayooran wrote: > Hello Friends, > I have my own written an R function comparison > (p,d,N). I need to get output corresponding changes in p while d and N are > fixed. Also, my output is given three values such as A, B and C. Suppose

[R] Only change one parameter(n times) in R function then get outputs (n times)

2019-06-09 Thread Thevaraja, Mayooran
Hello Friends, I have my own written an R function comparison (p,d,N). I need to get output corresponding changes in p while d and N are fixed. Also, my output is given three values such as A, B and C. Suppose if I change ten different p's values, we will get ten values

Re: [R] function predict

2019-04-03 Thread J C Nash
I was about to reply to the item with a similar msg as Bert, but then realized that the students were pointing out that the function (possibly less than perfectly documented -- I didn't check) only works for complete years. I've encountered that issue myself when teaching forecasting. So I was

Re: [R] function predict

2019-04-03 Thread Bert Gunter
This list has *no homework* policy. I would assume that the purpose of your "project" is for you to learn how to deal with exactly the sorts of issues you describe. (But you might get lucky with a response anyway). Bert Gunter "The trouble with having an open mind is that people keep coming

[R] function predict

2019-04-03 Thread Michaela Berndl
Dear Sir or Madam, we are statistic students at the Johannes Kepler University in Linz, Austria. In a project we had to analyse the time series influenza from the package tscount and make a prediction for one year. For the prediction we used the function predict from the package raster. Since

Re: [R] Function doesn't work inside loop but works outside

2019-03-05 Thread Ek Esawi
Thank you Peter. That's a dumb question on my part! At least i should have known that i need an assignment statement. Thanks again--EK On Tue, Mar 5, 2019 at 11:36 AM peter dalgaard wrote: > > You need a print() around the gsub(...) when inside a loop. > > -pd > > > On 5 Mar 2019, at 17:18 , Ek

Re: [R] Function doesn't work inside loop but works outside

2019-03-05 Thread peter dalgaard
You need a print() around the gsub(...) when inside a loop. -pd > On 5 Mar 2019, at 17:18 , Ek Esawi wrote: > > Hi All, > > I am using xlsx package to extract and clean data from an Excel > Workbook. I ran into a strange behavior that I don’t understand. The > gsub doesn’t work inside the

[R] Function doesn't work inside loop but works outside

2019-03-05 Thread Ek Esawi
Hi All, I am using xlsx package to extract and clean data from an Excel Workbook. I ran into a strange behavior that I don’t understand. The gsub doesn’t work inside the loop but does outside the loop as shown on my code.. Tried to Google for help but nothing came up. My code loads and reads

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] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-24 Thread Jeff Newmiller
My objection to this design pattern is that this gives the default implementation of inside an ability that cannot be altered using functions provided by the caller. You might think this is what you want now but it has the potential to render the code unreusable in the future, which renders the

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] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Jan T Kim via R-help
Hi Duncan, On Wed, Jan 23, 2019 at 10:02:00AM -0500, Duncan Murdoch wrote: > On 23/01/2019 5:27 a.m., Jan T Kim wrote: > >Hi Ivan & All, > > > >R's scoping system basically goes to all environments along the call > >stack when trying to resolve an unbound variable, see the language > >definition

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

2019-01-23 Thread Duncan Murdoch
On 23/01/2019 5:27 a.m., Jan T Kim wrote: Hi Ivan & All, R's scoping system basically goes to all environments along the call stack when trying to resolve an unbound variable, see the language definition [1], section 4.3.4, and perhaps also 2.1.5. You are misinterpreting that section. It's

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

2019-01-23 Thread Duncan Murdoch
On 23/01/2019 4:53 a.m., Ivan Krylov wrote: 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

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

2019-01-23 Thread Jan T Kim
Hi Ivan & All, R's scoping system basically goes to all environments along the call stack when trying to resolve an unbound variable, see the language definition [1], section 4.3.4, and perhaps also 2.1.5. Generally, unbound variables should be used with care. It's a bit difficult to decide

[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] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Duncan Murdoch
On 02/01/2019 1:36 p.m., Nicolás San Martín wrote: In this case I am not able to store the text in a file, because it could be modified at any time and I need to display the most recent version (I fetch it from the internet). But I can assume that it is correctly organized for displaying. It

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Nicolás San Martín
In this case I am not able to store the text in a file, because it could be modified at any time and I need to display the most recent version (I fetch it from the internet). But I can assume that it is correctly organized for displaying. El mié., 2 ene. 2019 a las 14:31, Jeff Newmiller ()

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Nicolás San Martín
Yes, the file.show() is good enough. Thanks El mié., 2 ene. 2019 a las 13:48, Duncan Murdoch () escribió: > On 02/01/2019 8:47 a.m., Nicolás San Martín wrote: > > Hi all, > > > > I am looking for a function that receives some text (any text) and > displays > > it to the user in the same way as

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Jeff Newmiller
You can probably cobble together something, but spitting large chunks of information at users when the program wants to is bad design. It would be better to make a vignette or help file in a package and put the associated code from which you had been planning to spit out that text. On January

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Duncan Murdoch
On 02/01/2019 8:47 a.m., Nicolás San Martín wrote: Hi all, I am looking for a function that receives some text (any text) and displays it to the user in the same way as the 'help' function does. Unlike 'cat', that outputs the text in the current window, the one I'm looking for should work as

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Duncan Murdoch
On 02/01/2019 8:47 a.m., Nicolás San Martín wrote: Hi all, I am looking for a function that receives some text (any text) and displays it to the user in the same way as the 'help' function does. Unlike 'cat', that outputs the text in the current window, the one I'm looking for should work as

[R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Nicolás San Martín
Hi all, I am looking for a function that receives some text (any text) and displays it to the user in the same way as the 'help' function does. Unlike 'cat', that outputs the text in the current window, the one I'm looking for should work as 'help' that, for example, in emacs ess opens a new

Re: [R] Function gutenberg_download in the gutenbergr package

2018-01-24 Thread Jeff Newmiller
I have never used that package, but it seems obvious to me that you need to "reflect" on the meaning of the word "mirror". There is no reason to assume that a site hosting a mirror of the CRAN archive is also going to host a mirror of Project Gutenberg [1]. If, after you know you are giving

[R] Function gutenberg_download in the gutenbergr package

2018-01-23 Thread Patrick Connolly
I've been working through https://www.tidytextmining.com/tidytext.html wherein everything worked until I got to this part in section 1.5 > hgwells <- gutenberg_download(c(35, 36, 5230, 159)) Determining mirror for Project Gutenberg from http://www.gutenberg.org/robot/harvest Error in

Re: [R] function pointers?

2017-11-23 Thread jim holtman
I am replying to the first part of the question about the size of the object. It is probably best to use the "object_size" function in the "pryr" package: ‘object_size’ works similarly to ‘object.size’, but counts more accurately and includes the size of environments. ‘compare_size’

Re: [R] function pointers?

2017-11-22 Thread Duncan Murdoch
On 22/11/2017 11:29 AM, Paul Johnson wrote: We have a project that calls for the creation of a list of many distribution objects. Distributions can be of various types, with various parameters, but we ran into some problems. I started testing on a simple list of rnorm-based objects. I was a

[R] function pointers?

2017-11-22 Thread Paul Johnson
We have a project that calls for the creation of a list of many distribution objects. Distributions can be of various types, with various parameters, but we ran into some problems. I started testing on a simple list of rnorm-based objects. I was a little surprised at the RAM storage

Re: [R] Function to save results

2017-11-01 Thread Rui Barradas
- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya Arasu via R-help Sent: Wednesday, November 1, 2017 9:57 AM To: Eric Berger <eric

Re: [R] Function to save results

2017-11-01 Thread Priya Arasu via R-help
-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya Arasu via R-help Sent: Wednesday, November 1, 2017 9:57 AM To: Eric Berger <ericjber...@gmail.com> Cc: r-help@r-project.org Subject: Re: [R] Function to save results Hi Eric,Thanks for t

Re: [R] Function to save results

2017-11-01 Thread David L Carlson
X 77843-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org>] On Behalf Of Priya Arasu via R-help Sent: Wednesday, November 1, 2017 9:57 AM To: Eric Berger <ericjber...@gmail.com<mailto:ericjber...@gmail.com>>

Re: [R] Function to save results

2017-11-01 Thread Eric Berger
the > output with File | Save to File. > > --- > David L Carlson > Department of Anthropology > Texas A University > College Station, TX 77843-4352 > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org]

Re: [R] Function to save results

2017-11-01 Thread David L Carlson
File. --- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya Arasu via R-help Sent: Wednesday, November 1, 2017 9:

Re: [R] Function to save results

2017-11-01 Thread Priya Arasu via R-help
Hi Eric,Thanks for the explanation. Is there a way to save the results automatically after the analysis gets over?. As I recently lost the results, because I didn't save the results. I don't want to run the sink or save command after the analysis is over rather run the command for saving the

Re: [R] Function to save results

2017-11-01 Thread Priya Arasu via R-help
Hi Eric,I tried as you suggested but I could not find the output in the text file I created (attr.txt) net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")sink("C://Users//Priya//Desktop//Attractor

Re: [R] Function to save results

2017-11-01 Thread Eric Berger
Hi Priya, You did not follow the logic of the pseudo-code. The sink("filename"), sink() pair captures whatever output is generated between the first sink statement and the second sink statement. You need (possibly) to do: sink("C://Users//Priya//Desktop//Attractor analysis_all

Re: [R] Function to save results

2017-11-01 Thread Eric Berger
Some comments: 1. sink() does not return a value. There is on point to set attr <- sink(...). Just give the command sink("C://etc") 2. to complete the saving to the file you must give a second sink command with no argument: sink() So your code would be (pseudo-code, not actual code) sink(

  1   2   3   4   5   6   7   8   9   10   >