Displaying 20 results from an estimated 10000 matches similar to: "vector of character with unequal width"
2011 Nov 07
3
Upgrade R?
I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the
libraries from the 'library' directory in my existing installation (2.13.1)
to the installed R 2.14. Now I want to uninstall the old installation (R
2.13.1) and I get the error:
Internal Error: Cannot find utCompiledCode record for this version of the
uninstaller.
Any ideas?
Kevin
[[alternative HTML
2012 Mar 18
4
Linux R / Windows client
Hello,
I am currently running R on ubuntu and everything is working perfectly
fine. However, I would like to connect to R via Windows using Eclipse
StatEt plugin. Is this possible to do? or do I have to have a version
of R running on Windows also? I prefer to have Linux do the heavy
lifting and Windows Eclipse to be a sort of GUI.
Any thoughts?
2010 Apr 30
2
drop last character in a names'vector
Hi, i have a vector filled with names:
[1] Alvaro Adela ...
[25] Beatriz Berta ...
...
[100000] ...
I would like to drop last character in every name.
I use the next program:
for (i in 1:100000) {
? ? ? ? ? ? ? ? ? ? ? ? ? largo <- nchar(names[i]-1)
? ? ? ? ? ? ? ? ? ? ? ? ? names[i] <- substring (names[i],1,largo]
? ? ? ? ? ? ? ? ? ? ? ? ?}
Is another and faster way of do it?
Thanks,
2014 Nov 19
0
nchar reporting wrong width when zero-space character is present?
Dear list,
If I include the zero-width non-breaking space (\ufeff) in a string,
nchar seems to compute the wrong number of columns used by 'cat'.
> x <- "f\ufeffoo"
> x
[1] "f?oo"
> nchar(x,type="width")
[1] 2
I would expect "3" here. Going through the documentation of 'Encoding'
and 'encodeString', I don't think
2018 May 25
4
options other than regex
Hi --
I'm looking for alternatives to regex for a fairly simply 'reformatting'
problem. Alternatives only because a lot of folks have trouble
parsing/interpreting regex expressions, and I'm looking for suggestions
for something more 'transparent'.
Here is an example of what I'm trying to do. Take the following string,
which I call x, and for each character in the
1999 Aug 03
3
RW 0.64.2 substring() string truncation?
Hi,
(First, apology for my earlier incorrectly addressed "subscribe"
post.)
Can somebody tell me what exactly is going on below. Basically, I am
running into some kind of "string truncation" problem when I try
to get a substring starting past the 8192nd character (see sample
session below). There doesn't appear to be any problem creating the
string, and nchar()
2013 May 22
1
column width in .dbf files using write.dbf ... to be continued
Hello Arnaud,
You posted this question a long long time ago, however I found your answer so I decided to post it anyway in case somebody else have the same problem as you and me.
You were actually very close in finding your solution. The function DoWritedbf is an internal function from the foreign package. To access it outside of the package just do:
foreign:::DoWritedbf
so in your line:
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
2011 Jul 27
1
create a index.date column
Dear
R users,
I
created a matrix that tells me the first day of use of a category by
id.
#Calculate
time difference
test$tdiff<-as.numeric(difftime(as.Date("2002-09-01"), test$ftime, units = "days"))
#
obtain the index date per person and dcategory
index.date.test<-tapply(test$tdiff,
list(test$id, test$rcat), max)
Nonetheless,
at the moment I think will be
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]
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.
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 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
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 Sep 29
2
String manipulation with regexpr, got to be a better way
Help-Rs,
I'm doing some string manipulation in a file where I converted a string date in mm/dd/yyyy format and returned the date yyyy.
I've used regexpr (hat tip to Gabor G for a very nice earlier post on this function) in steps (I've un-nested the code and provided it and an example of what I did below. My question is: is there a more efficient way to do this. Specifically is
2018 May 25
0
options other than regex
Hi
I am not sure if it is more readable
> paste(paste(unlist(strsplit(x,"")),".", sep=""), collapse="")
[1] "1.0.1.1.0.1.1.1."
If you did not want last dot, it is a bit shorter.
> paste(unlist(strsplit(x,"")),collapse=".")
[1] "1.0.1.1.0.1.1.1"
>
Cheers
Petr
Tento e-mail a jak?koliv k n?mu p?ipojen?
2009 Aug 11
1
Passing a list object to lapply
Hello,
I'm having difficulty passing an object name to a lapply function. Can
somebody tell me the trick to make this work?
#Works
T13702 <- TRACKDATA[["13702.xls"]][["data"]]
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]))))
16553
#Works
d<-2
assign(paste("T",substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
2009 Aug 21
1
trouble with Vista & reading files
All,
I am having trouble with a "read.table()" function that is inside of
another function. But if I call the function by itself, it works fine.
Moreover, if I run the script on a Mac OS X (with the default Mac OS X
version of R installed, rev 2.8), it works fine. But it does not work if I
run it on windows vista (also default Windows version of R, rev. 2.8).
Again, both
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
2012 Sep 14
1
please comment on my function
this function is supposed to canonicalize the language:
--8<---------------cut here---------------start------------->8---
canonicalize.language <- function (s) {
s <- tolower(s)
long <- nchar(s) == 5
s[long] <- sub("^([a-z]{2})[-_][a-z]{2}$","\\1",s[long])
s[nchar(s) != 2 & s != "c"] <- "unknown"
s
}