search for: encodestring

Displaying 20 results from an estimated 32 matches for "encodestring".

2007 Jun 05
1
Inverse of encodeString
What is the inverse of encodeString? For example, \u1 is some Unicode symbol. If I do s <- encodeString("\u1") then s will be the string "\001". But anything I do with s, will not return the Unicode that corresponds to \u1: cat(s, "\n") # prints \001 cat("\u1", "\n") # prints...
2018 Jul 17
2
Output mis-encoded on Windows w/ RGui 3.5.1 in strange case
...at script to a file called 'encoding.R' and source that, then I see the reported behavior. Here's something standalone that you should hopefully be able to copy + paste into RGui to reproduce: code <- ' x <- 1 print(list()) save(x, file = tempfile()) output <- encodeString("apple") print(output) ' file <- tempfile(fileext = ".R") writeLines(code, con = file) source(file) When I run this, I see: > code <- ' + x <- 1 + print(list()) + save(x, file = tempfile()) + output <- encodeString("apple") +...
2018 Jul 18
1
Output mis-encoded on Windows w/ RGui 3.5.1 in strange case
Fixed in R-devel and R-patched, Tomas On 07/18/2018 12:03 PM, Tomas Kalibera wrote: > Thanks, I can now reproduce and it is a bug that is easy to fix, I > will do so shortly. > > Fyi it can be reproduced simply by running these two lines in Rgui: > > list() > encodeString("apple") > > Best > Tomas > > On 07/17/2018 05:16 PM, Kevin Ushey wrote: >> Sorry, I should have been more clear -- if I write the contents of >> that script to a file called 'encoding.R' and source that, then I see >> the reported behavior. >&g...
2012 Dec 11
2
Writing escaped unicode
I'd like to write unicode strings using the "\u" escape syntax. According to the documentation, print.default or encodeString will escape unicode using the \u convention. In practice, I can't make it work. > b="Unicode character: \ufffd" > print.default(b) [1] "Unicode character: ?" > encodeString(b) [1] "Unicode character: ?" I want to write the string back out in the same es...
2018 Jul 16
2
Output mis-encoded on Windows w/ RGui 3.5.1 in strange case
Given the following R script: x <- 1 print(list()) save(x, file = tempfile()) output <- encodeString("apple") print(output) If I source this script from RGui on Windows, I see the output: > source("encoding.R") list() [1] "\002??apple\003??" That is, it's as though R has injected what looks like byte order marks around the encoded string: &gt...
2018 Jul 18
0
Output mis-encoded on Windows w/ RGui 3.5.1 in strange case
Thanks, I can now reproduce and it is a bug that is easy to fix, I will do so shortly. Fyi it can be reproduced simply by running these two lines in Rgui: list() encodeString("apple") Best Tomas On 07/17/2018 05:16 PM, Kevin Ushey wrote: > Sorry, I should have been more clear -- if I write the contents of > that script to a file called 'encoding.R' and source that, then I see > the reported behavior. > > Here's something standalone...
2018 Jul 17
0
Output mis-encoded on Windows w/ RGui 3.5.1 in strange case
...TF-8 to wide characters before printing on Windows. The escapes should not be used unless printing to RGui console. I suppose you managed to leak the escapes but I cannot reproduce, the example you sent seems incomplete ("x" not used, not clear what encoding.R is, not clear where the encodeString is run) and none of the variations I ran leaked the escapes on R-devel. Please clarify the example if you believe it is a bug. Please also use current R-devel (I've relatively recently fixed a bug in decoding these escaped strings, perhaps unlikely, but not impossible it could be related)....
2007 May 02
1
how to concatinate the elements of some text vectors cat() or print() ?
...out where I am going wrong? Thanks Simple Example: aa <- LETTERS[1:5] bb <- letters[1:5] cat(aa[1], bb[1]) # works for individuals cat(aa,bb) #(concatinates entire vectors) # Using sink I might get it to work if I could figure out how to escape a # new line command. encodeString does not seem appropriate here. harry <- c(rep(NA,5)) for (i in 1:5 ) { cat (aa[i],bb[i]) }
2011 Aug 05
1
Displaying a summary in graphics
...adj=0) I don't get the proper formatting. I gather, from the documentation and searching the web, that the issue is that summary() includes a method for print() to format the data but mtext() doesn't follow the method. If I understand correctly, I need to use something like format() or encodeString() to get the proper formatting for mtext() to use. The thing is that I haven't figured out anything close to the right parameters to use. Is there some place which describes how to do this?
2005 Jul 20
1
(PR#8017) build of REventLoop package crashes with 2.1 due
...lean); > < SEXP R_data_class2(SEXP); > --- >> SEXP R_data_class(SEXP , int); > 864,869d861 > < typedef enum { > < Rprt_adj_left = 0, > < Rprt_adj_right = 1, > < Rprt_adj_centre = 2 > < } Rprt_adj; > < > 872,939c864 > < char *EncodeString(SEXP, int, int, Rprt_adj); > < > < > < #if defined(HAVE_WCHAR_H) && defined(SUPPORT_MBCS) > < #include <wchar.h> > < #endif > < > < /* main/util.c */ > < void UNIMPLEMENTED_TYPE(char *s, SEXP x); > < void UNIMPLEMENTED_TYPEt(char *...
2010 May 16
1
Reading JPEG file, converting to HEX
...and I also receive a number of warning messages: > Warning messages: > 1: In encodeString(object, quote = "\"", na.encode = FALSE) : > it is not known that wchar_t is Unicode on this platform I assume (naively) that I need some other approach to reading the file. I also presume (again, naively) that once I have read the file successfully, I can convert the contents...
2005 Jul 19
0
build of REventLoop package crashes with 2.1 due tosyntax error in Defn.h (PR#8017)
...ar*, char*); 799,800c798 < SEXP R_data_class(SEXP , Rboolean); < SEXP R_data_class2(SEXP); --- > SEXP R_data_class(SEXP , int); 864,869d861 < typedef enum { < Rprt_adj_left = 0, < Rprt_adj_right = 1, < Rprt_adj_centre = 2 < } Rprt_adj; < 872,939c864 < char *EncodeString(SEXP, int, int, Rprt_adj); < < < #if defined(HAVE_WCHAR_H) && defined(SUPPORT_MBCS) < #include <wchar.h> < #endif < < /* main/util.c */ < void UNIMPLEMENTED_TYPE(char *s, SEXP x); < void UNIMPLEMENTED_TYPEt(char *s, SEXPTYPE t); < Rboolean utf8strIsASCII(...
2006 Jul 19
2
Aligning ragged text columns
...is some info\nabout heading 2", ), byrow=T, nrow=2) to look like: Heading 1 This is some info about heading 1 Heading 2 This is some info about heading 2 (if you're not using a fixed width font, I want the text in the second column to line up) I've looked at encodeString and format, but neither seems to quite be the right tool Thanks! Hadley
2008 Sep 23
3
How to convert backslash to slash?
How to use sub, gsub, etc. to replace "\" in a string to "/"? For example,convert "C:\foo\bar" to "C:/foo/bar". Thanks, Shengqiao Li
2014 Nov 19
0
nchar reporting wrong width when zero-space character is present?
...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 this is expected behavior. Am I missing something? If it is a bug I will file a report. Secondly, the documentation of 'nchars' states that with type='chars' (the default) it returns "the number of human-readable characters". I get: > nchar(x,t...
2012 Aug 09
1
Using unicode symbol has unexpected results in levels of factor object
Dear all, When I use a unicode symbol in the labels for a factor object, the corresponding level does not display as expected. However, using levels() on the factor returns the desired output. I noticed the discrepancy when the legend labels from a call to ggplot() did not display the desired symbol, but an explicitly built legend using the same labels did. Example (I am trying to get the less
2008 Feb 01
4
Concatenate a Variable
Good morning! I do not speak English very well and so I will try to explain the best I can. I have this: > tabela[,1] [1] a a b b a c b a c c c c c Levels: a b c >unique(tabela[,1]) [1] a b c Levels: a b c >var<-unique(tabela[,1])[1] > var [1] a Levels: a b c But if I concatenate like this > cat("VAR: ", var, "\n") I obtain >VAR: 1 and I
2017 Sep 28
1
R 3.4.2 is released
...R#17274) * callNextMethod() works for ... methods. * qr.coef(qd, y) now has correct names also when qd is a complex QR or stems from qr(*, LAPACK=TRUE). * Setting options(device = *) to an invalid function no longer segfaults when plotting is initiated. (PR#15883) * encodeString(<very large string>) no longer segfaults. (PR#15885) * It is again possible to use configure --enable-maintainer-mode without having installed notangle (it was required in R 3.4.[01]). * S4 method dispatch on ... calls the method by name instead of .Method (f...
2017 Sep 28
1
R 3.4.2 is released
...R#17274) * callNextMethod() works for ... methods. * qr.coef(qd, y) now has correct names also when qd is a complex QR or stems from qr(*, LAPACK=TRUE). * Setting options(device = *) to an invalid function no longer segfaults when plotting is initiated. (PR#15883) * encodeString(<very large string>) no longer segfaults. (PR#15885) * It is again possible to use configure --enable-maintainer-mode without having installed notangle (it was required in R 3.4.[01]). * S4 method dispatch on ... calls the method by name instead of .Method (f...
2012 Mar 20
1
overriding "summary.default" or "summary.data.frame". How?
...vels = 10, alphaSort = TRUE, digits = max(3, getOption("digits") - 3)) { ##copies from R base::summary.R summary.data.frame ncw <- function(x) { z <- nchar(x, type="w") if (any(na <- is.na(z))) { # FIXME: can we do better z[na] <- nchar(encodeString(z[na]), "b") } z } if (!is.data.frame(dat)) dat <- as.data.frame(dat) ##treat any nonnumeric as a factor factors <- sapply(dat, function(x) {!is.numeric(x) }) ##If only one factor, need drop=FALSE. datf <- dat[ , factors, drop = FALSE] if (alphaSort) datf &...