Displaying 20 results from an estimated 1000 matches similar to: "integrating multi-dimensional dat along one dimension"
2011 Mar 29
3
passing arguments via "..."
I would like to do something like the following:
Fancyhist<-function(x,...) {
# first, process x into xprocess somehow, then ...
if (is.null(breaks)) { # yes, I know this is wrong
# define the histogram breaks somehow, then call hist:
hist(xprocess,breaks=breaks,...)
} else {
# use breaks give in calling argument
hist(xprocess,...)
}
}
But, those of you who know R better
2009 Dec 08
3
arrow plots
Am doing some vector plots with the arrows() function. Works well. But
what I need to do is supply an arrow for scaling for the reader. I need
to plot an arrow of some known magnitude somewhere on the page
(preferably outside the bounds of the plot, so that it can be seen
clearly) with some text underneath it that says, for instance, "10
kg-m/sec". Any ideas? Thanks.
2012 Aug 09
2
How to overlay a global map on a filled contour?
I would like to plot some lat-lon data in a filled contour, and then
overlay a map of the globe on top. I am trying something like this:
filled.contour(lons, lats, glb.data,
plot.axes={axis(1);axis(2);map(projection='rectangular',parameters=0,add
=T)}
)
The filled contour plots fine, and the map shows up, but only as a very
tiny little black rectangle in a small area of the
2009 Apr 08
1
vectors on top of contours, and lattice
OK, I needed to plot a set of vectors on top of a contour plot. I
figured out a way to do this. I create a panel function that calls
"larrows()" with arguments constructed from my vector data. Then, when
I go to do the contour plot, I call contourplot() with the "panel"
argument set to point to my newly created panel function.
So far, so good.
Now, I need to do a
2009 Apr 15
2
(hopefully) simple array op
I have a multidimensional array "a", for example,
> a
, , 1
[,1] [,2]
[1,] 1 3
[2,] 2 4
, , 2
[,1] [,2]
[1,] 5 7
[2,] 6 8
So a is 2x2x2.
I have another array "b", for example,
> b
[,1] [,2]
[1,] 9 11
[2,] 10 12
So b is 2x2.
I want to "tack" b onto a so that b becomes a new "plane", so to speak,
2009 Apr 16
1
weird error with contourplot
Sorry if I am cluttering up this list with too many rank beginner
questions. But I *am* a rank beginner, and I am at my wit's end with
this one:
I have a data frame df, with components x,y,z. This command to make a
contour plot with lattice graphics works just fine:
> contourplot(z~x*y,data=df,cuts=20)
Then I try
> contourplot(z~x*y,data=df,cuts=20,region=T)
And it dies on me with
2010 Nov 24
1
adding blocks to arrays
I have a four-dimensional array. I have a three-dimensional array I
want to add to it. My particular problem is conceptually very simple
because the new array is just going to go into the end of the 4D array;
i.e. will be added into the final index. I think I have seen an R
command that can do this in one shot, but for the life of me, I can't
find it again. Am I making this up, or is there
2011 Dec 14
1
JavaGD package
Am trying to install package JGR and, by necessity, JavaGD on a few
Linux platforms. R rev. 2.14.0. Had some success on one platform, but
am running into a problem on a new platform. I installed rJava, JavaGD,
iplots, and JGR. Things went - I thought - without a hitch. Now, when
I try to use JGR, I start R and issue the command "library(JGR)" and get
an error message:
Error in
2011 Dec 30
1
configure can't find readline -- but it's there!
Am trying to install 2.14.0 on a CentOS system. The configure script
apparently can't find something to do with the readline library:
Configure: error: --with-readline=yes (default) and headers/libs are not
available
Yes, I know I need readline 4.2 or later. "yum" assures me that rev 5.1
is already installed.
And I know I need to provide configuration flags if it is in
2011 Oct 31
1
troubles installing R
I am trying to install R on a pretty up-to-date CentOS system. I have
tried installing 2.14.0 and 2.13.2. In both cases, the configure step
fails, and does not produce a Makefile. So, of course, I can't issue
"make".
The errors that I can find in config.log are, first, several missing
files: ac_nonexistent.h, minix/config.h., readline/history.h, and
readline/readline.h.
Then,
2010 Jun 30
1
What is wrong with this code?
Here it is:
read.inputs<-function(infile) {
for (counter in 1:length(input.list)) {
seek(infile,where=0,origin='start')
newline<-readLines(infile,n=1)
while(length(newline)>0) {
if(!is.na(grep(as.character(input.list[[counter]][1]),newline)[1])) {
break
}
newline<-readLines(infile,n=1)
}
if (length(newline)>0)
2010 Apr 07
1
FW: fairly simple file I/O
OK, my apologies. I am sure this is a question that has been answered
before. But I have looked all over the web and can't find an answer for
it. I promise, wasting your time and bandwidth is my last resort.
So here goes:
I have an ASCII file formatted like so:
Label 1.1
Time 1
Label 1.2
Array of data from time 1
Label 2.1
Time 2
Label 2.2
Array of data from time 2
Label
2010 Sep 07
1
adding variable to netCDF file
I would like to open an existing netCDF file and add a variable to it.
I am using the ncdf package. This test code gives the idea of what I am
trying to do:
library(ncdf)
print('here we go')
print('first, construct netCDF file')
t<-dim.def.ncdf('t','',1:1,unlim=T,create_dimvar=F)
print('defining first vars')
2011 Oct 03
2
file input with readLines
I am using readLines to read a fairly large ASCII file. readLines reads
a fixed number of lines, then other R code processes the data, then
readLines reads the same number of lines again, then other R code
processes the data, then ....
Sort of like:
conn<-file('filename','r')
for (chunk in 1:100000) {
Lines<-readLines(conn,n=25)
# process "Lines"
}
2009 Mar 25
2
need help with ordering of plots
I want to do a series of contour plots, 4 in all. The data is coming
from a data frame named "nd.frame", which has elements "xdf", "ydf",
"zdf", and "pndt". I am treating "pndt" as a factor, and it has four
levels. I make a call to the lattice graphics routine "contourplot"
like so:
2011 Jan 17
1
how to cut a multidimensional array along a chosen dimension and store each piece into a list
Dear R-Helpers,
I wonder whether there is a function which cuts a multiple dimensional array
along a chosen dimension and then store each piece (still an array of one
dimension less) into a list.
For example,
arr <- array(seq(1*2*3*4),dim=c(1,2,3,4)) # I made a point to set the
length of the first dimension be 1to test whether I worry about drop=F
option.
brkArrIntoListAlong <-
2009 May 28
1
maximum over one dimension of a 3-dimensional array
Hi,
I'm running R 2.7.2 on windows XP. I'd like to find the maximum of a
3-d array over it's third index to create a 2-d array. For example:
> x <- array(c(1,2,3,10,11,12,3:8),c(2,3,2))
> x
, , 1
[,1] [,2] [,3]
[1,] 1 3 11
[2,] 2 10 12
, , 2
[,1] [,2] [,3]
[1,] 3 5 7
[2,] 4 6 8
> x1 <- x[,,1]
> x2 <- x[,,2]
>
2008 Feb 20
2
FLAC seeking error
I am writing a FLAC encoder/decoder and when I use the flac_static.lib
that was compiled in debug mode in MS Visual Studio 2003, the
seek_absolute function works fine. However, if I compile flac_static in
release mode in the same environment, the seek_absolute function no
longer works. No parts of my code change, the only difference is
whether I link in the release lib instead of the debug lib.
2012 May 08
6
registry vulnerabilities in R
Kirtland Air Force Base has denied approval for the use of R on its
Windows network. Some of their objections seem a bit strange, but some
appear to be legitimate. In particular, they have detected registry
"vulnerabilities"
which are detailed in the attachment.
I know nothing about Windows registry vulnerabilities. If any of these
issues are
legitimate concerns,
2011 Feb 18
6
sort a 3 dimensional array across third dimension ?
I'm attempting to sort a 3 dimensional array that looks like this
> x
, , 1
[,1] [,2]
[1,] 9 9
[2,] 7 9
, , 2
[,1] [,2]
[1,] 6 5
[2,] 4 6
, , 3
[,1] [,2]
[1,] 2 1
[2,] 3 2
Such that it ends up like this ....
> y
, , 1
[,1] [,2]
[1,] 2 1
[2,] 3 2
, , 2
[,1] [,2]
[1,] 6 5
[2,] 4 6
, , 3
[,1] [,2]