similar to: list to balanced array

Displaying 20 results from an estimated 10000 matches similar to: "list to balanced array"

2007 Jul 22
3
create an array with rep
Hi, I want to make the following array of numbers: -3 -3 -3 -3 -3 -3 -3 -2 -2 -2 -2 -2 -2 -2 ... 3 3 3 3 3 3 3 -3 -2 -1 0 1 2 3 -3 -2 -1 0 1 2 3 ... -3 -2 -1 0 1 2 3 (3 would be N, a painful example to type number). Here is my dirty attempt to do it, > N<-3 > > x<-c(-N:N) > > rj<-rbind(matrix(outer(matrix(1,1,2*N+1),x),nrow=1),rep(x,2*N+1)) > It
2005 Apr 19
2
indexing an array using an index-array, but one entry being ', '
Hi I have the following array: test <- array(c(1:16), dim = c(3,4,3)) test ## I call some enries using an index array test.ind <- array(rbind(c(1,2,1), c(3,3,2)), dim = c(2,3)) test[test.ind] ## suppose I want all values in the 2nd row and 4th col over ## all three 3rd dimensions test[2,4,] how to specify a test.ind array with the last index left with ',' i.e test.ind should be
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
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.
2006 Jan 10
2
Correct way to test for exact dimensions of matrix or array
Dear R Users, I want to test the dimensions of an incoming vector, matrix or array safely and succinctly. Specifically I want to check if the unknown object has exactly 2 dimensions with a specified number of rows and columns. I thought that the following would work: > obj=matrix(1,nrow=3,ncol=5) > identical( dim( obj) , c(3,5) ) [1] FALSE But it doesn't because c(3,5) is numeric
2006 Apr 05
5
List to Array
Hi, this is probably the easiest thing to do but I manage not finding the answer: I have a list with matrices of exact same format and headers. Now I would like to transform the list into an normal array. What is the proper way to do this? as.array changes the entire format and right now I only found the method of creating a new array, going through the entire list and copy the matrix in each
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)
2005 Feb 17
3
A vector or array of data frames
Hi A simple question again, but I can't find it by google-ing R-help. Quite simply, I want to read in the contents of a number of files, using read.table, and assign the results to elements of a vector/array/list/whatever. I want it so that, if my vector/array/whatever is "pos", that pos[1] will give me the first data frame, pos[2] will give me the second etc... Kind of basic
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]]
2007 May 20
2
Number of NA's in every second column
Hi R-users, How do I calculate a number of NA's in a row of every second column in my data frame? As a starting point: dfr <- data.frame(sapply(x, function(x) sample(0:x, 6, replace = TRUE))) dfr[dfr==0] <- NA So, I would like to count the number of NA in row one, two, three etc. of columns X1, X3, X5 etc. Thanks in advance Lauri [[alternative HTML version deleted]]
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 Oct 05
2
problem accumulating array within a function over loops
Dear R helpers, I am having trouble with an array inside a loop. I wish to accumulate the results of a function in an array within the function, over several loops of a program outside the function. The problem is that the array seems to re-set at every entry to the function. Here is an example, so you can see what I mean.
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
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.
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
2008 Jan 02
2
Multivariate response methods question
Hi Everyone, I have some data that predicts both a nominal and ordinal response variable. I was wondering what packages in R would help me analyze the data? I was also curious if anyone could recomend me some textbooks that would help with the analysis of such data? I have the 5th edition of "Applied Multivariate Statistical Analysis" by Richard A. Johnson and Dean W. Wichern
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
2007 May 09
2
pvmnorm, error message
Hello there! My operating system is Windows XP, my version of R is the latest (R-2.5.0). Recently I have downloaded the package "mvtnorm" and a problem with the command "pmvnorm" occured. Trying to enter the lines ... A <- diag(3) A[1,2] <-0.5 A[1,3] <- 0.25 A[2,3] <- 0.5 pvmnorm(lower=c(-Inf,-Inf,-Inf), upper=c(2,2,2),mean = c(0,0,0), corr=A) I got the following
2007 Feb 22
3
List filtration
Hello R-ologists, Imagine you have a list "list" like so: >list [[1]] [1] "IPI00776145.1" "IPI00776187.1" [[2]] [1] "Something" "IPI00807764.1" "IPI00807887.1" [[3]] [1] "IPI00807764.1" [[4]] [1] "Somethingelse" What I need to achieve is a filtered list "list2" like so: >list2 [[1]] [1]
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 <-