Displaying 20 results from an estimated 50000 matches similar to: "End of File for binary files"
2009 Jul 27
1
read binary file seek()
I want to read in a binary file using the readBin() function. In order to
skip uninformative parts of the file I use the seek() function, I need to
specify the number of bits to skip rather than the number of bytes to skip.
E.g. seek(to.read,origin="current",blockSize)
with blockSize giving the number of bits
Does anybody know if this works? Any help would be highly
2009 Jul 12
1
How can I test for End-Of-FIle
I have a long text file with uneven record length and variable structure.
Therefore I have to read it line-by-line.
I found out I can open a connection to the file and read in one line at a time.
Something like:
con <- file("MyFle.txt","r")
while (End-Of-File) {
line <- readLines(con,n=1)
ParseLine(line)
}
But I realized I do not know how to test for the
2009 Nov 25
3
Test Binary File
I've got an error with the way I'm using readBin on a binary file of unknown internal structure. I know the structure consists of rows and columns, but I'm not sure how many of each.
So, does anyone know of a valid test set of binary data that I could reference while trying to figure out the technique of using readBin?
It would be really helpful to try out readBin on a readily
2007 Oct 16
1
data structure for plsr
All,
I am working with NIR spectral data and it was great to find that the example in ?plsr also used spectral data. Unfortunately, I am having difficulty figuring out how the "yarn" dataset is structured to allow for the plsr model to read:
library(pls)
data(yard)
yarn.oscorespls <- mvr(density ~ NIR, 6, data = yarn, validation = "CV", method = "oscorespls")
2006 Oct 12
1
Draw a circle at the end of a line
I have a plot of cumulative distribution function which is a step function,
I'd like to put a cycle at the right end of each line to indicate that the value here is not available in this line.
How can I do that?
Thank you.
cdf<-function(x){
do.call("rbind",lapply(1:nrow(as.matrix(x)), function(i){
a<-x[i]
if (a<0.5){b=0.1}
else if (a<1){b=0.3}
else if
2008 Aug 22
2
boxplot
Hi, I just made a boxplot but I want to change the thickness of the
line used for the median to look a little thinner. Could anyone please
help me figuring out the R-code to do it?
Thanks, I really appreciate it.
Suyan
2010 Feb 05
1
String Manipulation- Extract numerical and alphanumerical segment
I am currently attempting to split a long list of strings (let's call it
"string.list") that is of the format:
"1234567.z3.abcdef-gh.12"
I have gotten it to:
"1234567" "z3" "abcdef-gh" "12"
by use of the strsplit function.
This leaves me with each element of "string.list" having a split string of
the above format. What
2010 May 24
5
Means do not tally
Hi all,
here is my situation
In my experiment, I expose 10 subjects to 24 different conditions of
stimuli. Each condition is exposed to the same subject 3x.
This would make each subject have 24x3=72 data points. All the subjects
combined would have 72x10=720 data points with each condition having 30
datapoints.
To find the grand average of each condition, I find the average of all the
2010 Feb 20
3
aggregating using 'with' function
Hi All,
I am interested in aggregating a data frame based on 2
categories--mean effect size (r) for each 'id's' 'mod1'. The
'with' function works well when aggregating on one category (e.g.,
based on 'id' below) but doesnt work if I try 2 categories. How can
this be accomplished?
# sample data
id<-c(1,1,1,rep(4:12))
n<-c(10,20,13,22,28,12,12,36,19,12,
2010 Oct 27
1
"non-numeric argument to binary operator" error while reading ncdf file
Hi everyone,
I am a newbie in R and in this discussion list. I am trying to use R package
"ncdf" to read values of temperature from a NCDF file. I did it before to
another file using the function "get.var.ncdf", but now there is an error
that I can not solve, and I would really appreciate if you could help me.
I am using R version 2.11.1 (2010-05-31) in a machine with Linux
2009 Mar 17
1
the quote problem with readLines()
Dear all,
I read a file with all numbers with readLines function, as below,
> f <- file("data.txt")
> a <- readLines(f)
but all the values in a are in format "....", and I cannot do the
calculation with them since they are not numeric. I wonder how should I skip
those quotes, thank you for help!
I have to use readLines function instead of scan, read.table or
2008 Aug 12
2
Multiple column/row names?
Hi all,
I wonder if there is a way to create a matrix with two (or even more)
column/row names? Thank you very much.
Have a nice day.
--
??? Hesen Peng
http://hesen.peng.googlepages.com/
2010 Jun 07
3
Subsetting subsets of data.frames
Hey Everyone,
I have been stumped by this all day.
Basically, I have a data.frame of multiple columns. Of concern are "id" &
"date"
For some reason, oftentimes there are duplicates of data with the same date.
I would like to remove the duplicates per different id (removing duplicate
dates for the entire data.frame would leave nothing since different id's all
have
2010 Feb 03
3
diagnostic plots
Dear all,
does anybody ever encountered the problem with diagnostic plots?
x<-rnorm(100)
y<-rnorm(100)
plot(lm(x~y))
It gives the following message "Waiting to confirm page change..." and
nothing happens.
Thanks a lot!
[[alternative HTML version deleted]]
2008 May 15
2
Adding columns to dataframe
Hi,
I have a dataframe SDF1 that looks like this:
Char1 Char2 Char 3 W.2007.02 W.2007.09 W.2007.16 W.2008.13
A C1 F1 F2 F3
A C2
F4
B C3 F5
F6
I have another dataframe SDF2 with 163 cols that has the following column
names
Char1 Char2 Char 3 W.2007.02 W.2007.03 W.2007.04
2010 May 18
1
Dealing with 1000+ sequentially named vectors
Hello!
I'm having trouble figuring out how to apply a function to a set of vectors
or data frames, when that set is over 1000 large.
I've created 1891 vectors named as follows:
vector.names <- paste("vector",1:1891,sep="")
These can be referred to easily by using get as follows:
vector <- get(vector.names[1])
The problem is, I can't figure out a
2008 Aug 15
2
Pdf file size for very scatter plots
Dear all,
I am plotting a scatter plot for a large sample (1e+05 ordered pairs).
This produces a large (~5MB) file in a pdf or postscript terminal, and
I am wondering whether there are methods for reducing the size of the
resulting file so that it is easier to include it in a document. I'd
rather stick with pdf or ps as I am using latex.
thanks,
Nazareno
2006 Sep 23
2
Create a vector of indices from a matrix of start and end points
I have a very large dataframe and wish to extract a subset of rows. I
have a two column matrix listing the starting and ending indices of
one subset on each row. My idea is to create a vector of indices that
could be applied to the dataframe and I have a solution using a for
loop (below). But surely there is some more elegant way to do this! I
looked thorough the archives without
2010 Aug 01
3
remove extreme values or winsorize – loop - dataframe
Hi everyone!
#I need a loop or a function that creates a X2 variable
that is X1 without the extreme values (or X1 winsorized)
by industry and year.
#My reproducible example:
firm<-sort(rep(1:1000,10),decreasing=F)
year<-rep(1998:2007,1000)
industry<-rep(c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10),rep(6,10),rep(7,10),rep(8,10),rep(9,10),
rep(10,10)),1000)
X1<-rnorm(10000)
2008 Jun 23
3
Getting only label column of a data frame
Hi,
How can I extract the label only from a given data frame.
Fore example from this data frame.
> print(dataf)
V1 V2 V3 V4 V5 V6 V7 V8 V9
11145 14.3 17.1 31.2 41.7 45.8 49.8 68.6 70.6 72.9
3545 10.2 15.6 20.9 23.2 31.4 31.7 36.2 48.4 51.9
8951 15.2 17.5 20.0 21.4 32.4