Displaying 20 results from an estimated 1000 matches similar to: "reverse array indexing"
2005 Jun 20
6
sweep() and recycling
Hi
I had a hard-to-find bug in some of my code the other day, which I
eventually
traced to my misusing of sweep().
I would expect sweep() to give
me a warning if the elements don't recycle nicely, but
X <- matrix(1:36,6,6)
sweep(X,1,1:5,"+")
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 2 9 16 23 30 32
[2,] 4 11 18 25 27 34
[3,] 6 13 20 22
2001 Nov 28
3
trellis plot
Hi,
I'd like to plot 4 groups of data using xyplot and panel.superpose so
that the points are overlayed on a single plot. For each group of data
I'd also like a loess smoothed function (using panel.loess). I have
tried the following:
xyplot(series ~ time | gr, data=etable,
panel = function(x,y, ...) {
panel.superpose(x,y, ...)
panel.loess(x,y,span=.15)
2009 Mar 06
1
array subsetting of S4 object that inherits from "array"
Hi,
I have an S4 class that inherits from "array" but does not add generic
implementations of the "[" method.
A simplified example is:
setClass("fooarray", contains="array")
If I create a "fooarray" object and subset it with a one-dimensional
index vector, the return value is of class "fooarray". Other variants
(see below), however,
2012 Aug 28
4
[ncdf4] error converting GEIA data to netCDF
summary: I can successfully ncvar_put(...) data to a file, but when I
try to ncvar_get(...) the same data, I get
> Error in if (nc$var[[li]]$hasAddOffset) addOffset = nc$var[[li]]$addOffset else addOffset = 0 :
> argument is of length zero
How to fix or debug?
details:
R code @
https://github.com/TomRoche/GEIA_to_NetCDF
successfully (if crudely) uses R packages={ncdf4, maps, fields}
2007 Jan 26
3
"[" operator and indexing ambiguity
Hi,
I am working on writing some S4 classes that represent
multidimensional (brain) image data. I would like these classes to
support standard array indexing. I have been studying the Matrix and
EBImage (http://www.bioconductor.org/packages/1.9/bioc/html/EBImage.html)
packages to see how this is done.
When using objects of the "array" class directly, R distinguishes
between the calls:
2012 Jan 05
1
[ncdf] programmatically copying a netCDF file
How to programmatically (i.e., without no or minimal handcoding) copy
a netCDF file? (Without calling
> system("cp whatever wherever")
:-) Why I ask:
I need to "do surgery" on a large netCDF file (technically an I/O API
file which uses netCDF). My group believes a data-assimilation error
caused a data variable to be corrupted in a certain way, so I'm going
to
2009 Sep 27
3
Teach me how to transpose in R
Hi guys,
I need your help!!
My goal is to make a csv file from ncdf file.
This is the code i've used :
> hyo=open.ncdf("C:/CRUTEM3.nc")
> hyo
[1] "file C:/CRUTEM3.nc has 4 dimensions:"
[1] "longitude Size: 72"
[1] "latitude Size: 36"
[1] "unspecified Size: 1"
[1] "t Size: 1916"
[1] "------------------------"
2005 Sep 28
3
is it possible to form matrix of matrices...and multiple arrays
Dear sirs,
1...........Kindly tell me is it possible to form a matrix which contains a no of matrices..
for eg..
if a,b,c,d are matrices....
and e is a matrix which contains a,b,c,d as rows and columns..
2..........Is it possible to form array of array of arrays
for eg..
"A" contains two set of arrays (1,2)...and each A[1] and A[2] individually contains two set of arrays
I tried like
2002 Jan 24
1
Re: coding factor replicates
How about this. Its not as 'swish' as Doug's response, but it might be a
little simpler to think about and adapt...
# show the test vector
> tmp
[1] A B C B C A C B A A B
Levels: A B C
>
# create a named vector to store the number of occurences of each level
> index <- numeric(length=length(levels(tmp)))
> names(index) <- levels(tmp)
> index
A B C
[1] 0 0
2002 Apr 02
2
label tickmarks in persp()-plot
Dear R-users,
is there a way to label the tickmarks other than persp does it? I didn't
find anything on that in the archive.
To plot the surface with equi-distant tickmarks, I assigned
x<-c(1:6)
y<-x
persp(x,y,z,....)
Instead of labels 1 to 6, I need something like 0.05, 0.1,10,15,100,1000.
Any hint and help appreciated,
Nina
2007 Jul 04
7
List delays
Is it just me? After the mail list server upgrade, the average delivery
time for messages to the users list is between 4 and 5 days. The Dev
list seems fine!
Doug
--
Ben Franklin quote:
"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
2011 Nov 01
4
building a subscript programatically
Hi,
On ocasion, you need to subscript an array that has an arbitrary
(ie. not known in advance) number of dimensions. How do you deal with
these situations?
It appears that it is not possible use a list as an index, for
instance this fails:
> x <- array(NA, c(2,2,2))
> x[list(TRUE,TRUE,2)]
Error in x[list(TRUE, TRUE, 2)] : invalid subscript type 'list'
The only way I know is
2002 Jan 23
6
multivariate simulation
To whom it may concern,
I try to simulate a non-normal multivariate distribution. The MASS package
allows by mean of "mvrnorm" command to perform a multivariate normal
simulation. Is there an equivalent command for an arbitrary multivariate
distribution available in the R-language?
Thank you in advance.
Bernard Colin
Colin Bernard
Professeur titulaire
D?partement de Math?matiques et
2008 Jul 09
1
netCDF to TIFF
Greetings R users!
I am working with the ENSEMBLE climate data (10 min resolution daily
temperatures images for all of Europe 1950-2006). The data comes
packaged in a single netCDF file. I would like to read the data in and
export a subset (2002-2006) as geotiffs (one image per day). So far, I
can successfully read in the data and view the images within an R
display window. However, I have yet to
2010 Dec 27
2
Finding indexes of minum and maximum elements of an array
Hello there
I wish to get the "coordinates" of the minimum element of an array.
For example, if the array were
> H = array(c(8:5,1:4),dim=c(2,2,2))
> H
, , 1
[,1] [,2]
[1,] 8 6
[2,] 7 5
, , 2
[,1] [,2]
[1,] 1 3
[2,] 2 4
then
> min(H)
[1] 1
and
> max(H)
[1] 8
Say "idx" were the function I'm looking for. Then, what
2007 Jun 29
3
awful list delays: 4 days!
Hello list,
I am getting the list with days of delay, take for example this message:
Received: from unknown (HELO lists.digium.com) (216.207.245.17) by
mxavas16.fe.aruba.it with SMTP; 29 Jun 2007 13:38:37 -0000
Received: from localhost ([127.0.0.1] helo=INXS.digium.internal) by
lists.digium.com with esmtp (Exim 4.63) (envelope-from
<asterisk-users-bounces at lists.digium.com>) id
2007 Dec 06
2
Any package for deconvolution?
I want to run deconvolution of a time series by an impulse or point-spread function through Wiener filter, regularized filter, Lucy-Richardson method, or any other approaches. I searched the CRAN website and the mailing list archive, but could not find any package for such a deconvolution analysis. Does anybody know an existing R function for deconvolution?
TIA,
Gang
2004 Jul 14
4
duplicate row importing issue
Hello,
I'm simply trying to import a .txt file that has a column of
about 30,000 pts. I found the file, but I'm getting an error:
> m <- read.table(choose.files())
Error in "row.names<-.data.frame"(`*tmp*`, value = row.names) :
duplicate row.names are not allowed
Any help with getting around this?
I really appreciate all the help.
Thanks
dave
2005 Mar 23
3
nested random effects
Hi
I am struggling with nested random effects and hope someone can help.
I have individuals (ID) who are nested within families (FAM). I want to
model an outcome variable, and take account of the intercorrelation of
individuals within each family.
I think this amounts to two random effects, one nested within the other.
How can I model this in R?
So far I have tried using the
2004 Jul 14
3
(no subject)
Hello,
I'm new to R, and I'm having trouble importing a text file (I'm
on Windows XP)
> m <- read.table("/Desktop/work/128_L")
Error in file(file, "r") : unable to open connection
In addition: Warning message:
cannot open file `/Desktop/work/128_L'
do you know why this isn't working? All I have is a bunch of text files,
each with a