[R] Finding non-normal distributions per row of data frame?

David Winsemius dwinsemius at comcast.net
Fri Feb 4 20:01:45 CET 2011


On Feb 4, 2011, at 1:41 PM, DB1984 wrote:

>
> Thanks David - but '1' (if I understood correctly) returns the same  
> value for
> each row, which I took to be an error.

And exactly what were you expecting with that data?

>
> nt
>     V1    V2    V3    V4    V5    V6
> 1 24.71 23.56 24.71 23.56 24.71 23.56
> 2 25.64 25.06 25.64 25.06 25.64 25.06
> 3 21.29 20.87 21.29 20.87 21.29 20.87
> 4 25.92 26.92 25.92 26.92 25.92 26.92
> 5 24.36 23.60 24.36 23.60 24.36 23.60
> 6 24.91 24.32 24.91 24.32 24.91 24.32
> 7 23.56 23.14 23.56 23.14 23.56 23.14
> 8 23.94 23.99 23.94 23.99 23.94 23.99
> 9 26.65 26.07 26.65 26.07 26.65 26.07
>
> test <- apply(nt, 1, shapiro.test)

Run this and ponder the results a bit:

  apply(nt, 1, diff )

-- 

David.

>> fred<-data.frame(sapply(test,function(x)c(x$statistic, x$p.value)))
>> fred
>           X1          X2          X3          X4           
> X5          X6
> X7          X8          X9
> W 0.682676792 0.682676792 0.682676792 0.682676792 0.682676882  
> 0.682676792
> 0.682676792 0.682676792 0.682676792
>  0.004039347 0.004039347 0.004039347 0.004039347 0.004039358  
> 0.004039347
> 0.004039347 0.004039347 0.004039347
>
>
> Version details are below:
> R.Version()
> $platform
> [1] "x86_64-apple-darwin9.8.0"
>
> $arch
> [1] "x86_64"
>
> $os
> [1] "darwin9.8.0"
>
> $system
> [1] "x86_64, darwin9.8.0"
>
> $status
> [1] ""
>
> $major
> [1] "2"
>
> $minor
> [1] "12.0"
>
> $year
> [1] "2010"
>
> $month
> [1] "10"
>
> $day
> [1] "15"
>
> $`svn rev`
> [1] "53317"
>
> $language
> [1] "R"
>
> $version.string
> [1] "R version 2.12.0 (2010-10-15)"
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Finding-non-normal-distributions-per-row-of-data-frame-tp3259439p3260769.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list