I tried to read only one file and get some information but this is what I
got:
sam=file("C:\\Users\\2001\\SWdown_200101_01.img", "rb")
file1<- readBin(sam, double(),size=4, n=360*720)
file.info(file1)$size
Error in file.info(file1) : invalid filename argument
dim(file1)
NULL
--
View this mes
The trick may be behind not reading the files properly is that all my 365
files donot have the same name. for example:
files from number 1 to number9 are named for the first month:
SWdown_200101_01.img
SWdown_200101_09.img
files from number 10 to number30 are named:
SWdown_200101_10.i
l Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Jonsson
> Sent: Friday, May 25, 2012 8:58 AM
> To: r-help@r-project.org
> Subject: Re: [R] R does not recognise columns and rows as they are supposed
> to be
>
> Yes I d
Yes I did so.
Yes the first values are the right ones: - -.
so this meant that I should consider my data as: double/4/little
Is it so?
file <-
"C:\\Users\\aalyaari\\Documents\\INRA\\WFD_reprocessed\\dialyswco\\2001\\SWdown_200101_01.img"
> for(what in c("double", "integer")) {
+ f
lto:r-help-boun...@r-project.org] On
> Behalf
> Of Jonsson
> Sent: Thursday, May 24, 2012 11:41 PM
> To: r-help@r-project.org
> Subject: Re: [R] R does not recognise columns and rows as they are supposed
> to be
>
> Yes I exactly followed what you all suggested:
> X<-(
Yes I exactly followed what you all suggested:
X<-(82:92) ; Y<-(364:369) # for sellected region
> extract <- double(365)
> setwd("C:\\Users\\aalyaari\\Desktop\\New folder (10)\\")
> listfile<-dir()
> for (i in 1:365) {
+ conne <- file(listfile[i], "rb")
+ file1<- readBin(co
ay, May 24, 2012 9:48 AM
> To: r-help@r-project.org
> Subject: Re: [R] R does not recognise columns and rows as they are supposed
> to be
>
> Hello,
>
> There are several things with your code, most of which are not errors.
>
> 1. X<-c(364:369) ; Y<-c(82:92 and later
Yes this helped a lot .
I exactly followed what you suggested:
X<-(82:92) ; Y<-(364:369) # for sellected region
> extract <- double(365)
> setwd("C:\\Users\\aalyaari\\Desktop\\New folder (10)\\")
> listfile<-dir()
> for (i in 1:365) {
+ conne <- file(listfile[i], "rb")
+ file1<-
Sorry, forgot the last line in the op code.
write.table(extract, ...) is called every time through the loop, not just
one time after it. Put it after closing '}'.
Rui Barradas
Rui Barradas wrote
>
> Hello,
>
> There are several things with your code, most of which are not errors.
>
> 1. X<-
Hello,
There are several things with your code, most of which are not errors.
1. X<-c(364:369) ; Y<-c(82:92 and later c(1:365)
Expressions of the form m:n are integer sequences, the c() is not needed.
2. extract<-vector()
First you create the vector, then keep extending it throughout the loop.
T
On May 24, 2012, at 11:51 AM, Jonsson wrote:
Dear All,
The code given bellow is to extract values of one region and write
that to
a text file(there are 365 binary files in the directory).
The problem which I am facing is that all my files are binary with
size of
360 rows and 720 columns.
Dear All,
The code given bellow is to extract values of one region and write that to
a text file(there are 365 binary files in the directory).
The problem which I am facing is that all my files are binary with size of
360 rows and 720 columns.
I specified that in this line:file2<-matrix(data=f
12 matches
Mail list logo