search for: nchar

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

Did you mean: char
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]...
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 package copula, and at home I'm still >> running R 3.2.0 (I know, I know...). When tryin...
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 src/library/base/man/nchar.Rd...
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: > librar...
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...
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 ve...
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 ?
...,x+attr(x,"match.length")-1),Seq=Str) str <- str[!X==""] X<-X[!X==""] if(length(X)==0) X <- str <- "" return(cbind(X,str)) } # splitStem <- function(x){ str <- x[2] X <- x[1] (y <- getStem("^[.]+",X,str)[1]) (X <- substr(X,nchar(y)+1,nchar(X))) (str <-substr(str,nchar(y)+1,nchar(str))) before <- y (y <- getStem("^>+",X,str)[1]) (X <- substr(X,nchar(y)+1,nchar(X))) (str <-substr(str,nchar(y)+1,nchar(str))) opening <- y (y<- getStem("^[.]*",X,str)) (X <- substr(X,nchar(y)+1,ncha...
2015 Oct 07
1
Error generated by .Internal(nchar) disappears when debugging
...-31 stabledist_0.7-0 fortunes_1.5-2 On Wed, Oct 7, 2015 at 9:52 PM, Cook, Malcolm <MEC at stowers.org> wrote: > 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: Monday,...
2015 Oct 06
1
Error generated by .Internal(nchar) disappears when debugging
...>> wrote: > > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com <http://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 package copula, and at home I'm > still &gt...
2015 Oct 06
0
Error generated by .Internal(nchar) disappears when debugging
...015 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 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...
1997 Apr 24
2
R-alpha: Postscript bug ...
...cited 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 < 0) return 1; as indicated in the #ifdefs below. I will make a patch file and put it the archive with the .tgz file. We seem to have enough problem reports to justfy getting a new 0.50 out pretty soon in any case. Ross - - - replacement - - GetCharInfo...
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: Monday, October 05, 2015 6:57 PM > To: Matt Dowle <m...
2015 Oct 06
1
Error generated by .Internal(nchar) disappears when debugging
...>> wrote: > > On 05/10/2015 7:24 PM, Matt Dowle wrote: > > Joris Meys <jorismeys <at> gmail.com <http://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 package copula, and at home I'm still > &gt...
2015 Oct 06
0
Error generated by .Internal(nchar) disappears when debugging
...015 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 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...
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
...longest word in a string containing many words separated by spaces. How I did it -- I was able to find the length of the longest word by parsing the string into a list of separate words, using the function "which.max" to determine the element with the longest length, and then using "nchar" to calculate the length of that particular word. My question -- It seems inefficient to determine which element is the longest and then calculate the length of that longest element. I was hoping to find a way to simply return the length of the longest word in a more straightforward way. Sh...
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... > if (any(nchar(aa) < 3)) { aa[-which(nchar(aa) < 3)]...
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 best gu...
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?