similar to: create an array with rep

Displaying 20 results from an estimated 10000 matches similar to: "create an array with rep"

2006 May 12
3
Maximum likelihood estimate of bivariate vonmises-weibulldistribution
Thanks Dimitris!!! That's much clearer now. Still have a lot of work to do this weekend to understand every bit but your code will prove very useful. Cheers, Aziz -----Original Message----- From: Dimitrios Rizopoulos [mailto:Dimitris.Rizopoulos at med.kuleuven.be] Sent: May 12, 2006 4:35 PM To: Chaouch, Aziz Subject: RE: [R] Maximum likelihood estimate of bivariate
2007 Jul 23
1
code optimization tips
Hi, Being new to R I'm asking for some advice on how to optimize the performance of the following piece of code: > alpha_c <- function(lambda=600e-9,alpha_s=1e-14,N=400,spacing=1e-7){ > > k<-2*pi/lambda > ri<-c(0,0) # particle at the origin > x<-c(-N:N) > positions <- function(N) { > reps <- 2*N+1 > matrix(c(rep(-N:N, each = reps), rep(-N:N,
2009 Jan 13
5
indexing question
Hi all, i have a pretty easy indexing question, at least i believe so. The main reason i post it here, is that brackets and $ are hard to google. How do I index correctly, if i just want to display the whole dataset conditioned on the fact that some particular column equals one. I know i can do something like: data$somecolumn[data$particularcol ==1] . That will show all "some
2008 Jul 25
3
Help with rep
Hi Is it possible to use the rep command (or maybe some other "shortcut") to create a vector with the following format: 4 3 4 2 3 4 1 2 3 4 Any help is much appreciated. Thanks Jacob Jacob L van Wyk Department of Statistics University of Johannesburg, APK Box 524 Auckland Park 2006 South Africa Office Tel: +27 11 559 3080 Fax: +27 11 559 2832 [[alternative HTML version
2005 Sep 25
2
getting variable length numerical gradient
Hi all. I have a numerical function f(x), with x being a vector of generic size (say k=4), and I wanna take the numerically computed gradient, using deriv or numericDeriv (or something else). My difficulties here are that in deriv and numericDeric the function is passed as an expression, and one have to pass the list of variables involved as a char vector... So, it's a pure R programming
2006 Nov 09
4
Plotting symbols with two positions?
Thanks a lot to Demitris for a prompt answer some minutes ago on another tread (see below). To avoid excess mails on the list, I move onto next question: I have another small plotting problem that confuses me. I want to plot results from a field trial series, using the numbers of the trials as symbols in the plot. pch = as.character(trial_no) works fine, but truncates the trial number to the
2006 Mar 02
2
'...' passed to both plot() and legend()
Dear R-devels, I'd like to create a plot method for a class of objects that passes the '...' argument to both plot() and legend(), e.g., x <- list(data = rnorm(1000)) class(x) <- "foo" plot.foo <- function(x, legend = FALSE, cx = "topright", cy = NULL, ...){ dx <- sort(x$data) plot(dx, dnorm(dx), type = "l", ...) if (legend)
2006 Jun 16
3
Vector Manipulation
I have a vector that has 1,974 elements and each element is one of the following (B, F, N, Y). How do I recreate that vector accept in the place of N put 0 and in the place of B, F or Y put a 1? Thanks, Jacob [[alternative HTML version deleted]]
2006 Aug 16
1
list to balanced array
I am working with a large data set of arrivals, for each day I have aggregated the arrivals into hrs (1-24) via: apply(x,2,table). On some days there are zero arrivals during some hours of the day, this leaves me with (I believe) a list of vectors of differnt lengths (see below). [[4]] 1 2 3 5 6 8 9 10 11 13 14 15 16 17 18 19 20 21 22 23 24 1 3 2 3 1 1 2 3 4 4 4 3 2 6
2008 Apr 09
4
apply lm() for all the columns of a matrix
Hi all, My question is not really urgent. I can write a loop and solve the problem. But I know that I'll be in a similar situation many more times so it would be useful to find out the answer Is there a fast way to perform linear fit to all the columns of a matrix? (or in the one dimension of a multi-dimensional array.) I'm talking about many single linear fits, not about a multiple fit.
2005 Jan 21
2
chi-Squared distribution in Friedman test
Dear R helpers: Thanks for the previous reply. I am using Friedman racing test. According the the book "Pratical Nonprametric Statistic" by WJ Conover, after computing the statistics, he suggested to use chi-squared or F distribution to accept or reject null hypothesis. After looking into the source code, I found that R uses chi-sqaured distribution as below: PVAL <-
2007 Jan 21
5
Integration + Normal Distribution + Directory Browsing Processing Questions
Hi everyone, I am new to R, but it's really great and helped me a lot! But now I have 2 questions. It would be great, if someone can help me: 1. I want to integrate a normal distribution, given a median and sd. The integrate function works great BUT the first argument has to be a function so I do integrate(dnorm,0,1) and it works with standard m. and sd. But I have the m and sd given.
2004 Aug 26
5
GLMM
I am trying to use the LME package to run a multilevel logistic model using the following code: ------------------------------------------------------------------------ ------------------------------------------- Model1 = GLMM(WEAP ~ TSRAT2 , random = ~1 | GROUP , family = binomial, na.action = na.omit ) ------------------------------------------------------------------------
2005 May 19
2
plot question
hi all: xlim and ylim are used to define the interval limits of a plot. I'm interested in the scale of values between this limits. suppose xlim=c(0,10) we can have e.g. 0 5 10 0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10 which is the parameter that allows me to modify this? thanks in advance alexandre
2005 Jan 21
2
chi-Squared distribution
Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 ..... 1 1.323
2009 Mar 09
3
How to write a function that accepts unlimited number of input arguments?
Dear R-helpers: I am an R newbie and have a question related to writing functions that accept unlimited number of input arguments. (I tried to peek into functions such as paste and cbind, but failed, I cannot see their codes..) Can someone kindly show me through a summation example? Say, we have input scalar, 1 2 3 4 5 then the ideal function, say sum.test, can do
2009 Apr 16
3
segment between points on different plots
Hi, I need to draw a line segment between two points on different plots in the same multigraph.I've tried looking at the zoominplot function in plotrix but havent understood much.any help is appreciated ~Aks [[alternative HTML version deleted]]
2006 May 29
2
newbie question: ROW average
Dimitris Rizopoulos wrote: > look at ?rowMeans; you can also use "apply(mat, 1, mean)" but > rowMeans() is better. By my reading of the question, this is not what Ezhil wants. He said: ``I have a 992 x 74 matrix. I would like to form a new matrix by averaging each 4 rows from the original one.'' I.e. he wants (I think) the first row of the new matrix to be the
2008 Jun 17
5
How to control height of abline
I use matplot to get the density curve and then I use abline(v=g$V2, col = 3 ) to get the vertical line. Goal : I want very small lines at the bottom on the x axis , if possible in the arrow forms instead of vertical lines on the whole graph. Thanks a lot. [[alternative HTML version deleted]]
2009 Sep 04
3
How to print a variable with in double quotes
I want to print a variable with in double quotes. For example x = 10 ; x ; #prints 10 "x" ; #prints x \"x\" ; # Error: unexpected input in "\" I want to the out put as '10' or "10" Thank you Sailu Yellaboina