Displaying 20 results from an estimated 20000 matches similar to: "Arguments to "personalised" plot()"
2012 Apr 13
2
Can't read a binary file
Hi, I've read up on readBin() and chapter 6 in the R Data Import/Export manual, but I still can't read a binary file. Here is how the creator of the file described the code that would be needed in Fortran:
"Every record has a return in fortran. The length of each record is nx*ny*4. To read you would use the following:
nlayx = nx*ny*4
do iz=1,nz,4
read(binary file) var(1:nlayx)
2001 Apr 30
2
plotting an expression
I am sure it is just me not understanding how R works, but could somebody
explain why
curve(cos(x))
works and
curve(expression(cos(x))
does not?
I have done some investigating and here is what I found. If I comment out
the line of curve indicated below, both calls work fine.
function (expr, from, to, n = 101, add = FALSE, type = "l", ylab = NULL,
log = NULL, xlim =
2010 Aug 27
2
Nestad ANOVA with random Factors
Hi,
I need a help. I am new in R and I need to run a nested anova with fixed and
random factors (Mixed Model). I have a design with three factors: Day, Area
and Plot and the dependent variable is density. The factors Day and Area are
fixed while Plot is random, factor Area is nested in factor Day, and factor
Plot is nested in Area.
I can do it using aov by:
mod1<-aov(density~ day +
2006 Oct 07
1
random point in a circle centred in a geographical position
Dear List members
I am trying to find a way to generate a random point in a circle centred in a geographical location.
So far I have used the following formula (see code below):
random_x = original_x + radius*cos(angle)
random_y = original_y + radius*sin(angle)
where radius is a random number between 0 and the radius of the circle and
angle is between 0 and 360 degrees
The code bellow works
2005 Mar 29
1
strange result of acos
Hi all,
I have to calculate an expression using acos -function. A strange
result of acos appears
*1. case with error*
ss <- sin(10.74*pi/180)**2
+(cos(10.74*pi/180)*cos(10.74*pi/180)*cos(0*pi/180))
ss
acos(ss)
[1] NaN
Warning message:
NaNs produced in: acos(ss)
*2. case without error*
ss <- sin(10.7*pi/180)**2
+(cos(10.7*pi/180)*cos(10.7*pi/180)*cos(0*pi/180))
ss
acos(ss)
2005 Nov 07
1
Newbie on functions
Hi,
I'm trying to write a simple function like
case1 <- function (m, cov, Q, R) {
theta <- (acos(R/sqrt(Q^3)))
beta <- (-2)*sqrt(Q)*cos(theta/3)+m[1]/3
rho1 <- (-2)*sqrt(Q)*cos((theta+2*pi)/3)+m[1]/3
rho2 <- (-2)*sqrt(Q)*cos((theta-2*pi)/3)+m[1]/3
stderrb <- deltamethod( ~(-2)*sqrt(Q)*cos(theta/3)+x1/3,m,cov)
stderrr1 <- deltamethod(
2007 May 15
1
legend with mixed boxes and lines (not both)
Hi,
I seem to be unable to get a mixed legend that has lines *or* polygons
(not both). For example:
ppi <- seq(0,2*pi,length.out=21)[-21]
frame()
plot.window(ylim=c(-5,5),xlim=c(-5,5),asp=1)
polygon(cos(ppi)*4+rnorm(20,sd=.2),sin(ppi)*4+rnorm(20,sd=.2),
col="green",border=FALSE)
polygon(cos(ppi)*2+rnorm(20,sd=.1),sin(ppi)*2+rnorm(20,sd=.1),
col="blue",border=FALSE)
2010 Feb 20
1
Add lines (contours) to lattice wireframe plot
Hi,
I draw a surface corresponding to bivariate density of independent
variables (rho=0) using persp(). Then I add a contour line (i.e.,
circle in my case) at a particular density. Below is a minimal example
of what I have so far.
# Bivariate density
dnorm2d <- function(x, y, rho = 0) {
xoy = (x^2 - 2 * rho * x * y + y^2)/(2 * (1 - rho^2))
density = exp(-xoy)/(2 * pi * sqrt(1 - rho^2))
2009 Sep 03
1
Output from as.windrose() in oce package baffles me
I'm having trouble understanding the output from as.windrose(). For one
thing, data on a boundary between sectors seem to be left out of the
counts. I assume that explains the missing point in the output below
(angle 45). Shouldn't one side of each sector interval be open, to
include values such as my 45 in the example? Also, why does the angle
180 in my input apparently not result in
1999 Oct 05
3
problem with outer and image
I want to make a picture of a cos wave grating (pattern of fuzzy stripes).
First I try to make a plot of a cos wave:
x<-seq(1:100)
y<- 10*cos(2*pi*x*3/length(x)+0)+300
plot(x,y)
That works fine. 3 cycles of cos wave. Now try for grating.
time<-seq(1:100)
f<-function(x,time) 10*cos(2*pi*x*3/length(x)+0)+300
z<-outer(x,time,f)
image(x,time,z)
I get a vertical grating as expected, BUT
2016 Dec 01
2
Different results for cos,sin,tan and cospi,sinpi,tanpi
Hi,
i try sin, cos, and tan.
> sapply(c(cos,sin,tan),function(x,y)x(y),1.23e45*pi)
[1] 0.5444181 0.8388140 1.5407532
However, *pi results the following
> sapply(c(cospi,sinpi,tanpi),function(x,y)x(y),1.23e45)
[1] 1 0 0
Please try whether the following becomes all right.
diff -ruN R-3.3.2.orig/src/nmath/cospi.c R-3.3.2/src/nmath/cospi.c
--- R-3.3.2.orig/src/nmath/cospi.c 2016-09-15
2010 Dec 20
2
Sine Regression in R
Hi everyone,
I am trying to fit a sine function on one year of wind data. I have two
questions below.
Looking around on the net I managed to get the following:
Sine Equation: y = a + b * sin( c + d*x )
b is the amplitude, c is the phase shift, d is something deal with
periodicty of data*.*
This can be linearised by sin( c+dx ) = cos(c) * sin(dx) + sin(c) *
cos(dx).
If one calls dx = x1
y
2007 Apr 03
1
which points within an ellipsoid? Sorting data in 3d
Hello,
in a three dimensional coordinate system, I'd like to find all my
experimental data points that fall within an ellipsoid around a fixed
coordinate. The fixed point is defined by (x.coord.point,
y.coord.point, z.coord.point). The coordinates of the ellipsoid are
given by the three vectors x,y,z.
In a previous version of my code, I simply used a box instead of an
ellipsoid to sort
2009 Oct 31
3
Plots with k-means
Hi,
I'm doing a k-means cluster with 6 clusters and 15 variables. Any
suggestions on how to plot the results?
I've tried the standard xy plot, but couldn't get much of it.
Thansk in advance,
Iuri.
2005 May 23
1
comparing glm models - lower AIC but insignificant coefficients
Hello,
I am a new R user and I am trying to estimate some generalized linear
models (glm). I am trying to compare a model with a gaussian
distribution and an identity link function, and a poisson model with
a log link function. My problem is that while the gaussian model has
significantly lower (i.e. "better") AIC (Akaike Information
Criterion) most of the coefficients are not
2012 Aug 12
2
"Masked by GlobalEnv"
hello everyone,
i am getting problems in graph plotting. When i attach file after adding
color attributes in my data set. i got problem of "GlobalEnv" and masked
the followings. Like this
>attach(machm)
The following object(s) are masked _by_ '.GlobalEnv':
coll, sp
The following object(s) are masked from 'mach':
angle, area, dis, plot, sp
2012 Mar 16
3
Cosinor
Hola, ¿qué tal?:
Tengo la siguiente duda:
Para el caso del Cosinor Simple:
Y = M + A * cos(2*pi*t/T + phi) + error
Cuando T conocido, podemos asumir:
Y = M + beta * X1 + gamma * X2 + error,
siendo X1 = cos(2*pi*t/T) y X2 = sin(2*pi*t/T)
En este caso (Cosinor simple) el modelado lo llevo a cabo del siguiente modo:
lm( y ~ X1 + X2)
Para el caso de componentes múltiples:
Y = M + ?Aj *
2009 Jul 14
4
Trig functions strange results
I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following
Browse[1]> direction[i]
[1] -1.570796
Browse[1]> cos(direction[i])
[1] 6.123032e-17
Browse[1]> cos(-1.570796)
[1] 3.267949e-07
Browse[1]> direction[i]
[1] -1.570796
Browse[1]> cos(direction[i])
[1] 6.123032e-17
Browse[1]> cos(-1.570796)
[1] 3.267949e-07
2020 Oct 23
2
3d plot of earth with cut
Dear All,
Thanks a lot for the useful help again. I manage to get it done up to a
point where I think I
just need to apply some smoothing/interpolation to get denser points, to
make it nice.
Basically, I started from Duncen's script to visualize and make the
clipping along a plane
at a slice.
Then I map my data points' values to a color palette and just plot them as
points on this
plane.
2010 Jul 19
5
par("uin") ?
I inherited a function written either for an older version of R or SPlus
to draw a brace, "{", in a graph. It uses par("uin") to determine the
scaling of the
quarter circles that make up segments of the brace, but that setting
doesn't
exist in current R.
I'm guessing that, in the function below, ux, uy can be defined from
par("usr") and