1

I tried the loop function as was given in this question and it seems to work. However, I still have two problems. First I have 4753 comparisons, but R only lists those from 1946 to 4752. Is there a way to get the previous 1945 cases? I've already changed the length of my console to 100000 lines, but that does not seem to work.

1946 1946         focushumrights            pillar4info      0.867   1   0.352
1947 1947         focushumrights        pillar4campagne      0.053   1   0.818

...

4752 4752     improveorglearning         improvenetwork     49.064   9   0.000
4753 4753      improvetechexpert         improvenetwork     43.738   9   0.000

Second, I get 4753 results and of those, only a few are significant. Is there a way to automatically filter out the significant cases based on the "p-value" smaller than 0.1 or 0.05.

Community
  • 1
  • 1
Bert Jacobs
  • 51
  • 1
  • 3

1 Answers1

2

You are confusing with what is being displayed and what is being stored. I presume you are using the answer in the question you reference in your own question. The answer is a function that returns a data frame. You should store the data frame and then select rows as need. For example,

##Example function that returns a data frame
f = function(N=1000){
 out <- data.frame("Row" = 1:N
                   , "Column" = 1:N
                   , "Chi.Square" = runif(N)
                   ,  "df"= sample(N, 1:10, replace=T)
                   ,  "p.value" = round(runif(N), 3)
                   )
 return(out)
}

#Would just print everything to the screen
f()
##Store in a data frame
results = f()
##Select rows as needed
results[results$p.value < 0.05,]
Community
  • 1
  • 1
csgillespie
  • 59,189
  • 14
  • 150
  • 185