Displaying 2 results from an estimated 2 matches for "nomfichier".
2007 Feb 16
2
if() for() { }
...d
looking at the doc, I was unable to fix the following problem.
I want to do either:
for (i in 1:lat) a[i,which(a[i,]==0] <- NA
or:
for (i in 1:lat) a[i,which(a[i,]==-9999|a[i,]==9999|a[i,]==9998|a[i,]
==-9998)] <- NA
if the word "Time" is or is not present in variable "nomfichier":
test<-grep("Time",nomfichier)
the controlling test would be:
if (test==1)
But in either cases I obtain:
if (grep("Time",nomfichier)>0) for (i in 1:lat) a[i,which(a[i,]==0]
<- NA
Erreur : syntax error
> if (grep("Time",nomfichier)<>0) {f...
2006 Apr 04
1
imaging and contouring
...to solve the following difficulty.
I am running R on a iMac G5 with OS 10.4.
The file below (73 rows x 144 col) shows the values of a climatic
index on the globe with a grid of 2,5 ? x 2,5 ? (NA = no value):
?
With image() and map() and running the following function:
dessin_i<-function(nomfichier="ERA40NA.dat",lat=73,long=144)
{ #d?finition de la fonction
library(maps)
a <- read.table(nomfichier) #lecture du fichier
z <- array(0,dim=c(long,lat)) #cr?ation d'un tableau de 0
z <- t(a) #transposition de la matrice a en z
z1<-rbind(z[65:long,],z[1:64,]) #centrage de l...