Displaying 20 results from an estimated 1000 matches similar to: "floating point in single precision"
2010 Jul 17
4
sort file names in numerical order
Hello,
I get some file names by list.files().
These names are in alphabetical order.
I want to change it to logical numeric order.
Example:
> fileNames <- c("A10", "A1", "A2", "B1", "B2", "B10")
> sort(fileNames)
[1] "A1" "A10" "A2" "B1" "B10" "B2"
I want to have:
2010 Jul 05
1
export VTK from R : impossible to write data as float
Hello,
I've written a short code (below) to write 3D unstructured grid to binary
VTK files from R. Problem : I can only write integers with the command :
data<-as.numeric(c(3.3))
storage.mode(data)<-'integer'
writeBin(data,bfile_celldata,endian="swap")
the function storage.mode(data)<-'long' looks fine, but the VTK file is not
readable.
thanks for any
2013 Oct 15
1
discrepancy between r cmd check --as-cran and messages at submission
Dear r-devel list,
I've observed at both of my submissions that issues arise at submission
that were not pointed out by
R cmd check --as-cran
For example at my last submission:
You have
VignetteBuilder: knitr
but there is nothing looking like a vignette in your source package....
We also see:
* checking DESCRIPTION meta-information ... NOTE
Author field differs from that derived from
2006 Nov 09
2
Single precision data behaviour with readBin()
Hi all,
I am running R version 2.4.0 (2006-10-03) on an i686 pc with Mandrake
10.2 Linux. I was given a binary data file containing single precision
numbers that I would like to read into R. In a previous posting,
someone suggested reading in such data as double(), which is what I've
tried:
> zz <- file(file, "rb")
> h1 <- readBin(con = zz, what = double(), n = 1, size
2001 Feb 15
2
Reading single precision floats from binary file
Dear all,
I have a few files with binary data written by a C program a friend wrote.
I allready have program to read these files, Thomas Lumley and Prof Brian
D Ripley was kind enough to respond to a question to this list earlier
with some code that works perfectly, so this is really no problem, it is
more out curiousity.
Most of my files consists of 40000 single precision floats, and I figured
2010 Sep 26
2
get absolute file path
Hello,
I get a value which stores a relative file name. (I get it from another
function, which I don't want to change.)
e.g.
> fileName <- "../data/2010-08.csv";
Is it possible to get the absolute file path out of this value?
(e.g. /home/sebastian/documents/data/2010-08.csv)
Kind regards,
Sebastian
2011 Sep 07
1
storage and single-precision
I'm getting the impression from on-line docs that R cannot work with
single-precision floating-point numbers, but that it has a pseudo-mode for
single precision for communication with external programs.
I don't mind that R is using doubles internally, but what about storage?
If all I need to store is single-precision (32-bit), can I do that? When
it is read back into R it can be
2019 Dec 06
2
long vector support
All,
At first glance, a recent commit to R-devel (
https://github.com/wch/r-source/commit/2c182014ecc8c2407a89092c9162d86046bd18da)
appears to be related to long vector support. But as Henrik Bengtsson
points out at
https://github.com/HenrikBengtsson/Wishlist-for-R/issues/97#issuecomment-562659134,
writeBin() still prohibits long vectors. Are there any plans to add long
vector support to R
2002 Oct 07
2
Error in writeBin(object, con, size = 2)
Hi all,
I wrote a function (in R batch mode) which reads binary data,
interpolates sometimes and wrote a new binary file of the same size as
the input file. Her is a bit of code:
while (length( head <- readBin(si, integer(), 64, size=2))) {
data <- readBin(si, integer(), head[5], size=2)
## now write head to new file
writeBin(head, so, size=2)
## if head[4] is 9 or
2001 Dec 07
2
Memory problem
Dear all,
I have written a little R program to convert images. See below. Within the
loop over j (the filenames) memory consumption grows constantly. rm( ... )
inside the loop did not help. Memory does not grow if I remove the writeBin
statements between the two #-------- marks. But obviously this is not
solution I want...
Thanks for any advice.
Manfred Baumstark
P.S. As I'm new to R:
2003 Apr 25
2
Open an r+b file connection on Windows
I am trying to open an existing binary file, seek to a position in the
middle, and then write one byte, while keeping the already existing data
after that byte. It seems to me that I am unable to open a connection to a
binary file in both read and write mode. I can open the "r+b" binary file
connection and seek around, but I can't write to the file. And looking at
the function
2002 Nov 29
2
readBin or writeBin adds extra nulls (PR#2333)
Full_Name: Ken Yap
Version: 1.6.1
OS: Linux (SuSE 8.0)
Submission from: (NULL) (129.78.64.5)
I'm trying to copy a file using readBin and writeBin. (The reason is to be able
to pipe PostScript or PDF output to a socket later, this is just an experiment.)
I do:
zz <- file("foo.ps", "rb")
r <- readBin(zz, character(), 1000000)
yy <- file("bar.ps",
2007 Dec 05
4
Java parser for R data file?
Hi everyone,
Has anyone written a parser in Java for either the ASCII or binary format
produced by save()? I need to parse a single large 2D array that is
structured like this:
list(
"32609_1" = c(-9549.39231289146, -9574.07159324482, ... ),
"32610_2" = c(-6369.12526971635, -6403.99620977124, ... ),
"32618_2" = c(-2138.29095689061, -2057.9229403233, ... ),
2011 Feb 04
2
Strange behaviour of read and writeBin
To me it seems like writeBin() writes one char/byte more than expected.
> con <- file("testbin", "wb")
> writeBin("ttccggaa", con)
> close(con)
> con <- file("testbin", "rb")
> readBin(con, what="character")
[1] "ttccggaa"
> seek(con, what=NA)
[1] 9
> close(con)
> con <-
2012 Feb 01
6
While loop working with TRUE/FALSE?
Hi R users,
is there any possibilty that a while loop is working like that:
z <- c(0,1,2,3,4,5,6,7,8,9)
r <- 7
while(w == T) {
for ( i in 1:10 ){
w <- r == z[i]
print(w)
}
}
The loop should stop if w == TRUE
best regards
--
View this message in context:
2010 Jan 07
2
Problem with writeBin and importing into gfortran compiled programs
Hi all,
I'm having problems trying to export binary arrays from R and importing
them into fortran (linux openSUSE 10.3 (x86_64), gfortran compiler,
fortran 90/95 program).
Let's say the problem can be expressed as:
R part
------------
>whini <- runif(1000)
>writeBin(whini,"fwhini.dat")
f90 part
------------
PROGRAM foo
INTEGER, PARAMETER :: DP = KIND(1.0D0)
INTEGER ::
2004 Jul 26
3
Read SPSS data (*.sav) in R 1.8.0 (ok) and R1.9.1(error)
Hallo!
I read SPSS data in the following way:
library(Hmisc)
library(foreign)
dat<-spss.get("surv_abb.sav")
In R1.9.1 I got the message:
"Error in all(arg == choices) : Object "typeDate" not
found"
In R1.8.0 the same script works fine.
Does anybody know a possibilty to read a SPSS file
under R1.9.1?
Thanks!
Karl
2020 May 06
3
defining r audio connections
Dear R Devel,
Since Linux moved away from using a file-system interface for audio, I think it is necessary to write special libraries to interface with audio hardware from various languages on Linux.
In R, it seems like the appropriate datatype for a `snd_pcm_t` handle pointing to an open ALSA source or sink would be a "connection". Connection types are already defined in R for
2012 May 02
6
Quickest way to make a large "empty" file on disk?
R-helpers:
What would be the absolute fastest way to make a large "empty" file (e.g.
filled with all zeroes) on disk, given a byte size and a given number
number of empty values. I know I can use writeBin, but the "object" in
this case may be far too large to store in main memory. I'm asking because
I'm going to use this file in conjunction with mmap to do parallel
2013 Aug 14
1
2 questions about signal & broken connection in R
Hi, all,
I have 2 questions about signal handling in R. Would you pls help give me
some suggestions? Many thanks!
[How to block the signal in one R function]:
If one R function hopes to be running without interrupting, how can we
avoid this?
To be more specific, for one R function "func1", it will do a loop to send
messages to another R process, and receive responses from peers. How