similar to: Suprising behavior of paste or cat?

Displaying 20 results from an estimated 4000 matches similar to: "Suprising behavior of paste or cat?"

2010 Nov 08
1
Unexpected behavior with cat
I am experiencing unexpected behavior with the command cat under Window GUI builds of R version 2.12.0 (it does not seem to be an issue in Rterm). For example if I issue the command cat(70,"\r") I get back text that looks like Asian characters. If I highlight and copy that text, it is the text I would regularly expect, e.g. the number 70 and the prompt line. Highlighting the text
2013 Nov 01
5
cat with backspace and newline characters
Hi, when mixing newline and backspace characters I get the following output (see below). In the second call, the backspace character is simply not applied. Is this normal behaviour? Thank you. > cat("abc\b") ab> cat("abc\b\n") abc > [[alternative HTML version deleted]]
2023 May 18
1
suprising behaviour of tryCatch()
G'day Federico, On Wed, 17 May 2023 10:42:17 +0000 "Calboli Federico (LUKE)" <federico.calboli at luke.fi> wrote: > sexsnp = rep(NA, 1750) > for(i in 1:1750){tryCatch(sexsnp[i] = fisher.test(table(data[,3], > data[,i + 38]))$p, error = function(e) print(NA))} Error: unexpected > '=' in "for(i in 1:1750){tryCatch(sexsnp[i] =" Try: R> for(i in
2023 May 18
1
suprising behaviour of tryCatch()
... or just put the R expression inside curly brackets, e.g. tryCatch({ sexsnp[i] = fisher.test(table(data[,3], data[,i+38]))$p }, error=function(e) print(NA)) Exercise: Compare > list(a = 2) $a [1] 2 with > list({ a = 2 }) [[1]] [1] 2 and > list(b = { a = 2 }) $b [1] 2 BTW, note how the latter two assigned a <- 2 to the global environment. /Henrik On Thu, May 18, 2023 at
2023 May 18
1
suprising behaviour of tryCatch()
Because `<-` and `=` do different things (and I am one of the old fossils that wish they had not been confounded). `fun(x <- expr)` Assigns the value of `expr` to the variable `x` in the frame/environment that `fun` is called from. `fun(x = expr)` Assigns the value of `expr`to the variable `x` in the frame/environment created for and used by `fun` subject to the rules of argument matching.
2023 May 17
4
suprising behaviour of tryCatch()
Hello, I run a fisher.test() in a loop, with the issue that some of the data will not be useable. To protect the loop I used tryCatch but: sexsnp = rep(NA, 1750) for(i in 1:1750){tryCatch(sexsnp[i] = fisher.test(table(data[,3], data[,i + 38]))$p, error = function(e) print(NA))} Error: unexpected '=' in "for(i in 1:1750){tryCatch(sexsnp[i] =" But this works: for(i in
2001 Nov 29
1
of c, cat, paste, and lists??
Still trying to get a handle on c, cat, paste, and lists. Here is my current problem. I have a good number of vectors that I want to selectively combine into a dataframe. The exact name of the vectors changes in a looping arrangement but can easily be grepped. The problem is: how can I use a list produced by a grep in a data.frame command: i.e. > ls() [1] "a"
2010 Mar 25
6
c(), or cat(), or paste(), all cause unwanted reordering
Hi, I would expect the following: paste( as.character( cat( rep( ".", 2 ) ) ), "a string", as.character( cat( rep( ".", 3 ) ) ) ); to yield this string: ". . a string . . .", but instead it yields this: > . .. . .[1] " a string " The third argument has been stuck immediately after the first. The same thing happens with cat() or c().
2013 Feb 04
4
rJava works with 32-bit but not 64
Hello: rJava works for me under 32-bit but under not 64-bit R; see below. Suggestions? Thanks, Spencer > library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: stop("No CurrentVersion entry in '", key, "'! Try re-installing Java and make sure R and Java have matching architectures.")
2007 Jan 23
6
can't plot a line
Consider the following: plot(0, 0, xlim=c(-10, 10), ylim=c(-50, 50)) lines(c(0,0), (2*c(-pi, pi))^2) I see no line in this plot. R version 2.4.1 (2006-12-18) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1]
2010 Nov 11
3
User input after opening graphing device
If I run the following: > windows() > > bringToTop(-1) > > interactive() [1] TRUE > > run <- readline(prompt = "Continue (Yes = 1, No = 2):") Continue (Yes = 1, No = 2): > dummy <- 1 > run [1] "" it does not allow user input though the session is interactive (it jumps right over the readline command). It would be great
2011 Mar 30
2
problem with png() and large dimensions on some 32-bit Windows machines
Hello, I encountered this: > png(file=tempfile(), width=1165, height=12983) Error in png(file = tempfile(), width = 1165, height = 12983) : unable to start png() device In addition: Warning messages: 1: In png(file = tempfile(), width = 1165, height = 12983) : Unable to allocate bitmap 2: In png(file = tempfile(), width = 1165, height = 12983) : opening device failed > On the
2015 Aug 07
3
download.file() on ftp URL fails in windows with default download method
Hi, > url <- "ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_000001405.13.assembly.txt" > download.file(url, tempfile()) trying URL 'ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_000001405.13.assembly.txt' Error in download.file(url, tempfile()) : cannot open URL
2007 Jun 26
3
possible bug in 'scan'
R-devel, When I run the following code on the attached file, tmp <- scan("C:/temp.csv", what=list("character","numeric"), sep=",") Then tmp[[2]] is a character vector. My impression from the help file is that it should be a numeric as specified by 'what' > sessionInfo() R version 2.5.0 (2007-04-23) i386-pc-mingw32
2009 Sep 07
2
using an array of strings with strsplit, issue when including a space in split criteria
Dear all, I'm having a problem understanding why a split does not occur with in the 2nd use of the function strsplit below: # text strings > txt <- c("sales to 23 August 2008 published 29 August", + "sales to 6 September 2008 published?11 September") # first use > strsplit(txt, 'published', fixed=TRUE) [[1]] [1] "sales to 23 August 2008 "
2007 Sep 19
2
By() with method = spearman
I have a data set where I want the correlations between 2 variables conditional on a students grade level. This code works just fine. by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete', method='pearson') However, this generates an error by(tmp[,c('mtsc07', 'DCBASmathscoreSPRING')], tmp$Grade, cor, use='complete',
2010 Sep 09
1
Error in normalizePath(path) : with McAfee
Dear R People: I keep getting the "Error in normalizePath(path) :" while trying to obtain the necessary packages to use with the "Applied Spatial Statistics with R" book. I turned off the Firewall (from McAfee) but am still getting the same message. Does anyone have any idea on a solution please? > sessionInfo() R version 2.11.1 (2010-05-31) i386-pc-mingw32 locale: [1]
2008 Sep 10
2
trouble printing from graphics device in R 2.7.2
Hi, I've been using R for many years and have always tried to keep my R version up to date, and when I switched from 2.7.1 to 2.7.2 I'm suddenly having trouble printing from the graphics device. I have Windows XP, and installed both versions of R from the binaries. If I start 2.7.2 and simply do: > plot(1:10) the default R Graphics Device window opens as usual. However, when I
2008 Mar 23
2
problem with 'install.packages'
Hi, All: Is there a way to identify whether any users are using a particular package in a shared network R installation? I ask, because we have such a multiple-user installation and when I tried to install a package using Rgui that was in use by Rterm on a single-user installation, 'install.packages' deleted the existing package but failed to install the new version;
2013 Jul 22
1
problem loading large xlsx file into r
Hi, I am facing trouble when trying to read large xlsx file into R. please find the code and error below. The file I was trying to read has 36,500 rows X 188 col, ~ 37 MB size. > options( java.parameters = "-Xmx4g" ) > library(xlsx) Loading required package: xlsxjars Loading required package: rJava > cftc =