similar to: Fw: Error in rowSums REPOST

Displaying 20 results from an estimated 1200 matches similar to: "Fw: Error in rowSums REPOST"

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
2008 Aug 11
1
Making shadowed plot of individual profile from Longitudinal data
  Dear R-help,   I have a longitudinal dataset with about 5,000 subjects. To avoid overly cluttered plot of the individual profile, I want the plot to be shadowed and to randomly select say 100 subjects which will be depicted using darker lines on the plot.   Kindly guide me through on how to do this in R.   regards John  [[alternative HTML version deleted]]
2007 Oct 24
3
addClassName and removeClassName
Hi, and sorry for the noob question! I have an unordered list of 4 links where the links use Ajax.Updater in the onclick: onclick="new Ajax.Updater(''ajaxarea'', ''link1.php'', {asynchronous:true, evalScripts:true }); return false;" How would I go about using addClassName and removeClassName to show the current link? Thanks for any help with this.
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,
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
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
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
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,
2013 Feb 06
0
weighing pro​portion of rowSums i​n dataframe
Hi Eik, thank you so much - it works perfectly! Thank you and best wishes Alain   Eik Vettorazzi <E.Vettorazzi@uke.de> hat am 6. Februar 2013 um 17:01 geschrieben: > Hi Alain, > here is a one-liner for a df without the rowSum column > >
2009 Jul 30
1
rowSums, rowMean and rowCumSums?
Dear list, Don't you think it could be useful to have in R base a function rowCumSums, that compute cumulative sums for each row of a matrix? My implementation of rowCumSums is rowCumSums <- function(x) t(mapply(function(row)cumsum(x[row,]), 1:NROW(x))) I'm sure it can be improved to have other arguments like na.rm or dims. Is there any hope to have this function in R?
2011 Feb 14
0
drop argument for apply, rowSums, etc.
Dear list, dear Henrik, I find myself often reconstructing matrices from the result of rowSum (matrix) etc. I therefore propose a new argument, drop, for these functions: drop = TRUE (default) is the current behaviour. With drop = FALSE length (dim (x)) and dimnames are preserved and the affected dimensions are set to 1 (or whatever teh result length of the applied function is) I modified the
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
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:
2013 Feb 06
1
weighing proportion of rowSums in dataframe
Dear R-List, I am sure there must be a very simple way to do this - I just do not know how... This is what I want to do: #my dataframe df<-data.frame(id=c("x01","x02","x03","x04","x05","x06"),a=c(1,2,NA,4,5,6),b=c(2,4,6,8,10,NA),c=c(NA,3,9,12,NA,NA),sum=c(3,9,15,24,15,6))    id    a     b     c   sum 1 x01  1     2    NA   3 2
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
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
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',
2011 Mar 07
2
rowSums - am I getting something wrong?
I am trying to construct a data set with some sequences for example: a = seq(0,1,0.1) m = matrix(nrow = 1331, ncol = 3) m[,1] = rep(a,121) m[,2] = rep(a,11,each = 11) m[,3] = rep(a,1,each = 121) I realize that there may be better ways of doing this, but this approach demonstrates the problem I'm having. I then want to get the sum of the rows and delete any row with a sum of greater than 1.
2017 Jun 07
3
Problem related to rowSums
Hi... I have a dataframe with n columns and n rows. I need to find how many rows contains zero raw read count across all column. Thanks -- *Yogesh Gupta* *Postdoctoral Researcher* *Department of Biological Science* *Seoul National University* *Seoul, South Korea* [[alternative HTML version deleted]]