similar to: convert list without same component length to matrix

Displaying 20 results from an estimated 3000 matches similar to: "convert list without same component length to matrix"

2012 Jun 27
2
how to apply the same function to multiple data set
Hi R-users, I'm trying to repeat the same procedure to 1000 data set. I know this is very easy, but I got stuck finding the right and fastest way in running it. IID50=Riidf[1:50,1:1000] #where IID50 is a dataframe consist of 1000 time series(as column) and 50 time scales (row). #what I tried to do: estIID50=rep(NA,1000) for (i in 1:1000) estIID50[i]=pargev(lmom.ub(IID50[1:50,i])) #warning
2010 Nov 09
3
Row-wise recurive function call
Dear Group, I have a following dataset: > a A B C D 1 22 3 31 40 2 26 31 36 32 3 3 7 49 16 4 24 40 27 26 5 20 45 47 0 6 34 43 11 18 7 48 48 24 2 8 3 16 39 48 9 20 49 7 21 10 17 36 47 10 > dput(a) structure(list(A = c(22L, 26L, 3L, 24L, 20L, 34L, 48L, 3L, 20L, 17L), B = c(3L, 31L, 7L, 40L, 45L, 43L, 48L, 16L, 49L, 36L), C = c(31L, 36L, 49L, 27L, 47L, 11L, 24L,
2012 Apr 20
3
Matrix multiplication by multple constants
Dear R helpers Suppose x  <- c(1:3) y  <- matrix(1:12, ncol = 3, nrow = 4) > y      [,1] [,2] [,3] [1,]    1    5    9 [2,]    2    6   10 [3,]    3    7   11 [4,]    4    8   12 I wish to multiply 1st column of y by first element of x i.e. 1, 2nd column of y by 2nd element of x i.e. 2 an so on. Thus the resultant matrix should be like > z      [,1]   [,2]    [,3] [1,]    1   
2010 Nov 07
3
regular exprs
Dear All, I would appreciate any help with the following: given the vector 'x' x <- c("Ass1", "Ass.s1", "Ass2", "Ass.s2") I would like to pick up the positions where the character string contains "Ass" but does not contain "Ass.s", so for 'x' that would be positions 1 and 3. I guess this could be programmed around
2011 Aug 23
4
Correlation discrepancy
Dear R list, I have one very elementary question regrading correlation between two variables. x = c(44,46,46,47,45,43,45,44) y = c(44,43,41,41,46,48,44,43) > cov(x, y) [1] -2.428571 However, if I try to calculate the covariance using the formula as covariance = sum((x-mean(x))*(y-mean(y)))/8       # no of of paired obs. = 8 or     covariance = sum(x*y)/8-(mean(x)*mean(y)) gives
2010 Oct 15
4
split data with missing data condition
Dear all I have data like this: x y [1,] 59.74889 3.1317081 [2,] 38.77629 1.7102589 [3,] NA 2.2312962 [4,] 32.35268 1.3889621 [5,] 74.01394 1.5361227 [6,] 34.82584 1.1665412 [7,] 42.72262 2.7870875 [8,] 70.54999 3.3917257 [9,] 59.37573 2.6763249 [10,] 68.87422 1.9697770 [11,] 19.00898 2.0584415 [12,] 60.27915 2.5365194 [13,] 50.76850
2012 Jun 15
1
Replication of linear model/autoregressive model
Hi, I would like to make a replication of 10 of a linear, first order Autoregressive function, with respect to the replication of its innovation, e. for example: #where e is a random variables of innovation (from GEV distribution-that explains the rgev) #by using the arima.sim model from TSA package, I try to produce Y replicates, with respect to every replicates of e, #means for e[,1], I want
2010 Oct 21
1
How to check for missing report pages per client
Hi, Not sure how to go about checking for missing report pages per client. See example below; I like to extract client 730040, because page 46103 is missing. client page 730001 46101 730001 46102 730019 46101 730035 46101 730040 46101 730040 46102 730040 46104 730040 46105 730052 46101 730052 46102 730074 46101 730074 46102 730074 46103 I appreciate any help, Pauline
2010 Nov 17
2
slicing list with matrices
A list contains several matrices. Over all matrices (list elements) I'd like to access one matrix cell: m <- matrix(1:9, nrow=3, dimnames=list(LETTERS[1:3], letters[1:3])) l <- list(m1=m, m2=m*2, m3=m*3) l[[3]] # works l[[3]][1:2, ] # works l[[1:3]][1, 1] # does not work How can I slice all C-c combinations in the list? S?ren -- S?ren Vogel, Dipl.-Psych. (Univ.), PhD-Student, Eawag,
2010 Nov 25
1
Applying function to elements of matrices in a list
Hello R-help, Please cc me on all responses, as I only receive summary emails from this list. I'm wondering if anybody has any tips on how to accomplish this efficiently. I have a list of matrices, and I'm trying to get the mean of the [i,j]'th element of each matrix in a list. So if I have a list of matrices, say x <-
2011 Feb 16
2
Axis positions
Hi everyone. I would like to modify the axis on my plot. First, I would like to make a plot without the box. so I use : plot(x,y, axes = FALSE, type = 'l') Then, I call : axis(1, tck = -0.02) axis(2, tck = -0.02) to have X and Y axis appear. However, I would like them to join at the origin instead of having a space between the 2 axis. I can't find the parameter to modify to get
2011 Jun 14
1
Expand DF with all levels of a variable
Dear list, I would like to expand a DF with all the missing levels of a variable. a <- c(2,2,3,4,5,6,7,8,9) a.cut <- cut(a, breaks=c(0,2,6,9,12), right=FALSE ) (x <- data.frame(a, a.cut)) # In 'x' the level "[0,2)" is "missing". AddMissingLevel <- function(xdf) { xfac <- factor( c("[0,2)", "[2,6)", "[6,9)",
2011 Jun 24
1
Fastest way of finding if any members of vector x fall in the range of the rows of matrix y
Hi All, What is the fastest way of finding if any members of vector x fall in the range of the rows of matrix y? I do not want to use two for loops as this will take forever. Any help will be appreciated, best, salih [[alternative HTML version deleted]]
2011 Aug 25
1
Bivariate normal regression in R
Hello everyone, I need to fit a bivariate normal regression model to a dataset where the same covariate (say, X) influences two separate but correlated responses (say, Y1 and Y2). So, the bivariate model would look like : Y1 = a1 + b1*X + e1 Y2 = a2 + b2*X + e2 where e1 and e2 are error terms which can be correlated. Is there any package in R which can help me fit this model ? Any help will be
2011 Aug 31
1
assign group letters to T/F matrix
dear R community, i appologize as this is kind of a newbie question, but: I want to assign group letters (like in anova post-hoc tests) to data with combined means and SDs. It's easy to apply t-test formulas to get a materix like (A - D are treatments | A B C D ----------------------- A| T F F B| T F C| F D| where true stands for sign.
2011 Sep 04
2
Regression coefficient constraints
Hi Guys, Does anyone know how I could constrain my regression coefficients so that they are positive and add up to one? Any help will be greatly appreciated. Kind Regards, Andre [[alternative HTML version deleted]]
2011 Sep 19
2
pasting elements of one character vector together
hello, i am familiar with the paste command with which i can paste for exaple: object <- "Hello" paste(object,"World") now i would like to be able to paste all the elements of the same vector together e.g: object <- c("Hello","World") getting as a result also: "Hello World". Does anyone know the solution to this problem? Thank you
2011 Sep 29
1
multiplying list with vector
hello everybody, i have got a question about lists: i have got the following commands: mylist <- list("v1"=c(1,2,2,1),"v2"=c(2,2,2,1),"v3"=c(1,1,1,1)) myvector <- c(100,10000,1000000) now i would like to multiply each element of the list with the corresponding element of the vector, that is to say: v1*100 v2*10000 v3*1000000 i only could think of lapply
2011 Oct 06
1
Concecutive zeros and ones
Dear all, I have  a data series (might be vector or matrix) which is composed only from zeros and ones like the following example 0 0 0 1 1 0 1 0 0 1 1 1 1 0 0 0 I want to be able to return back the length of concecutive zeros and the length of concecutive ones. For that I want to have something like that returned: zeros= [3 1 2 3]; ones=[2 1 4]; How I can do that simply in R? I would like
2011 Oct 06
3
Duplicate elements of a vector
Hi, let's assume I have the following vector a: 1 5 23 How can I use R to duplicate the elements so that my new vector looks like: 1 1 5 5 23 23 Many thanks, Syrvn -- View this message in context: http://r.789695.n4.nabble.com/Duplicate-elements-of-a-vector-tp3879561p3879561.html Sent from the R help mailing list archive at Nabble.com.