[R] Error in rowSums
Peter Ehlers
ehlers at ucalgary.ca
Thu Aug 12 20:51:46 CEST 2010
Another suggestion: compare
-1:4
with
-(1:4)
-Peter Ehlers
On 2010-08-12 12:28, Amit Patel wrote:
> 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 error.
>
> Error in rowSums(FeaturePresenceMatrix, na.rm = TRUE) :
> 'x' must be numeric
>
> Any tips onhow I can get round this?
>
> Thanks in Advance
> Amit
More information about the R-help
mailing list