search for: suppresswarn

Displaying 20 results from an estimated 105 matches for "suppresswarn".

2011 Nov 24
1
capture.output(eval(..., envir)) not evaluate in the expected(?) environment
...g the same exercise. Start by defining foo() which evaluates an expression locally in a given environment and catches the output via capture.output(): foo <- function(..., envir=parent.frame()) { capture.output({ eval(substitute({x <- 1}), envir=envir) }) } # foo() Then call: > suppressWarnings(rm(x)); foo(envir=globalenv()); print(x); character(0) [1] 1 This works as expected. However, if argument 'envir' is not specified explicitly, you get: > suppressWarnings(rm(x)); foo(); str(x); character(0) Error in str(x) : object 'x' not found which shows that the inter...
2016 Jun 04
0
factors with non-unique ("duplicated") levels have been deprecated since 2009 -- are *more* deprecated now -- and why you should be hesitant misusing suppressWarnings()
...ls)) { values <- labels at values labels <- labels at .Data } else { values <- labels <- sort(unique(x at .Data)) } filter <- x at value.filter use.levels <- if (length(filter)) is.valid2(values, filter) else TRUE f <- suppressWarnings(factor(x at .Data, levels = values[use.levels], labels = labels[use.levels])) if (length(attr(x, "contrasts"))) contrasts(f) <- contrasts(x) f } <environment: namespace:memisc> and the suppressWarnings(..) has "ensured" all these years...
2008 Dec 07
4
Finding the first value without warning in a loop
Dear R useRs, with the following piece of code i try to find the first value which can be calculated without warnings `test` <- function(a) { repeat { ## hide warnings suppressWarnings(log(a)) if (exists("last.warning", envir = .GlobalEnv)) { a <- a + 0.1 ## clear existing warnings rm("last.warning", envir = .GlobalEnv) } if(a > 5 || !exists("last.warning", envir = .GlobalEnv)) break } return(a) }...
2023 Jun 13
1
log transform a data frame
Thank you so much David, here is correction: d1=suppressWarnings(read.csv("/Users/anamaria/Downloads/B1.csv", stringsAsFactors=FALSE, header=TRUE)) d1$X <- NULL d2=as.matrix(sapply(d1, as.numeric)) pdf("~/graph.pdf") b<-barplot(d2, legend= c("SYCL", "CUDA"), beside= TRUE,las=2,cex.axis=0.7,cex.names=0.7,ylim=c(0,...
2012 Sep 02
5
[newbie] scripting remote check for R package
summary: e.g., how to replace '<query R for package=package_name>' in the following: for RSERVER in 'foo' 'bar' 'baz' ; do ssh ${RSERVER} '<query R for package=package_name>' done or is there a better way to script checking for an R package? details: For my work I need a few non-standard R packages. I do that work on 2 clusters. One uses
2019 Mar 05
3
Development version of R fails tests and is not installed
G'day all, I have daily scripts running to install the patched version of the current R version and the development version of R on my linux box (Ubuntu 18.04.2 LTS). The last development version that was successfully compiled and installed was "R Under development (unstable) (2019-02-25 r76159)" on 26 February. Since then the script always fails as a regression test seems to
2015 Sep 10
2
Using IDs to suppress specific messages and warnings
The suppressMessages and suppressWarnings functions currently suppress all the message or warnings that are generated by the input expression. The ability to suppress only specific messages or warnings is sometimes useful, particularly for cases like file import where there are lots of things that can go wrong. Suppressing only messa...
2006 Sep 29
2
Warning: a final empty element has been omitted
How can I suppress this warning? > options(warn = -10) > list(1,2,3,) Warning: a final empty element has been omitted the part of the args list of 'list' being evaluated was: (1, 2, 3, ) [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 > suppressWarnings(list(1,)) Warning: a final empty element has been omitted the part of the args list of 'list' being evaluated was: (1, ) [[1]] [1] 1 And can anyone add some insight as to why this warning was added? It was nice to be able to use a construction like: a <- list( b = 3, c = 4,...
2011 Nov 15
0
Quantstrat; error with applyStrategy()
...nts # #################################################### if( !exists(".instrument") ) .instrument <<- new.env() if( !exists(".blotter") ) .blotter <<- new.env() if( !exists(".strategy") ) .strategy <<- new.env() suppressWarnings( rm("account.STOXX", "portfolio.STOXX", pos=.blotter) ) suppressWarnings( rm("stratROC", "initDate", "initEq") ) suppressWarnings( rm("order_book.STOXX", pos=.strategy) ) ################################################## #...
2023 Jun 13
1
log transform a data frame
Hello, I have a data frame like this: d11=suppressWarnings(read.csv("/Users/anamaria/Downloads/B1.csv", stringsAsFactors=FALSE, header=TRUE)) > d11 X Domain.decomp. DD.com..load Neighbor.search Launch.PP.GPU.ops. Comm..coord. 1 SYCL 2. 1 0 3.7 0. 1 1 .6 2 CUDA 2...
2012 Oct 17
2
Completely ignoring an error in a function...
..., sep, fill, labels, append) : argument 2 (type 'list') cannot be handled by 'cat' A standard function would stop here. HOWEVER, I want, in this odd case, to say "keep going" to my function and have it proceeed to # Do something C. How do I accomplish this? I thought suppressWarnings() would do it but it doesn't appear to. Assume that debugging "Do something B" is out of the question. Why am I doing this? Because in my odd case, "Do something B" actually does what I needed it to, but returned an error that is irrelevant to my special case (it crea...
2009 Mar 18
2
Profiling question: string formatting extremely slow
...which of the function used below is the bottleneck, as.integer, is.na, sub, paste, nchar, toupper? Is there a profiler for R and if yes where could I find some documentation on how to use it? The code: # String contains digits only (can be converted to an integer) digits_only <- function(x) { suppressWarnings(!is.na(as.integer(x))) } # Remove blanks at both ends of a string trim <- function (x) { sub("^\\s+((.*\\S)\\s+)?$", "\\2", x) } # P/N formatting pn_formatting <- function(pn_in) { pn_out = trim(pn_in) if (digits_only(pn_out)) { # Zero padding pn_out...
2017 Mar 07
1
Control statements with condition with greater than one should give error (not just warning) [PATCH]
...we could "flip the switch" in a test > > environment and see how much havoc is wreaked and whether > > authors are sufficiently responsive? > > > Michael > > As we have > 10'000 packages on CRAN alonce, and people have > started (mis)using suppressWarnings(.) in many places, there > may be considerably more packages affected than we optimistically assume... > > As R core member who would "flip the switch" I'd typically then > have to be the one sending an e-mail to all package maintainers > affected.... and in this...
2016 Jul 04
2
cat() in proc.time?
...33d730/src/library/base/R/time.R#L31 on.exit(cat("Timing stopped at:", ppt(proc.time() - time), "\n")) This means that as far as I can tell the general way to make sure there is no output from a timed statement is ... tt1 <- capture.output(tt0 <- suppressMessages(suppressWarnings( try(<stuff to try>, silent=TRUE)))) (I know I could/should be using tryCatch() instead of try(), but I don't think it really matters here ... ?) What would people think of a request to change this to message() rather than cat() in the future .....
2015 Sep 10
0
Using IDs to suppress specific messages and warnings
...sort of thing. That is already how tryCatch and withCallingHandlers discriminate the conditions to handle. Designing and implementing a condition class hierarchy to support this is indeed the hard/tedious part. Best, luke On Thu, 10 Sep 2015, Richard Cotton wrote: > The suppressMessages and suppressWarnings functions currently suppress > all the message or warnings that are generated by the input > expression. > > The ability to suppress only specific messages or warnings is > sometimes useful, particularly for cases like file import where there > are lots of things that can go w...
2018 May 06
0
Sys.timezone (timedatectl) unnecessarily warns loudly
...medatectl", intern = TRUE) : # running command 'timedatectl' had status 1 There was small discussion where I initially put comment about it in: https://github.com/wch/r-source/commit/9866ac2ad1e2f1c4565ae829ba33b5b98a08d10d#r28867164 Below patch makes timedatectl call silent, both suppressWarnings and ignore.stderr are required to deal with R warning, and warning printed directly to console from timedatectl. diff --git src/library/base/R/datetime.R src/library/base/R/datetime.R index 6b34267936..b81c049f3e 100644 --- src/library/base/R/datetime.R +++ src/library/base/R/datetime.R @@ -73...
2006 Jun 30
2
incomplete final line found by readLines on ...
Dear R-users I need to read some text files produced by some other software. I used readLines (with n = -1 ) command and then tried to find some numbers I liked to extract or some line numbers I like to know. The problem is that there is no empty line at the end of the text files. R gave me this warning below; In addition: Warning message: incomplete final line found by readLines on
2008 Jan 11
1
How to disable output messages (prints or cats) from functions in R?
...coefficients ..." followed with a lot of numbers depending on the input. This is very annoying because I have to run that function several times and I don't want to show this information. What I want is to disable that display but I don't know how to do it. I've tried it with suppressWarnings ( function (...) ) and suppressMessages ( function (...) ) but It doesn't work, the function() continues printing that information. I tried invisible () too. Furthermore, this function doesn't have a "verbose" parameter. Thus, I can't disable it using a verbose paramet...
2009 Jun 04
1
how to tell if as.numeric succeeds?
Suppose I have a vector of strings. I'd like to convert this to a vector of numbers if possible. How can I tell if it is possible? as.numeric() will issue a warning if it fails. Do I need to trap this warning? If so, how? In other words, my end goal is a function that takes a vector of strings and returns either a numeric vector or the original vector. Assuming this doesn't already
2008 Jul 21
1
Howto Restart A Function with Try-Error Catch
.... Otherwise keep the output of the function. I'm not sure how to create the above construct. The code I have below doesn't work: __BEGIN__ myfunction <- function(the_x) { # do something a = list(output1=val1, output2 = val2) a } out <- try(suppressWarnings(myfunction(x)),silent=T) if (class(out) == "try-error") { #this clause doesn't seem to "redo" out <- myfunction(X) } else { ll <- out$output1 } __END__ - Gundala Viswanath Jakarta - Indonesia