Displaying 20 results from an estimated 10000 matches similar to: "extract element, row, etc from general array structure"
2001 Mar 28
4
How to extract every nth element from a vector
R-helpers:
Is there a simple way to extract every nth element from a very long vector?
[The vector I want to sample from is an object returned by lowess(). It is
so long (11,628 pairs of elements) that it is causing non-R-related memory
problems elsewhere. I don't see a better way other than sampling the output
returned from lowess.]
Thanks in advance.
Barry Cooke
2005 Jun 17
0
wapply from gplots -- How do I get a local estimate of variance?
Dear list,
I am trying to plot the local variance in a moving window on a
dataset. The function that I am trying to use for this is wapply from
gtools.
However, from the lattice panel function code:
<snip>
cat(x)
cat(y)
wapply(x,y,method="range",width=1/10,fun=sd,na.rm=TRUE) -> outvar
</snip>
I get:
<snip>
109 109 109 109 109 109 116 116 116 116 119 119 123
2002 Dec 18
6
Can I build an array of regrssion model?
Hi,
I am trying to use piecewise linear regression to approximate a
nonlinear function. Actually, I don't know how many linear functions I
need, therefore, I want build an array of regression models to automate
the approximation job. Could you please give me any clue?
Attached is ongoing code:
rawData = scan("c:/zyang/mass/data/A01/1.PRN",
what=list(numeric(),numeric()));
len =
2003 Jan 31
0
Version 0.8.0 of the gregmisc package is now available
Version 0.8.0 of the gregmisc package is now (or will shortly be) available
on CRAN.
New in this release:
- Enhanced and bug-fixed 'CrossTable' function (contributed by
Marc Schwartz)
- Augmented the 'barplot2' function with an 'add' argument to allow for
the addition of a barplot to an existing graphic. (contributed by
Marc Schwartz)
- Added the
2002 Dec 12
1
Read FWF, problem and solution?
Running R 1.6.1
Linux Slackware 8.1
233MHZ AMD-K6 96MB RAM
Using read.fwf, I tried to open a fixed-width file that of about 4 MB residing
in the working directory, using the command below:
dat<-read.fwf("sc01aai.dat", widths=fields$length)
where fields$lengths is a vector of column widths, 28 to be exact. The data
are a mix of character, text, and factor variables.
R started
2003 Feb 14
3
Change array size
Hi,
I would like to know if there is a way to change a vector of arbitrary size
to make it fits the nearest upper size multiple of a power of 2.
--
Cordialy
----------------------------------------
Emmanuel POIZOT
Cnam/Intechmer
Digue de Collignon
50110 Tourlaville
T?l : (33)(0)2 33 88 73 42
Fax : (33)(0)2 33 88 73 39
-----------------------------------------
2003 Dec 10
2
OT: BibTex year-only citation in text?
Sorry for the off-topic question, but I know there are some talented
LaTeX users out there. Which bibliography style gives only the year in
text citations (e.g "for further details, see Anderson (1992)" )?
Thanks
Jason
--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
jasont at indigoindustrial.co.nz
2014 Mar 30
0
New gem covering general validations on Arrays, Hashes etc.
Hi,
Recently, we released a v.0.0.2 of our gem 'Rails-Legit'. This allows a
clean interface to add validations for Arrays, Hashes and Time objects.
Check it out at https://github.com/code-mancers/rails_legit. Do open an
issue if anything breaks. Open to suggestions too!
Thank you
--
Kashyap
www.codemancers.com
--
You received this message because you are subscribed to the Google
2003 Oct 21
5
run R under linux
Dear all,
Our department uses the linux system and we are not allowed to submit job
directly. We must make a batch to submit through "qmon".
so, I make a foo.sh file, which only contains one line: nohup R --vanilla <
foo.txt > foo.results
foo is all my codes. It is a simulation of 200 times. I set the seed at the
beginning. It is to estimate the success probability, which is
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
??
> z <- array(1:24,dim=2:4)
> all.equal(f(z,3),f2(z,3))
[1] "Attributes: < Component ?dim?: Mean relative difference: 0.4444444 >"
[2] "Mean relative difference: 0.6109091"
In fact,
> dim(f(z,3))
[1] 2 3 4
> dim(f2(z,3))
[1] 3 4 2
Have I made some sort of stupid error here? Or have I misunderstood
what was wanted?
Cheers,
Bert
Bert Gunter
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
How about this:
f <- function(a,wh){ ## a is the array; wh is the index to be reversed
l<- lapply(dim(a),seq_len)
l[[wh]]<- rev(l[[wh]])
do.call(`[`,c(list(a),l))
}
## test
z <- array(1:120,dim=2:5)
## I omit the printouts
f(z,2)
f(z,3)
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into
2017 Jun 01
3
Reversing one dimension of an array, in a generalized case
Here is an alternative approach using apply(). Note that with apply() you are reversing rows or columns not indices of rows or columns so apply(junk, 2, rev) reverses the values in each column not the column indices. We actually need to use rev() on everything but the index we are interested in reversing:
f2 <- function(a, wh) {
dims <- seq_len(length(dim(a)))
dims <-
2003 Nov 01
2
Question about the high dimensional density estimation
Hi,
I found that the R package "KernSmooth" can deal with only 1D and 2D data. But now I have a collection of 4-dimensional data (x1,x2,x3,x4) and would like to estimate the "mode" of the underlying density. What can I do about it ?
Thanks a lot.
--
Ying-Chao Hung
Assistant Professor
Graduate Institute of Statistics
National Central University
Chung-Li, Taiwan
TEL:
2017 Jun 01
5
Reversing one dimension of an array, in a generalized case
Hi All:
I have been looking for an elegant way to do the following, but haven't found it, I have never had a good understanding of any of the "apply" functions.
A simplified idea is I have an array, say:
junk(5, 10, 3)
where (5, 10, 3) give the dimension sizes, and I want to reverse the second dimension, so I could do:
junk1 <- junk[, rev(seq_len(10), ]
but what I am
2013 Jan 12
1
How to extract value for specific rows in an array?
Hi everyone,
I have a dataset that contains depths measurements every 30 sec for several
days.
The subset of data that I am working on looks like this:
Date Day Depth
18442.00 29 41.0
18442.00 29 43.5
...
18442.04 29 40.3
18442.04 29 35.1
...
18443.00 30 16.5
...
Since my data is collected
2002 Mar 17
2
using "by" and indicies
I sent this to the list last week, and haven't seen it pop up. Either
I deleted it when it did appear, or possibly it was destroyed as
spam...? If it did appear and I somehow missed it, appologies.
In a nutshell, can the function FUN supplied to by() deduce
what level of factor by() was on when FUN was called? I've
been digging through the functions, and can't see where the
2003 Dec 21
3
Sweave/LaTeX Problem with EPS PDF
Dear List:
I am unsure if my problem is with Sweave or LaTeX. Anyhow, I am using the MikTeX distribution and TexnicCenter.
I can easily create Sweave files and all goes well until I try to incorporate graphics. I use the same code as found in the examples found in the users manual.
In R, the graphics I want are created as Sweave is creating the .tex file. When I examine the .tex file
2003 Dec 04
4
bug in as.POSIXct ?
I think that there is a bug in the as.POSIXct function on Windows.
Here is what I get on Win2000, Pentium III machine in R 1.8.1.
> dd1 <- ISOdatetime(2003, 10, 26, 0, 59, 59)
> dd2 <- ISOdatetime(2003, 10, 26, 1, 0, 0)
> dd2 - dd1
Time difference of 1.000278 hours
Now, the 26th of October was the day that change to the standard time
occurred, so I suspect that this has
2001 Sep 09
1
[R] bad R.css link in "packages.html" (PR#1090)
I downloaded and installed R-1.3.1 yesterday, and had to change line
2 of the "packages.html" file in $RHOME/doc/html/
The configuration steps were "the usual",
tar zxvf ...
cd ...
./configure
make
make check
make install
If it's relevant,
Sys.info()
sysname release
"Linux" "2.2.14"
2017 Jun 01
0
Reversing one dimension of an array, in a generalized case
Thanks to all for responses/. There was a question of exactly what was wanted. It is the generalization of the obvious example I gave,
>>> junk1 <- junk[, rev(seq_len(10), ]
so that
junk[1,1,1 ] = junk1[1,10,1]
junk[1,2,1] = junk1[1,9,1]
etc.
The genesis of this is the program is downloading data from a variety of sources on (time, altitude, lat, lon) coordinates, but all