Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Bert Gunter
Yes, a clear thinko... Thanks for the correction. -- Bert On Tue, Feb 4, 2020 at 1:41 PM Duncan Murdoch wrote: > On 04/02/2020 4:28 p.m., Ana Marija wrote: > > I tired your code on this simplified data just for say 10 permutations: > > > > dat <- read.table(text = " code.1 code.2 code.3 code.

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Duncan Murdoch
On 04/02/2020 4:28 p.m., Ana Marija wrote: I tired your code on this simplified data just for say 10 permutations: dat <- read.table(text = " code.1 code.2 code.3 code.4 1 82 93 NA NA 2 15 85 93 NA 3 93 89 NA NA 4 81 NA NA NA",

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
I tired your code on this simplified data just for say 10 permutations: dat <- read.table(text = " code.1 code.2 code.3 code.4 1 82 93 NA NA 2 15 85 93 NA 3 93 89 NA NA 4 81 NA NA NA", header = TRUE, stringsAsFacto

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Bert Gunter
I am not going to do your programming for you. If the following doesn't suffice, maybe someone else will provide you something that will. m = your matrix code = your code that uses m your list of results <- lapply(seq_len(1000), FUN = function(m){ m <- m[, sample.int(132)] code } ) or use an

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
Basically I would just reshuffle column names in each of 1000 permutations how to do that and perform everything I described in my initial email On Tue, 4 Feb 2020 at 14:46, Ana Marija wrote: > Hi Bert, > > thanks for getting back to me. I have to permute those 132 columns > 1000 times and perfo

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
Hi Bert, thanks for getting back to me. I have to permute those 132 columns 1000 times and perform the code given in the previous email. Can you please show me how you would do that in the loop? This is also a huge data set ... Thanks Ana On Tue, Feb 4, 2020 at 2:34 PM Bert Gunter wrote: > > I

Re: [R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Bert Gunter
If you just want to permute columns of a matrix, ?sample > sample.int(10) [1] 9 2 10 8 4 6 3 1 5 7 and you can just use this as an index into the columns of your matrix, presumably within a loop of some sort. If I have misunderstood, just ignore. Cheers, Bert On Tue, Feb 4, 2020 a

[R] doing 1000 permutations and doing test statistics distribution

2020-02-04 Thread Ana Marija
Hello, I have a matrix > dim(dat) [1] 15568 132 It looks like this: NoD_14381_norm.1 NoD_14381_norm.2 NoD_14381_norm.3 NoD_14520_30mM.1 NoD_14520_30mM.2 NoD_14520_30mM.3 Ku8QhfS0n_hIOABXuE 4.75 4.25 4.79 4.33 4.63

Re: [R] comparing variances between two sets of p values for two different conditions

2020-02-04 Thread Bert Gunter
Inline. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Feb 4, 2020 at 9:12 AM Ana Marija wrote: > Hello, > > I have a set of two conditions: individual.

[R] comparing variances between two sets of p values for two different conditions

2020-02-04 Thread Ana Marija
Hello, I have a set of two conditions: individual.variance and intra.individual.variance with their p values. Does it make sense to compare variances between those two groups with F test via: var.test(b$inter.individual.variance, b$intra.individual.variance, alternative = "two.sided") If not wh

Re: [R] read_xlsx(readxl) apparently mangling some data input

2020-02-04 Thread Chris Evans
Thanks. Probably should have said that the spreadsheets were originally created with the type of the data carefully defined to try to minimise mess (though I hadn't foreseen this little issue). Unfortunately that formatting has clearly been overridden in at least some of the data collection sit

Re: [R] read_xlsx(readxl) apparently mangling some data input

2020-02-04 Thread Chris Evans
This list can be priceless (and has taught me so much over, hm, over a decade certainly now!) Thanks both: makes perfect sense (of course) and shows my naivety in the way I was thinking about this. I'm intrigued that it's LibreOffice actually using lower precision that avoids the issue that w

Re: [R] read_xlsx(readxl) apparently mangling some data input

2020-02-04 Thread peter dalgaard
Excel itself will store numeric data as numeric unless you explicitly say that they are not. I.e., 9.13 gest stored in floating point, with the innate binary rounding issues which you can also see from R > print(9.13, digits=20) [1] 9.1307816 > print(1.14, digits=20) [1] 1.13

Re: [R] read_xlsx(readxl) apparently mangling some data input

2020-02-04 Thread PIKAL Petr
Hi Floating point representation I prepared excel file with arbitrary first row and second row 45.65 and 45.65/5 The division result should be 9.13 (exactly), but based on floation point representation in binary computers (FAQ 7.31) it results in 9.12999... However Excel shows exact value (

[R] read_xlsx(readxl) apparently mangling some data input

2020-02-04 Thread Chris Evans
This is a very odd error I'm hitting using read_xlsx from the readxl package (version 1.3.1) with R version 3.6.2 (2019-12-12) , platform x86_64-pc-linux-gnu (and updated Ubuntu 18.04). I have some largeish Excel spreadsheets that contain clinical data. I can't share the entire raw data but I t