Displaying 20 results from an estimated 36 matches for "rahiz".
2009 Dec 30
2
select elements and transpose
...[[2]]
V1 V2 V3
[1,]10 11 12
[2,]13 14 15
[3,]16 17 18
[[3]]
V1 V2 V3
[1,]19 20 21
[2,]22 23 24
[3,]25 26 27
how do i extract elements in each file so that after transpose, it looks
something like the following;
1
10
19
2
11
20
3
12
21
and so on..
Thanks..
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2009 Dec 27
3
Scaling error
...which is OK for a set of test data but not for my actual dataset.
At the moment, I'm thinking of something in the lines of a for loop
function i.e.
for (i in ...){
statement...
}
Is there a syntax in the for loop that allows me to select the
column/row in the file?
Thanks.
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2009 Dec 04
2
Standard deviation for each element in a set of matrices
...le1 File2 File3
1 1 1 4 4 4 7 7 7
2 2 2 5 5 5 8 8 8
3 3 3 6 6 6 9 9 9
I want to calculate the standard deviation for every cell in the file
(I'm using gridded data). The desired output is
Output
3 3 3
3 3 3
3 3 3
Thanks.
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2010 Jan 02
1
Question on Reduce + rollmean
...V1 V2 V3
[1,] 1 1 1
[2,] 2 2 2
[3,] 3 3 3
[[2]]
V1 V2 V3
[1,] 4 4 4
[2,] 5 5 5
[3,] 6 6 6
[[3]]
V1 V2 V3
[1,] 7 7 7
[2,] 8 8 8
[3,] 9 9 9
The moving average is to be performed on
1,4,7 = (1+4)/2 , (4+7)/2
2,5,8 = ..
3,6,9 = ..
Thanks
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment, University of Oxford
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: m...
2010 Jan 16
2
Drought severity index: Excel to R
...s is the main problem.
How do I make the data in Excel's Column C in R? Or in other words, how
do I update the result of the conditional statements into the dummy
file, d, which I created (which apparently didn't work).
I hope my explanation makes sense.
thanks.
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment, University of Oxford
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: mu...
2009 Dec 07
1
Output multiple files
...e1.txt", "file2.txt", "file3.txt")
for (i in 1:3){ # where 3 is the number of files
file[[i]] <- file[[i]] * 3 # just a simple calculation to multiply the matrix by 3
write.table(file[[i]],out[i], row.names=FALSE, col.names=FALSE)
}
Thanks.
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2010 Jan 06
1
Increment in loop
...nction(x){
eval.parent(substitute(x <- x + 1))
print(x) }
How do I apply it in a loop on my test dataset, x1, so that the procedure becomes
x1[c(1:2)]
x1[c(2:3)]
x1[c(3:4)]
where x1 =
> m <- matrix(1:3,3,3)
> x1 <- list(m, m+1, m+2, m+3, m+4)
Thanks.
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2011 Sep 24
2
ncdf - install error
...location R_X86_64_32
against `.rodata' can not be used when making a shared object; recompile
with -fPIC
/usr/local/lib/libnetcdf.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [ncdf.so] Error 1
ERROR: compilation failed for package ?ncdf?
* removing ?/home/rahiz/R/x86_64-redhat-linux-gnu-library/2.13/ncdf?
The downloaded packages are in
?/tmp/Rtmp5khIxy/downloaded_packages?
Warning message:
In install.packages("ncdf") :
installation of package 'ncdf' had non-zero exit status
2009 Dec 20
3
Object of type 'closure' not subsettable
...file))/c
d2[[i]] <- file[[i]] - mean
Apparently, the following command is the source of the error.
d2[[i]] <- file[[i]] - mean
It works OK when I typed into the terminal the following after running
the script.
> for (j in 1:3) print (file[[j]]-mean)
Thanks.
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2009 Dec 02
2
Arithmetic on multiple files
...39;d like to perform arithmetic functions on 1000 files containing a
2000x2000 matrix. Can anyone advise?
For example,
File1 File2 Output
1 1 1 4 4 4 5 5 5
2 2 2 + 5 5 5 = 7 7 7
3 3 3 6 6 6 9 9 9
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2011 Jun 18
3
Array
Hi,
Can someone advise why the followind did not produce the array, given
the condition specified?
s <- 1
a1 <- array(dim=c(1,4))
a2 <- array(dim=c(2,4))
arr <- ifelse(s==0,a1,a2)
Thanks.
Muhammad
2012 Feb 14
3
execute array of functions
Hi all,
I'm trying to get the min and max of a sequence of number using a loop
like the folllowing. Can anyone point me to why it doesn't work.
Thanks.
type <- c("min","max")
n <- 1:10
for (a in 1:2) {
print(type[a](n)) }
--
Muhammad
2012 Oct 16
4
how to extract from list
Hi all,
I have a list of 20000 data, and the list look like below. I wonder what is
the simplest way to extract 'kappa' value (or 'xi' or 'alpha' for the
matter) from each of the data. How can I simply code it without having to
change the list to a dataframe first? Many thanks!
$X19997
xi alpha kappa
784.7718640 165.4065141 -0.2709599
$X19998
2010 Apr 22
3
using which to select range of values
Hi all,
I would like to get the array index for a range of values, say 0 < x <
1.5. I'm wondering if there is an alternative for the following which
I've done
x0 <- rnorm(100)
x1 <- ifelse(x0 > 0 & x0 < 1.5,"t","f")
x2 <- which(x1=="t",arr.ind=TRUE)
x0[x2]
Thanks.
--
Muhammad
2011 Jan 03
3
optimize
Hi all,
I'm trying to get the value of y when x=203 by using the intersect of
three curves. The horizontal curve does not meet with the
other two. How can I rectify the code below?
Thanks
Muhammad
ts <- 1:10
dd <- 10:1
ts <- seq(200,209,1)
dd <- c(NA,NA,NA,NA,1.87,1.83,1.86,NA,1.95,1.96)
plot(ts,dd,ylim=c(1.5,2))
abline(lm(dd~ts),col="blue",lty=2)
2009 Dec 20
1
Problem with sequence in loop
...<- lapply(list, read.table)
mean <- (Reduce("+", file))/3
}
When I call
> objects()
> list
[1] "2006.01.txt.h" "2006.02.txt.h" "2006.12.txt.h"
The listed files are the last files in the sequence.
Am I doing the loop correctly?
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2010 Jan 12
1
Drought Severity Index (DSI)
Does anyone have the code to calculate the drought severity index?
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment, University of Oxford
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: m...
2010 Jan 29
2
Create matrix with subset from unlist
Hello all,
I'm trying to create a 2x2 matrix, 32 times after unlist() so that I can
convert the list to matrix. I've looked through the R archive but
couldn't find the answer. There is what I've done.
> f <- system("ls *.txt", intern=TRUE)
> x <- lapply(f, read.table)
> x
[[1]]
V1 V2
1 -27.3 14.4
2 29.0 -38.1
[[2]]
V1 V2
1 14.4
2009 Dec 26
1
if else does not return right value
...means
the condition has length > 1 and only the first element will be used
The problem is solved if I use the ifelse function but I want to specify
the code as following;
if (/condition/) {
/statement 1a
statement 1b
/} else {
/statement 2a
statement 2b
/}
Thanks.
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.rahiz at...
2010 May 06
2
reading in file with different row length
Hi all,
I have a file, say, test.txt, which contains the following information.
I'm trying to read in the file and specifying the missing values as NA
so that each column has the same number of rows.
I've tried all sorts of manipulation but to no avail.
r1 r2 r3
1 3
2 3
3 2 3
4 2 3
5 2 3
6 2 3
7 2
8 2
9 2 3
The output should be
r1 r2 r3
1 NA 3
2 NA 3
3 2 3
4 2 3
5 2 3
6 2 3
7 2