Replication preserving block pattern in r (coding)

I am struggling with a code. I need to do this in the following steps:

1. Randomly permute within a column (i have 6 columns - so within each of the 6 columns) - 100 reps

2. Some rows for some of the columns have NAs. I want to keep the NAs - not permute them, but only permute the non-NA values

3. Calculate for each repetition/each row max consistency (basically the mode ignoring the NAs)

4. Calculate for each iteration/repetition the average of the mode or average of max consistency across the rows. That is for each iteration i will only have 1 value, so for 100 reps i will have 100 values

5. Plot the histograms of the averages from replications, that is frequency plot of 100 values

My data (larger but this is an example)

df = [url removed, login to view](v1 = c("NA", "Low", "High"),

v2 = c("NA", "High","Low"),

v3 = c("NA", "Low", "Low"))

The code i have for now is:

df22<-replicate(100, {apply(df[ sample(nrow(df)),sample( ncol(df)) ], 2, (function(x)) max(table(x)))}) hist(df22)

At a moment, i am getting a new value for each of the rows for each iteration and i do not get the 1 average of across three observations.

Taidot: tietojenkäsittely, R-ohjelmointikieli

Näytä lisää: anonymous functions in r, frf2 r, functional programming in r pdf, r anonymous function apply, r lambda aws, lambda symbol in r, functional programming in r advanced statistical programming for data science, analysis and finance, lambda function in r, R - coding, r coding outsourcing, r coding free lance, freelance r coding, R coding, shirt block pattern, block level replication trial

Tietoa työnantajasta:
( 0 arvostelua ) United States

Projektin tunnus: #16298801

Myönnetty käyttäjälle:


I have a lot of experience working with R and statistical information. I have done a similar project to you ahd employee was extremely happy with the work that i have done. I can do your task in around a day.

$25 USD 1 päivässä
(0 Arvostelua)

2 freelanceria on tarjonnut keskimäärin %project_bid_stats_avg_sub_26% %project_currencyDetails_sign_sub_27% tähän työhön


Hello, i have read the details provided..please contact me to discuss more on the project deadline and some other few things

$136 USD 10 päivässä
(5 arvostelua)