Displaying 20 results from an estimated 3000 matches similar to: "eliminating control characters from formatted data files"
2005 Oct 06
1
Simple question.....
Hi all user R,
My simple question is...I have a vector of names of predictors,
text<-c("datem","cola","eslom")...I try to plot the model with this predictor in sequence loop....,
for(i in 1:3){
png(paste("fig_",i,sep=""))
plot(preplot.gam(mod9)[[i]],se=T,rug=F,main="",xaxt="n",ylab="",xlab="")
2011 Apr 19
1
print.raw - but convert ASCII?
Does anyone know if there is a simple way to print raw vectors, such
that ASCII characters are printed for bytes in the ASCII range, and
their hex representation otherwise? rawToChar doesn't work when we have
something like c(0x00, 0x00, 0x44, 0x00).
-Matt
2008 Apr 28
4
R 2.7.0, match() and strings containing \0 - bug?
Hi,
A piece of my code that uses readBin() to read a certain file type is
behaving strangely with R 2.7.0. This seems to be because of a failure
to match() strings after using rawToChar() when the original was
terminated with a "\0" character. Direct equality testing with ==
still works as expected. I can reproduce this as follows:
> x <- "foo"
> y <-
2013 May 03
1
untar() error
Dear List,
I have a list of 600+ *.gz files that I would like to extract and read the
geotiffs contained within them. I tried using the untar() function to
simplify this task but I am stumped by an error. I've combed the Internet
for a solution without luck. The details are below, and any help in solving
this matter is appreciated.
> files = list.files(path = "J:/GIMMS/NDVI",
2024 Jun 01
2
Tools to modify highlighted areas in pdf documents?
Dear R-Users,
Are there any packages that enable the modifications of highlighted areas / annotations in pdf documents?
It seems feasible - I have explored some R code (see below). However, I would rather avoid to reinvent the wheel.
The problem:
When highlighting pdf-documents with Microsoft Edge, the bounding box is sometimes misplaced, and quite ugly so. It also lacks the ability to draw
2006 Sep 05
1
serialize changes for 2.4.0
I noticed today that in R 2.3.1, I get
> serialize(list(1,2,3), NULL, ascii = TRUE)
[1] "A\n2\n131841\n131840\n19\n3\n14\n1\n1\n14\n1\n2\n14\n1\n3\n"
>
but in R 2.4.0 alpha I get
> serialize(list(1,2,3), NULL, ascii = TRUE)
[1] 41 0a 32 0a 31 33 32 30 39 36 0a 31 33 31 38 34 30 0a 31 39 0a 33 0a 31 34
[26] 0a 31 0a 31 0a 31 34 0a 31 0a 32 0a 31 34 0a 31 0a 33 0a
>
2007 Aug 07
2
Embedded nuls in strings
Hi,
?rawToChar
'rawToChar' converts raw bytes either to a single character string
or a character vector of single bytes. (Note that a single
character string could contain embedded nuls.)
Allowing embedded nuls in a string might be an interesting experiment but it
seems to cause some troubles to most of the string manipulation functions.
A string with an embedded 0:
2008 May 21
1
rawToChar(raw(0))
Hi,
right now we have (on R v2.7.0 patched (2008-04-23 r45466)) that:
> rawToChar(raw(0))
[1] ""
> rawToChar(raw(0), multiple=TRUE)
character(0)
Is this intended or should both return character(0)? Personally, I
would prefer that an empty input vector returns an empty output
vector. Same should then apply to charToRaw(), but right now we get:
> x <- character(0)
>
2013 May 08
1
getting corrupted data when using readBin() after seek() on a gzfile connection
Hi,
I'm running into more issues when reading data from a gzfile connection.
If I read the data sequentially with successive calls to readBin(), the
data I get looks ok. But if I call seek() between the successive calls
to readBin(), I get corrupted data.
Here is a (hopefully) reproducible example. See my sessionInfo() at the
end (I'm not on Windows, where, according to the man page,
2013 Jul 15
2
Serialize data.frame to database
Dear R-Users,
I need a very fast and reliable database solution so I try to serialize a data.frame (to binary data) and to store this data to an SQLite database.
This is what I tried to do:
library(RSQLite)
con <- dbDriver("SQLite")
db <- dbConnect(con, "test")
dbSendQuery(db, 'CREATE TABLE frames("simID" INT, "data" BLOB)')
data.bin <-
2009 Nov 25
1
Eliminating 'Unprintable ASCII' characters
Hi all,
I have a csv file containing words with *UNPRINTABLE ASCII* characters
(described in the following table).
Are there any viable method in eliminating these characters?
I realise that *EXTENDED ASCII* characters (i.e , ¡, ¢, £, ¤ etc) can be
removed or replaced via *"gsub"* or *"gregexpr"* functions. But am not
certain with the *UNPRINTABLE ASCII* characters.
Your
2008 Oct 28
2
writting null (\000 or ^@) to an external text file without the new warning
I have some functions that write an external text file for postprocessing by another program. Some instructions to the other program need to be indicated by null values (\000 or ^@). The function currently uses code like:
writeChar(rawToChar(as.raw(0)), con)
where con is a connection to the file. Previous to version 2.8.0 this worked fine. With 2.8.0 it still works, but I get a warning
2009 May 10
2
In C, a fast way to slice a vector?
Hello,
Suppose in the following code,
PROTECT(sr = R_tryEval( .... ))
sr is a RAWSXP vector. I wish to return another RAWSXP starting at
position 13 onwards (base=0).
I could create another RAWSXP of the correct length and then memcpy
the required bytes and length to this new one.
However is there a more efficient method?
Regards
Saptarshi Guha
2010 Oct 13
4
the wandering MAC?
Hi all,
I have what appears to be a truly puzzling problem. I've got this P4
32-bit machine running CentOS 5.5 with XEN that has two NICs: one
onboard, an Intel Corporation 82540EM Gigabit and one on an expansion
card, Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit. The second one
is recognized as eth1.
What's happening is, it is showing up under one of the two MAC's:
either
2008 Jul 20
4
drawing segments through points with pch=1
Please excuse me for asking such basic questions:
Here is my code
> y=c(1.21,0.51,0.14,1.62,-0.8,0.72,-1.71,0.84,0.02,-0.12)
> ybar=mean(y)
> ll=length(y);
> ybarv=rep(ybar,ll)
> x=1:ll
> plot(x,ybarv,pch=1)
> segments(x[1],ybar,x[ll],ybar)
What I get is a collection of small circles, with a segment "on top"
of the circles, which is almost what I want. But I
2016 Sep 05
2
How to print UTF-8 encoded strings from a C routine to R's output?
Dear R experts,
It seems that Rprintf has to be used to print from a C routine to guarantee
to write to R?s output according to
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Printing.
However if a string is UTF-8 encoded, non-ASCII characters (e.g., the
infinity symbol http://www.fileformat.info/info/unicode/char/221e/index.htm)
are misprinted.
Is this an unsupported feature or is
2013 Apr 10
1
Issue with Control-Z in a text file on Windows - readLines() appears to truncate
Working on Windows I have had to deal with CSV files that,
unfortunately, contain embedded Control-Zs, i.e. ASCII character 26 in
decimal, and the readLines() function in R on Windows (2.15.2 and
3.0.0) appears to truncate at the control-Z. There is no problem at
all on Ubuntu Linux with R 3.0.0.
Am I mistaken or is this genuine?
# Create a small file with embedded Control-Z
h3 <-
2008 Sep 25
1
Saving R-objects to a database
Someone solved the problem of saving R-objects to a database?
These are the two varaints I've tried so far without success:
1)
ser = rawToChar(serialize(obj, NULL, ascii=TRUE))
dbSendQuery(link, paste("insert into table values(1, '",ser,"')",sep=''))
The field to save the object in the MySQL Database is of type text.
unser = dbGetQuery(link,"select
2013 Sep 02
1
Sweave: printing an underscore in the output from an R command
I am working with Sweave and would like to print out into my latex document the result of the R command
version$platform
So what I first tried in my .Rnw document was \Sexpr{print(version$platform)}.
However, the output from this command is the string "x86_64-apple-darwin10.8.0" (without the quotes). This contains an underscore, which is a special character in tex and so I get an error
2008 Sep 10
4
re flecting a line
Suppose x and y are numeric vectors of the same length.
plot(x,y) #scatterplot
lmObj1 <- lm(y~x) # best fit line
abline(lmObj1) # good
lmObj2 <- lm(x~y) #get best fit but with axes interchanged
abline(lmObj2) # not what I want. I want the correct line, drawn on the same
graph, but with
# response and predictor variables interchanged
One way to proceed would be to