Displaying 20 results from an estimated 467 matches for "nonzeros".
Did you mean:
nonzero
2012 Mar 10
2
Finding the mean.
Using functions how would I go about do this question?
(I already have a mean defined for a function of x.)
Write a function called MyMean2. This function has two arguments, x and nonzero, where nonzero has the default value TRUE. This function should return the
(Previous defined mean of x) if nonzero=FALSE
(Previous defined mean of x) for all x's>0 if nonzero=TRUE
Much appreciated.
2011 Dec 08
2
Relationship between covariance and inverse covariance matrices
Hi,
I've been trying to figure out a special set of covariance
matrices that causes some symmetric zero elements in the inverse
covariance matrix but am having trouble figuring out if that is
possible.
Say, for example, matrix a is a 4x4 covariance matrix with equal
variance and zero covariance elements, i.e.
[,1] [,2] [,3] [,4]
[1,] 4 0 0 0
[2,] 0 4
2017 Jul 15
2
readLines without skipNul=TRUE causes crash
...t;, count, "\n")
cat("Nulls:\n")
zeros
Here's some code to recreate a file of the same length with nulls in the
same places, and spaces everywhere else:
size <- count
f2 <- tempfile()
con <- file(f2, open="wb")
count <- 0
while (count < size) {
nonzeros <- min(c(size - count, 1000000, zeros - 1))
if (nonzeros) {
writeBin(rep(32L, nonzeros), con, size = 1)
count <- count + nonzeros
}
zeros <- zeros - nonzeros
if (length(zeros) && min(zeros) == 1) {
writeBin(0L, con, size = 1)
count <- count + 1...
2012 Jul 23
2
Bug in my code (finding nonzero min)
Can someone verify for me if the for loop below is really calculating the
nonzero min for each row of a matrix? I have a bug somewhere in the is
section of code. My first guess is how I am find the the nonzero min of each
row of my matrix. The overall idea is to make sure I am investing all of my
money, i.e. new.set is a set of indicator variables for each stock for a
particular portfolio, i.e.
2006 Mar 20
5
Need some ACL help for win32-file
Hi folks,
I''ve got most everything done for the pure Ruby version of win32-file.
The last thing left (since I''ll be moving the IO methods to a different
package eventually) is the file security stuff. Here''s what I''ve got so
far for the get_permissions method. However, I''m stuck at GetAce(). If
someone could help me finish up this method, I
2012 Apr 04
2
extract data
HI,
I would like to extract data in a specific way. For example, the rainfall data
0,0,1.5,0,0, 3,1,2.5,0,0,0,0, 2.3,0,0,0, 2.1,1.4,0,0,0, 3,2,1,0,0,0...
data_1: 1.5, 2.3 ( a single nonzero data between zeros data)
data_2: 3.1, 2.5, 2.1,1.4 ( two nonzero data between zeros data)
data_3: 3,1,2.5, 3,2,1 ( three nonzero data between zeros data)
Thank you so much for any
2017 Jul 16
0
readLines without skipNul=TRUE causes crash
...)
> zeros
>
> Here's some code to recreate a file of the same length with nulls in the
> same places, and spaces everywhere else:
>
> size <- count
> f2 <- tempfile()
> con <- file(f2, open="wb")
> count <- 0
> while (count < size) {
> nonzeros <- min(c(size - count, 1000000, zeros - 1))
> if (nonzeros) {
> writeBin(rep(32L, nonzeros), con, size = 1)
> count <- count + nonzeros
> }
> zeros <- zeros - nonzeros
> if (length(zeros) && min(zeros) == 1) {
> writeBin(0L, con, size = 1)
&...
2014 Jun 13
1
Encourage exit with nonzero error status in ?last.dump
The following example in ?dump.frames
options(error = quote({dump.frames(to.file = TRUE); q()}))
is useful for teaching the user how to save a frame dump when R
encounters an error during non-interactive sessions. This command
however causes an additional change that on encountering an error R
exits with a 0 error status. Although it's just an example, it's an
important one as it's
2008 Sep 25
2
levelplot/heatmap question
Hello!
I have data containing a large number of probabilities (about 60) of nonzero
coefficients to predict 10 different independent variables (in 10 different
BMA models). i've arranged these probabilities in a matrix like so:
(IV1) (IV2) (IV3) ...
p(b0) p(b0) p(b0)
p(b1) p(b1) p(b1)
p(b2) p(b2) p(b2)
...
where p(b1) for independent variable 1 is p(b1 !=
2017 Jul 16
2
readLines without skipNul=TRUE causes crash
...#39;s some code to recreate a file of the same length with nulls in
> the same places, and spaces everywhere else:
>
> size <- count
> f2 <- tempfile()
> con <- file(f2, open="wb")
> count <- 0
> while (count < size) {
> nonzeros <- min(c(size - count, 1000000, zeros - 1))
> if (nonzeros) {
> writeBin(rep(32L, nonzeros), con, size = 1)
> count <- count + nonzeros
> }
> zeros <- zeros - nonzeros
> if (length(zeros) && min(zeros) == 1) {
> w...
2008 Apr 10
2
QP.solve, QPmat, constraint matrix, and positive definite
hello all,
i'm trying to use QPmat, from the popbio package. it appears to be based
on solve.QP and is intended for making a population projection matrix.
QPmat asks for: nout, A time series of population vectors and C, C
constraint matrix, (with two more vectors, b and nonzero). i believe the
relevant code from QPmat is:
function (nout, C, b, nonzero)
{
if (!"quadprog" %in%
2011 Mar 29
5
Integration with variable bounds
If this is posted elsewhere I cannot find it. I need to perform multiple
integration where some of the variables are in the bounds of the other
variables. I was trying to use R2Cuba function but cannot set the upper and
lower bounds. My code so far is :
int <- function(y){
u2 = y[1]
z2 = y[2]
u1 =y[3]
z1 = y[4]
ff <- u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2))
return(ff)
}
2011 Dec 20
1
column permutation of sparse matrix
Hi,
I'm very new to working with sparse matrices and would like to know how I
can column permute a sparse matrix. Here is a small example:
> M1 <-
> spMatrix(nrow=5,ncol=6,i=sample(5,15,replace=TRUE),j=sample(6,15,replace=TRUE),x=round_any(rnorm(15,2),0.001))
> M1
5 x 6 sparse Matrix of class "dgTMatrix"
[1,] 2.983 . 1.656 5.003 . .
[2,] .
2005 Apr 07
2
about mantelhaen.test (PR#7779)
Full_Name: Chien-yu Peng
Version: 2.0.1
OS: Windows XP Professional
Submission from: (NULL) (140.109.72.181)
Dear all:
Although I don't know you, I am thankful for your help.
When I use the function mantelhaen.test for R x C x K (R, C > 2) table,
the output is not the same as SAS's. I don't know that the result consist with
one of SAS's. But it works correctly for 2
2007 Jan 05
0
[832] trunk/wxruby2/samples: Fix samples for TreeItemIds as integers, fix image size in treectrl sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding:
2015 Mar 18
0
[PATCH 1/2] mllib: allow external_command to return on nonzero return value
This is useful for probing probing for cache files such as:
external_command ?ignore_error:(Some true) ~prog "ls .cache/something.*"
will return command output (matched files) on its success or empty list
whenits exit code is other than 0 (there are no such files).
---
mllib/common_utils.ml | 15 ++++++++++-----
mllib/common_utils.mli | 2 +-
2 files changed, 11 insertions(+), 6
2001 Oct 09
3
find indices of nonzero elements
Hi,
Is there a function func(x) where x is an array such that it
returns a list of the indices of all non-zero elements of the array?
for example:
a:
1 0 0
0 0 1
0 1 0
func(a) returns two vectors r and c:
r c
1 1
2 3
3 2
daver
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|David Richmond It works on a |
+ Dept. of Sociology complex scientific
2011 Oct 19
1
Sparse covariance estimation (via glasso) shrinking to a "nonzero" constant
I've only been using R on and off for 9 months and started using the
glasso package for sparse covariance estimation. I know the concept is
to shrink some of the elements of the covariance matrix to zero.
However, say I have a dataset that I know has some underlying
"baseline" covariance/correlation (say, a value of 0.3), how can I
change or incorporate that into to the
2005 Mar 08
2
a==0 vs as.integer(a)==0 vs all.equal(a,0)
hi
?integer says:
Note that on almost all implementations of R the range of
representable integers is restricted to about +/-2*10^9: 'double's
can hold much larger integers exactly.
I am getting very confused as to when to use integers and when not to.
In my line
I need exact comparisons of large integer-valued arrays, so I often use
as.integer(),
but the above
2009 Aug 10
1
Help with R Function writing for Matrix
Dear all,
I have a task to find the first all zero row of a matrix X ( nothing known
about X). I need to write a function which returns either the row index of
the first all-zero row, or NA if there are no all-zero rows. and I also need
to locate all rows which are non-zero (should be a vector of row indexes).
Can somebody give me some hints on this?
Thanks a lot.
Rene.
[[alternative HTML