search for: nchars

Displaying 20 results from an estimated 697 matches for "nchars".

Did you mean: chars
2005 Oct 25
1
performance of nchar
Hi, Is nchar function knowingly slow in R? I'm doing some string formatting that requires multiple call to nchar, and nchar seems to be very slow. Experiment 1, pass nchar inside sprintf, and it takes 0.7 seconds > system.time(for (i in 1:10000) + str = sprintf('0005%020d', nchar(op)) + )[3] [1] 0.7 Experiment 2, get the length of op separately using nchar, and then pass
2015 Oct 05
9
Error generated by .Internal(nchar) disappears when debugging
On 05/10/2015 7:24 PM, Matt Dowle wrote: > Joris Meys <jorismeys <at> gmail.com> writes: > >> >> Hi all, >> >> I have a puzzling problem related to nchar. In R 3.2.1, the internal > nchar >> gained an extra argument (see >> https://stat.ethz.ch/pipermail/r-announce/2015/000586.html) >> >> I've been testing code using the
2015 Apr 24
2
Development version of R: Improved nchar(), nzchar() but changed API
Those of you who track R development closely, will have noticed yesterday's commit of enhanced versions of nchar() and nzchar(). ------------------------------------------------------------------------ r68254 | maechler | 2015-04-23 18:06:37 +0200 (Thu, 23 Apr 2015) | 1 line Changed paths: M doc/NEWS.Rd M src/library/base/R/New-Internal.R M src/library/base/R/zzz.R M
2015 Oct 05
2
Error generated by .Internal(nchar) disappears when debugging
Hi all, I have a puzzling problem related to nchar. In R 3.2.1, the internal nchar gained an extra argument (see https://stat.ethz.ch/pipermail/r-announce/2015/000586.html) I've been testing code using the package copula, and at home I'm still running R 3.2.0 (I know, I know...). When trying the following code, I got an error: > library(copula) > fgmCopula(0.8) Error in
2007 May 29
0
Correct usage of nchar(): precautionary change for R 2.6.0
Remember that nchar() returns by default the number of *bytes* and not the number of characters. I've recently spotted many cases in which nchar() has been used with substr() which works in characters; this can lead to incorrect results. (This seems the commonest use of nchar() in packages.) There were two reasons why nchar() was left defaulting to bytes when we allowed MBCSs in R:
2009 Aug 24
1
nchar on factors
In R 2.9.1 Windows: > nchar(factor(paste('sdf',1:10))) [1] 1 1 1 1 1 1 1 1 2 1 so it appears that nchar is counting the number of characters in the numeric representation, just like: > nchar(as.numeric(factor(paste('sdf',1:10)))) [1] 1 1 1 1 1 1 1 1 2 1 but ?nchar says explicitly: x: character vector, or a vector to be coerced to a character vector.
2006 Jan 10
5
matching country name tables from different sources
Hi, Before I reinvent the wheel I wanted to kindly ask you for your opinion if there is a simple way to do it. I want to merge a larger number of tables from different data sources in R and the matching criterium are country names. The tables are of different size and sometimes the country names do differ slightly. Has anyone done this or any recommendation on what commands I
2010 Mar 16
0
FW: How to parse a string (by a "new" markup) with R ?
A version using regular expressions, regexpr() and substr() functions is attached. Finally everything is packed into splitSeq() function (chunk 14 in the attached file) Seq<- "GCCTCGATAGCTCAGTTGGGAGAGCGTACGACTGAAGATCGTAAGGtCACCAGTTCGATCCTGGTTCGGGGCA" Str<-
2015 Oct 07
1
Error generated by .Internal(nchar) disappears when debugging
Malcolm, I tested the code on a clean R 3.2.0 session. Not even in RStudio, just to rule that out. > sessionInfo() R version 3.2.0 (2015-04-16) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8 x64 (build 9200) locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5]
2015 Oct 06
1
Error generated by .Internal(nchar) disappears when debugging
On 05/10/2015 8:25 PM, Matt Dowle wrote: > > On Mon, Oct 5, 2015 at 4:57 PM, Duncan Murdoch <murdoch.duncan at gmail.com > <mailto:murdoch.duncan at gmail.com>> wrote: > > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com <http://gmail.com>> writes: > > > >> > >> Hi all,
2015 Oct 06
0
Error generated by .Internal(nchar) disappears when debugging
On Tue, Oct 6, 2015 at 1:57 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com> writes: > > > >> > >> Hi all, > >> > >> I have a puzzling problem related to nchar. In R 3.2.1, the internal > > nchar > >> gained an extra
1997 Apr 24
2
R-alpha: Postscript bug ...
Jeez I dunno - it compiles perfectly and you guys get excited just because it doesn't work :-) I have to admit to being baffled about what happened (I'm SURE this was working not long ago), but here is a quick fix. The problem is in the function "GetCharInfo" in the file src/unix/PostScript.c. The fix is to change the statement if(nchar < 0) return 0; to if(nchar <
2015 Oct 07
0
Error generated by .Internal(nchar) disappears when debugging
What other packages do you have loaded? Perhaps a BioConductor one that loads S4Vectors that announces upon load: Creating a generic function for 'nchar' from package 'base' in package 'S4Vectors' Maybe a red herring... ~Malcolm > -----Original Message----- > From: R-devel [mailto:r-devel-bounces at r-project.org] On Behalf Of Duncan > Murdoch > Sent:
2015 Oct 06
1
Error generated by .Internal(nchar) disappears when debugging
On 06/10/2015 8:48 AM, Joris Meys wrote: > > > On Tue, Oct 6, 2015 at 1:57 AM, Duncan Murdoch <murdoch.duncan at gmail.com > <mailto:murdoch.duncan at gmail.com>> wrote: > > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com <http://gmail.com>> writes: > > > >> > >>
2015 Oct 06
0
Error generated by .Internal(nchar) disappears when debugging
On Mon, Oct 5, 2015 at 4:57 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com> writes: > > > >> > >> Hi all, > >> > >> I have a puzzling problem related to nchar. In R 3.2.1, the internal > > nchar > >> gained an extra
2006 Aug 29
1
writeChar
...es. These functions makes it very easy to write OS-independent files, which I am very happy with. I have however found a few issues, best illustrated by a short example > con <- file("test", open = "wb") > writeChar(as.character(c("ab", "ab")), nchars = c(3), con = con, eos = "") Warning message: writeChar: more characters requested than are in the string - will zero-pad > close(con) > system("hexdump -Cv test") 00000000 61 62 00 00 |ab..| 00000004 As seen from this example,...
2009 Apr 10
3
Determine the Length of the Longest Word in a String
Hi Everyone, I'm new to programming R and have accomplished my goal, but feel that there is probably a more efficient way of coding this. I'd appreciate any guidance that a more advanced programmer can provide. My goal -- I would like to find the length of the longest word in a string containing many words separated by spaces. How I did it -- I was able to find the length of the
2006 Mar 10
2
ifelse problem
Dear all, There is something I'm missing in order to understand the following behavior: > aa <- c("test", "name") > ifelse(any(nchar(aa) < 3), aa[-which(nchar(aa) < 3)], aa) [1] "test" > any(nchar(aa) < 3) [1] FALSE Shouldn't the ifelse function return the whole aa vector? Using if and else separately, I get the correct result... >
2011 Jan 05
2
vector of character with unequal width
Dear R users, The best in this new year 2011. I am dealing with a character vector (xx) whose nchar are not the same. Ex. nchar(xx) [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 4 4 4 4 4 4 4 4 [75] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ....... 9 I need xx to be nchar = 9 My
2008 Dec 12
7
character count
Dear list, I have a variable that consists of typed responses. I wish to compute a variable equal to the number of characters in the original variable. For example: > x <- c("convert this to 32 because it has 32 characters", "this one has 22 characters", "12 characters") [Some magic function here] > x [1] 32 22 12 Any ideas?