Displaying 20 results from an estimated 2352 matches for "matting".
Did you mean:
natting
2004 Dec 10
1
subset bug?
I ran into a problem with "subset" while working at home that I am not sure is a bug or not. I defined a custom function to take a data frame of tree positions, sizes, and types (containing the columns TRT, COMP, PLOT, X, Y, DBH and CON) and wanted to make a stem map of the plot using different symbols and colors to represent the different types of tree stems. I copied a bit of the
2023 Jan 27
3
implicit loop for nested list
>
> I am looking for a more elegant way to write below code.
>
> #Simulation results have different dimensions
> mysim <- lapply(1:10, function(y) {
> two.mat <- matrix(rnorm(4), nrow = 2)
> four.mat <- matrix(rnorm(16), nrow = 4)
> list(two.mat = two.mat, four.mat = four.mat) #results with different dimensions
> })
>
> #Collect different
2023 Jan 27
1
implicit loop for nested list
I would use replicate() to do an operation with random numbers repeatedly:
```
mysim <- replicate(10, {
two.mat <- matrix(rnorm(4), 2, 2)
four.mat <- matrix(rnorm(16), 4, 4)
list(two.mat = two.mat, four.mat = four.mat)
})
```
which should give you a matrix-list. You can slice this matrix-list
just like normal, then cbind it in one step:
```
two.mat <-
2017 Jan 19
2
Error en loop anidado con data.table
Hola tengo una tabla de tipo data.frame "datos" con la siguiente
estructura, simplificada en número de niveles por variable, para crear un
ejemplo más sencillo:
id anio t_8a t_10a t_12a rankf8 rankf10 rankf12
1 1 100 220 220 NA NA NA
2 1 140 350 350 NA NA NA
3 2 55 165 165 NA NA NA
4 2 60 200 200 NA NA NA
5 2 100 NA NA NA NA NA
6 3 NA 350 350 NA NA NA
También tengo una matriz,
2011 Aug 21
1
Multiple R linear models into one Latex table
Dear community,
I had been looking for an easy way to produce latex tables from R
output. xtable() and the package apsrtable produce good outputs but they are not
exactly what I was looking for.
I wrote this code that generates regression tables from multiple R
linear models. I want to share it because it might be
useful for someone else, and because I would appreciate comments on how to
2005 Aug 03
2
using weighted.mean with tapply()
I am trying to calculate the weighted mean for a of 10 deciles and I
get an error:
> decile <- tapply(X=mat$trt1m, INDEX=mat$Rank, FUN=weighted.mean, w=mat$mcap)
Error in FUN(X[[1]], ...) : 'x' and 'w' must have the same length
All three of my inputs have the same length, as shown below, and the
weighted.mean calculation works by itself, just not in tapply()
>
2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:
> set.seed(1)
> mat = matrix(rnorm(25), 5, 5)
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 0.91897737
[2,] 0.1836433 0.4874291 0.3898432 -0.01619026 0.78213630
[3,] -0.8356286 0.7383247
2007 Oct 24
1
Error in nls model.frame
Error in model.frame
When I run the following nls model an error message appears and I dont
know how to solve that. Could you help me??
mat = c(1,2,3,4,5,6,7,8,9,12,16,24,36,48,60)
for (i in 1:length(j30)) {
bliss = nls(c(j[i,1:length(mat)]) ~ b0 + b1*((1-exp(-k1*mat))/(k1*mat)) +
b2*(((1-exp(-k2*mat))/(k2*mat))-exp(-k2*mat)),
start = list(k1=0.1993, k2=0.1993, b0= 22.0046,
2009 Jul 15
1
Matrix multiplication precision
Hi!!
I am trying to multiply 5 matrices and then using the inverse of that matrix for further computation. I read about precision problems from the archives and the suggestion was to use as.numeric while computing the products. I am still having problems with the results. Here is how I am using it
#Mn.mat<-(T.mat %*% Rz.mat %*% Q.mat %*% Rz.mat %*% T.mat) # I was doing this in one step
2005 Sep 09
3
how to do something like " subset(mat, ("col1">4 & "col2">4)) "
Dear all,
I have a problem with the "subset()" function. I spent all day yesterday
with a collegue to solve it and we did not find a satisfying solution (even
in the archived mails), so I ask for your help.
Let's say (for a simple example) a matrix mat:
R> mat
cola colb colc
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
My goal is to select the lines of the matrix on the basis of the
2008 Aug 13
2
missing TRUE/FALSE error in conditional construct
Hi everyone,
I posted something similar to this in reply to another post, but there seems
to be a problem getting it onto the board, so I'm starting a new post.
I am trying to use conditional formatting to select non-zero and non-NaN
values from a matrix and pass them into another matrix. The problem is that
I keep encountering an error message indicating the ":missing value where
TRUE/FALSE needed "
My code is as follows:
##Code Start
mat_zeroless<-matrix(NA,5000,2000) #generating...
2006 Dec 05
5
if(){} else{}
Dear R-community,
my data set looks like 'mat' below.
Plant<-c(NA,1,1,1,NA,NA,NA,NA,NA,1);
Value1<-rnorm(1:10);
Value2<-rnorm(1:10);
mat<-cbind(Plant,Value1,Value2);
I receive data from two different sites.
One site is identified by an interger number, the other site has no data in
column Plant=NA.
My pb:
I'm trying to assign labels "A" or "B" to
2006 Jul 20
2
Timing benefits of mapply() vs. for loop was: Wrap a loop inside a function
List:
Thank you for the replies to my post yesterday. Gabor and Phil also gave
useful replies on how to improve the function by relying on mapply
rather than the explicit for loop. In general, I try and use the family
of apply functions rather than the looping constructs such as for, while
etc as a matter of practice.
However, it seems the mapply function in this case is slower (in terms
of CPU
2007 Jun 06
1
error message: only first element in each line of matrix used
I have a matrix and am trying to write a code to
1. identify all neg values along each line
2. for each neg value I need to identify min(j+3)
3. end with this code: eq[i,j]<- ifelse(mat.r[i,j] < (0.5*mat.s[i,j]), mat.all[i,j], 0)
This is the code I have so far. I have tried several different methods but I
keep getting the same error message that the condition has length >1 and
only
2000 Aug 21
4
Excluding rows from a matrix
Hi
I have a matrix (4 x 950) and I want to remove 3 rows, where the values
from the first column are 713, 714 and 715. I can select the rows, one
by one, with
mat[mat$first==713,]
mat[mat$first==714,]
...
but I'm unable to (i) select the 3 rows at once, (ii) select the matrix
excluding those rows.
How can I do it ?
Thanks
EJ
2001 Aug 19
2
error message in chol() (PR#1061)
Full_Name: Jerome Asselin
Version: 1.3.0
OS: Windows 98
Submission from: (NULL) (24.77.112.193)
I am having accuracy problems involving the computation of inverse of
nonnegative definite matrices with solve(). I also have to compute the
Choleski decomposition of matrices. My numerical problems involving solve()
made me find a bug in the chol() function. Here is an example.
#Please, load the
2005 Feb 04
4
Building a Matrix
Dear List:
I am having some difficulty constructing a matrix that must take a
specific form. The matrix must be have a lower block of non-zero values
and the rest must all be zero. For example, if I am building an n X n
matrix, then the first n/2 rows need to be zero and the first n/2
columns must remain as zero with all other elements having a non-zero
value that I specify.
For example, assume
2009 Jan 07
0
How-To extract data from a matrix of lists subject to a set of given constraints
My goal is to store the DWT coefficients from a number of time series in such a way to be able to extract subsets satisfying giben conditions.
I have defined the following 11 matrices whose x-axis represent time intervals and y-axis represent the number of time series:
MS <- 11 d1.mat <- matrix (data=list(), nrow=TotNumCycles, ncol=2^(MS-1))
d2.mat <- matrix (data=list(),
2010 Aug 26
3
Help with ddply to eliminate a for..loop
I created a small example to show something that I do a lot of. "scale"
data by month and return a data.frame with the output. "id" represents
repeated observations over "time" and I want to scale the "slope"
variable. The "out" variable shows the output I want. My for..loop
does the job but is probably very slow versus other methods. ddply
2004 Jul 30
2
pairwise difference operator
There was a BioConductor thread today where the poster wanted to find
pairwise difference between columns of a matrix. I suggested the slow
solution below, hoping that someone might suggest a faster and/or more
elegant solution, but no other response.
I tried unsuccessfully with the apply() family. Searching the mailing
list was not very fruitful either. The closest I got to was a cryptic
chunk