Displaying 20 results from an estimated 6000 matches similar to: "Discarding a matrix based on the rowSums value"
2012 Jan 26
1
Error in ifelse(append, "a", "w") : , (list) object cannot be coerced to type 'logical'
Hello
I will appreciate your help with the following.
Running a script in R 2.14.1 under windows vista I get the following error
message:
Error in ifelse(append, "a", "w") :
(list) object cannot be coerced to type 'logical'
However, the very same script runs perfectly well under Ubuntu.
My understanding is that this type of error is associated to
2012 May 23
1
procrustes (vegan) plot of residual differences
Hello
This is a simple question but I couldn't google an answer.
In the procrustes function of the vegan package, one uses
plot(procrustes_object, kind=2) to obtain a plot of the residual
differences. For instance:
data(varespec)
vare.dist <- vegdist(wisconsin(varespec))
library(MASS)
mds.null <- isoMDS(vare.dist, tol=1e-7)
mds.alt <- isoMDS(vare.dist,
2010 Oct 20
2
rowsum
Hello,
I am trying to achieve something which I *think* is possible using rowsum,
but a little help should be useful:
Consider the following dataframe DF0:
A B C
89 1 140
89 06 20
89 29 137
89 52 13
89 57 10
89 97 23
89 1 37
89 1 12
89 1 3
52 1 11
52 1 31
52 1 16
52 1 6
52 1 10
52 1 13
52 1 10
52 1 25
52 1 2
52 59 38
52 97 75
57 1 14
57 1 13
57 1 14
57 114 12
57 1 23
57 06 26
I need create a
2012 Jan 18
4
R-Help
I am trying to create a frequency distribution and I am a bit confused.
Here are the commands I have entered:
> data <- read.csv(file="40609_sortedfinal.csv",head=TRUE,sep=",")
> NumberOfActionsByStatus = data$STATUS
> NumberOfActionsByUser = data$ETS_LOGIN
> NumberOfBidOffer = data$BID_OFFER
> NumberOfActionsByUser.freq = table(NumberOfActionsByUser)
>
2005 Jul 12
2
testing for significance in random-effect factors using lmer
Hi, I would like to know whether it is possible to obtain a value of
significance for random effects when aplying the lme or related
functions. The default output in R is just a variance and standard
deviation measurement.
I feel it would be possible to obtain the significance of these random
effects by comparing models with and without these effects. However,
I'm not used to perform
2003 Jul 30
2
robust regression
Hi,
trying to do a robudt regression of a two-way linear model, I keep
getting the following error:
> lqs(obs ~ y + s -1,method="lms", contrasts=list(s=("contr.sum")))
Error: lqs failed: all the samples were singular
Robust regression with M-estimators works (also regular least square
fits, of course):
rlm.formula(formula = obs ~ y + s - 1, method = "M",
2009 Nov 30
2
command similar to colSums for rowSums?
Working with an NxMxO sized matrix, currently I can do this in my code:
if (max(colSums(array)) >= number)
But to get an equivalent result using rowSums, I have to do:
for (i in 1:10)
{
if (max(rowSums(array[,,i])) >= number)
}
I'm running both in a much larger loop that loops millions of times, so
speed and such is quite a big factor for me. Currently, the colSums line
uses about
2005 Apr 21
1
colSums and rowSums with arrays - different classes and dim ?
Hi,
I'm using colSums and rowSums to sum the first dimensions of arrays. It
works ok but the resulting object is different. See
> a3d <- array(rnorm(120, mean=2), dim=c(20,6,1))
> dim(colSums(a3d))
[1] 6 1
> dim(rowSums(a3d))
NULL
> class(colSums(a3d))
[1] "matrix"
> class(rowSums(a3d))
[1] "numeric"
I was expecting rowSums to preserve the array
2007 Nov 09
2
rowSums() and is.integer()
Hi
[R-2.6.0, macOSX 10.4.10].
The helppage says that rowSums() and colSums()
are equivalent to 'apply' with 'FUN = sum'.
But I came across this:
> a <- matrix(1:30,5,6)
> is.integer(apply(a,1,sum))
[1] TRUE
> is.integer(rowSums(a))
[1] FALSE
>
so rowSums() returns a float.
Why is this?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre,
2008 Jan 11
2
How to add rowSums into list?
Hi R-users,
I have a list
a <- list(one=matrix(rnorm(20), 5, 4), two=matrix(rnorm(20, 3, 0.5),5,4))
How to add rowSums (calculated using lapply) to corresponding matrix
in this list
lapply(a, function(x) rowSums(x))
??
-Lauri
2010 Nov 18
2
RowSums Question
I have a question on RowSums.
Lets say i have a timeSeries table
A B C
1/1/90 NA 1 1
1/2/90 NA 1 1
1/3/90 NA 1 1
1/4/90 NA 1 1
1/5/90 1 1 1
1/6/90 1 1 1
if i use RowSums, i will get
1/5/90 3
1/6/90 3
but i want
1/1/90 2
1/2/90 2
1/3/90 2
1/4/90 2
1/5/90 3
1/6/90 3
I cant
2011 May 16
2
conditional rowsums in sapply
Hi all
I have a data frame with duplicate columns and i want to remove duplicates
by adding rows in each group of duplicates, but have lots of NA's.
Data:
dfrm <- data.frame(a = 1:4, b= 1:4, cc= 1:4, dd=1:10, ee=1:4)
names(dfrm) <- c("a", "a", "b", "b", "b")
dfrm[3,2:3]<-NA
dfrm
a a b b b
1 1 1 1 1 1
2 2 2 2 2 2
3
2008 Sep 24
4
rowSums()
Say I have the following data:
testDat <- data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
> testDat
A B
1 1 NA
2 NA NA
3 3 3
rowsums() with na.rm=TRUE generates the following, which is not desired:
> rowSums(testDat[, c('A', 'B')], na.rm=T)
[1] 1 0 6
rowsums() with na.rm=F generates the following, which is also not
desired:
> rowSums(testDat[, c('A',
2010 Aug 12
3
Error in rowSums
Hi
I am trying to calculate the row sums of a matrix i have created
The matrix ( FeaturePresenceMatrix) has been created by
1) Read csv
2) Removing unnecesarry data using [-1:4,] command
3) replacing all the NA values with as.numeric(0) and all others with as.numeric
(1)
When I carry out the command
TotalFeature <- rowrowSums(FeaturePresenceMatrix, na.rm = TRUE)
I get the following
2006 Nov 21
2
using nested ifelse and rowSums to create new variable?
Dear R-help community,
If I have a data.frame df as follows:
> df
x1 x2 x3 x4 x5 x6
1 5 5 1 1 2 1
2 5 5 5 5 1 5
3 1 5 5 5 5 5
4 5 5 1 4 5 5
5 5 1 5 2 4 1
6 5 1 5 4 5 1
7 5 1 5 4 4 5
8 5 1 1 1 1 5
9 1 5 1 1 2 5
10 5 1 5 4 5 5
11 1 5 5 2 1 1
12 5 5 5 4 4 1
13 1 5 1 4 4 1
14 1 1 5 4 5 5
15 1 5 5 4
2010 Aug 13
2
Fw: Error in rowSums REPOST
For the query below I have also included the follwing information. Thanks for
your replies
> str(FeaturePresenceMatrix)
chr [1:65530, 1:40] "0" "0" "0" "0" "1" "0" "0" "0" "0" ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:65530] "4" "5" "6" "7" ...
2010 Dec 02
1
Arrange elements on a matrix according to rowSums + short 'apply' Q
Greetings,
My goal is to create a Markov transition matrix (probability of moving from
one state to another) with the 'highest traffic' portion of the matrix
occupying the top-left section. Consider the following sample:
inputData <- c(
c(5, 3, 1, 6, 7),
c(9, 7, 3, 10, 11),
c(1, 2, 3, 4, 5),
c(2, 4, 6, 8, 10),
c(9, 5, 2, 1, 1)
)
MAT <- matrix(inputData,
2012 Jun 05
3
rowSums problem
I'm having a very frustrating problem, trying to find the inverse distance
squared weighted interpolants of some weather data.
I have a data frame of weights, which sum to 1. I have attached the weights
data. I also have a data frame of temperatures at 48 grid points, which I
have also attached.
Now, all I need to do is multiply all of the rows of the temperature data
frame by the weights
2005 Nov 10
2
error in rowSums:'x' must be numeric
Dear All,
It's Eszter again from Hungary. I could not solve my problem form
yesterday, so I still have to ask your help.
I have a binary dataset of vegetation samples and species as a comma
separated file. I would like to calculate the Jaccard distance of the
dataset. I have the following error message:
Error in rowSums(x, prod(dn), p, na.rm) : 'x' must be numeric
In addition:
2006 Jan 24
1
fitting generalized linear models using glmmPQL
Hi, I have tried to run the following (I know it's a huge data set but
I tried to perform it with a 1 GB RAM computer):
library(foreign)
library(MASS)
library(nlme)
datos<-read.spss(file="c:\\Documents and
Settings\\Administrador\\Escritorio\\datosfin.sav",to.data.frame=TRUE)
str(datos)
`data.frame': 1414 obs. of 5 variables:
$ POB : Factor w/ 6 levels