Displaying 11 results from an estimated 11 matches for "lenx".
Did you mean:
len
2004 Jun 23
2
Covered Labels
Dear All!
How can I cope with overlapping or covered labels (covered by labels
from other data points) in plots?
Martina Renninger
[[alternative HTML version deleted]]
2009 Dec 17
2
Which hist cell each value falls in?
Hi, all. I'm using hist() to obtain a vector of break values in an interval.
I then want to be able to identify which cell any value from another vector
falls in.
E.g. applying
> breaks
[1] -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0
to
> x
[1] -3.74519666 -0.38183630 -1.22884247 -0.20971824 -0.30533939 -0.36271207
[7] -2.27513499 -2.23688653 -1.98827155 -1.48666274
2011 Aug 01
2
if function problems
Dear All,
Sorry to bother
I want to write a function in R using if
Say I have a dataset x,
if x[i]<0, then x[i]=x[i],
if x[i]>0, then x[i]=0
for example, x=-3:3,
then using the function, x becomes [-3,-2,-1,0,0,0,0]
I write the codes as follows,
gjr=function(x)
{lena=length(x)
for(i in 1:lenx)
if (x[i]<0) return (x[i])
if (x[i]>0) return (0)
x}
but then, doing
gjr(x?
it only comes out with one number
Does anyone have any suggestions?
I appreciate a lot!
Sincerely,
Zoe
--
View this message in context: http://r.789695.n4.nabble.com/if-function-problems-tp3710995p3710995.html...
2006 Aug 11
2
Colour-coding intervals on a line
Hi,
This is a simple version of something that I am trying to do. If I can
sort the problem basically, I figure I should be able to sort it for the
program I'm writing (which would take longer to explain).
I need to know if there is any way of using different colours for
different intervals of a line on a graph. Eg. If I plot the line y=x for
x=1:10, and split this line into 106 intervals
2011 Sep 01
0
qqplot for count data
...on (x, y,
plot.it = TRUE, xlab = deparse(substitute(x)),
ylab = deparse(substitute(y)), x.counts=rep(1L,length.out=length(x)),
y.counts=rep(1L,length.out=length(y)), ...){
sx <- sort(x)
sy <- sort(y)
swx <- cumsum(x.counts[order(x)])
swy <- cumsum(y.counts[order(y)])
lenx <- length(sx)
leny <- length(sy)
sx <- approx(swx, sx, n=min(lenx,leny))$y
sy <- approx(swy, sy, n=min(lenx,leny))$y
if (plot.it)
plot(sx, sy, xlab = xlab, ylab = ylab, ...)
invisible(list(x = sx, y = sy))
}
#Sample example
n <- 15
a <- runif(n);b <...
2025 Jan 03
0
stats/HoltWinters.R inverted logic in seasonal in R and C
...dditive and 0 as
multiplicative.
The R seasonal can be "additive" or "multiplicative", so the R code must
invert the logic when calling C.
The proposed solution is to define a seasonalChoice variable:
hw <- function(x, alpha, beta, gamma, seasonal, start.time, f, ...) {
lenx <- length(x)
seasonalChoice <- if (seasonal == "multiplicative") 0L else 1L
.C(C_HoltWinters,
as.double(x),
lenx,
as.double(max(min(alpha, 1), 0)),
as.double(max(min(beta, 1), 0)),
as.double(max(min(gamma, 1), 0)),
as.integer(...
1998 May 29
0
aov design questions
...name
list(coefficients= coef, residuals = resid, effects = eff,
rank= dimx[2], fitted.values = fits, assign= assn,
cov.unscaled = D, df.residual = dimy[1] - dimx[2],
df = df )
}
print.aov <-
function (x, digits = max(3, .Options$digits - 3), ...)
{
lenx <- length(x$df)
tabl <- cbind(x$df,x$effects, x$effects/x$df)
tabl <- cbind(tabl,c(tabl[1:(lenx-1),3]/tabl[lenx,3],NA))
tabl <- cbind(tabl,1-pf(tabl[,4],tabl[,1],tabl[lenx,1]))
dimnames(tabl) <- list(names(x$effects), c("df","SS","MS","F...
2005 Dec 01
4
values in between
Hey there
I have two vectors:
y<- c(0.4, 0.0, 0.2, -0.2, -0.6, 0.2, 0.0, 0.0, 0.4, 0.4, 0.2)
In the vector y, I want to access (in the order given) all of the values in
between each of the specific values of given.
I understand subsetting with y[i], but how do I get to ssomewhere in
between -0.6 and 0.2?
Thanks
Eric Jennings
matheric at myuw.net
2017 Sep 21
4
List of occuring values
Dear all,
ftable produces a list of the frequencies of all occuring values.
But how about the occuring values?
How can I retrieve a list of occuring values?
How can I retrieve a table with both the list of occuring values and their respective frequencies?
Thank you in advance,
Yours, Ferri
2009 Nov 04
4
read.table (again)
Dear R commnuity,
Thanks a lot for your help.
I want to read in tables, the problem is that the table is composed in a
difficult way. In ariginal it looks like this:
669 736 842101610481029114711811166124312081128117611221026 9581024 992
685 720 829 925 995 96010241057116611501104106410711092 983 908 989 904
924 896 882 897 909 933 928 907 916 902
546 734 784 868 970 954
2002 Mar 18
3
function design
I have a, no doubt, simple question. I wish to write a function such
that
a <- 9
b <- 10
changer _ function(x,y) { if (y>x){ x <<- Y+1}}
Of course there are easier ways to accomplish the task above, but I am
more interested in how to have the "x <<- Y+1" part of the function to
change x in place for purposes of a much larger function.
I have been wrestling with