Displaying 20 results from an estimated 367 matches for "oceanographi".
Did you mean:
oceanography
2010 Sep 05
1
Greek symbols (again but more complicated)
Hi.
I'm trying to get 'mu' to show up as a Greek symbol but, despite trying every example I could find, can't get it to work. Any insights would be welcome.
This is what I'm using that works, but displays mu with the letter u.
plotTimeXMastPAR <- qplot(DT,MastPAR, data=A, xlab = "", ylab = quote(PAR (uE ~m^-2 ~s^-1)), geom="line") +
2005 Nov 17
3
changing figure size in Sweave
Hi
In Sweave, how does one change the size of the plots?
I tried using a hook:
<<echo=FALSE, print=FALSE, fig=TRUE>>=
options(SweaveHooks=list(fig=function() ps.options(width=1)))
library(graphics)
pairs(iris)
@
but this didn't change the size of the figure. How to make the
figures a
different size?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre,
2007 Oct 22
1
question on axis box with asp=1
...plot(c(1,2),c(3,4),yaxp=c(3,4,1),asp=1)
or
plot(c(1,2),c(3,4),yaxp=c(3,4,1),asp=1,yaxs="i")
and these agreeably let me control the range of numbers on the axis,
but the frame still extends outside the desired region. (At this
point, I can explain why I care ... I'm drawing oceanographic data,
and it makes no sense to have an axis frame that goes to the north of
90N or the south of 90S.)
Is there a way that I can, perhaps, make the upper and lower margins
be "stretchable", as one would say in the TeX world? That would seem
to be a clean solution to my problem....
2006 Sep 13
3
functions and strings
Hi
If
string <- "xyz"
f <- function(x){1 + sin(cos(x)) + exp(x^2)}
How do I manipulate "string" and f() to give the string
"1 + sin(cos(xyz)) + exp(xyz^2)"
?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
2008 Aug 01
5
viewing data in something similar to 'R Data Editor'
Hi,
I would like to view matrices I am working with in a clean, easy to read,
separate window.
A friend showed me how to do something like I want with edit(). I can view
the matrix in the 'R Data Editor':
For a sample matrix:
> mat=matrix(1:15,ncol=3)
> mat
[,1] [,2] [,3]
[1,] 1 6 11
[2,] 2 7 12
[3,] 3 8 13
[4,] 4 9 14
[5,] 5 10 15
2006 Feb 22
3
elements that appear only once
Hi.
I have a factor and I want to extract just those elements that appear
exactly once.
How to do this?
Toy example follows.
> a <- as.factor(c(rep("oak",5) ,rep("ash",1),rep("elm",1),rep
("beech",4)))
> a
[1] oak oak oak oak oak ash elm beech beech beech beech
Levels: ash beech elm oak
> table(a)
a
ash beech elm oak
2008 Mar 26
5
S4 slot with NA default
Hi
How do I specify an S4 class with a slot that is potentially numeric,
but NA
by default? I want the slot to be NA until I calculate its value
(an expensive operation, not needed for all applications). When
its value is
known, I will create a new object with the correct value inserted in
the slot.
I want "NA" to signify "not known".
My attempt fails because
2007 Mar 19
3
character to numeric conversion
Hi.
Is there a straightforward way to convert a character string
containing comma-delimited
numbers to a numeric vector?
In my application, I use
system(executable.string, intern=TRUE)
which returns a string like
"[0.E-38, 2.096751179214927596171268230,
3.678944959657480671183123052, 4.976528845643001020345216157,
6.072390165503099343887569007, 7.007958550337542210168866070,
2004 Jun 11
4
rownames of single row matrices
Hi
I want to extract rows of a matrix, and preserve rownames even if only
one row is selected. Toy example:
R> a <- matrix(1:9,3,3)
R> rownames(a) <- letters[1:3]
R> colnames(a) <- LETTERS[1:3]
R> a
A B C
a 1 4 7
b 2 5 8
c 3 6 9
Extract the first two rows:
R> wanted <- 1:2
R> a[wanted,]
A B C
a 1 4 7
b 2 5 8
rownames come through fine. Now extract just
2005 Jan 07
1
Visualizing complex analytic functions using domain coloring
Hi
has anyone coded up domain colouring for visualizing complex analytic
functions
(such as elliptic functions)?
[
the idea is to depict a complex function f(z) using a filled.contour()
variant
in which the hue is given by Arg(f(z)), and the saturation by Mod(f(z)).
]
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
tel
2011 Sep 07
3
Editing the variables attributes section in the netCDF header of netCDF files created using the package ncdf.
Hi,
I am using the package ncdf to create netCDF files and I want to mimic the the header of an exiting netCDF file created outside of R. Below is what the existing header looks like (part of it that is different):
netcdf ccd1984_05_08 {
dimensions:
lat = 1974 ;
lon = 1894 ;
time = UNLIMITED ; // (1 currently)
variables:
int time(time) ;
2008 Jun 10
3
fitting periodic 'sine wave' model
I have been attempting to estimate the periodic contribution of an
effect to some data but have not been able to fit a sine wave within R.
It would be nice to start by being able to fit a sine wave with an
amplitude and frequency.
x<-seq(0,20,by=0.5)
y<-2*sin(2*pi*.5*x) #amplitude =2, frequency=0.5
# This failed to converge
r<-nls(y ~ A*sin(2*pi*F*x), start=list(A = 1, F = 1),
2006 Jul 27
4
inserting rows into a matrix
Hi
I have a little vector function that takes a vector A of strictly
positive integers
and outputs a matrix M each of whose columns is the vector, modified in
a complicated combinatorical way.
Now I want to generalize the function so that A can include zeroes.
Given A,
I want to strip out the zeroes, pass it to my function, and pad M
with rows at positions corresponding to the zeroes
2006 Feb 28
2
lines() and recycled colours
Hi
?lines says
For 'type = "h"', 'col' can be a vector and will be recycled as
needed.
Why doesn't lines() recycle colours for other types?
If I type
> plot(0:1,0:1,type="n")
> lines(runif(11),runif(11),col=c("red","green"))
>
then all ten lines are red, with no warning given. Is there a reason
why
2004 Jun 15
2
S/R/RWeb/ODBC
I'm looking for an optimal approach to access Oracle databases via RWeb
applications. I'm new to R but familiar with programming functions and web
pages for the S+ Statserver. I'm now going through the motions of migrating
S+/Statserver applications to R/RWeb as a feasability exercise. I can access
databases using ODBC directly in R or S, and using Statserver, but I have
not succeeded
2005 Jan 05
4
output from table() in matrix form
Hi
How do I get the output from table() in matrix form?
If I have
R> table(c(1,1,1,1,2,20))
1 2 20
4 1 1
I want
[,1] [,2] [,3]
[1,] 1 2 20
[2,] 4 1 1
The problem is that names(table) is a vector of characters and I need
the numeric values.
I am using
R> rbind(as.integer(names(x)),x)
I thought tabulate() might be better as it takes an
2006 Oct 13
5
combinatorics
Hi
How do I generate all ways of ordering sets of indistinguishable items?
suppose I have two A's, two B's and a C.
Then I want
AABBC
AABCB
AACBC
ABABC
. . .snip...
BBAAC
. . .snip...
CBBAA
[there are 5!/(2!*2!) = 30 arrangements. Note AABBC != BBAAC]
How do I do this?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14
2007 Jan 16
5
"[[" gotcha
The following gotcha caught me off-guard just now.
I have two matrices, a and b:
a <- matrix(1,3,3)
b <- matrix(1,1,1)
(note that both "a" and "b" are matrices).
I want them in a list:
> B <- NULL
> B[[1]] <- a
> B[[2]] <- b
> B
[[1]]
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 1 1 1
[3,] 1 1 1
[[2]]
[,1]
[1,] 1
2006 Jul 25
2
pari/gp interface
Hi
I'm developing an R package that
needs to execute some code written in pari/gp.
I've used this before from an R package (elliptic) but the interface
is very
basic: the R function creates a string such as the following:
string <- echo ' ellwp ([ 2+0*I , 0+2*I ], 1+0*I )' | gp -q
And then
system(string)
returns the output from gp which then needs to be text processed
2009 Aug 19
4
Confidence interval on parameters from optim function
Hi everyone,
I have two questions:
I would like to get confidence intervals on the coefficients derived
from the optim() function.
I apply optim() to a given function f
> res <-
optim(c(0.08,0.04,1.),f,NULL,method="L-BFGS-B",lower=c(0.,0.,0.))
And I would like to get the p-value and confidence intervals associated
with
> res$par
My second question deals with error message. I