similar to: Select exactly n elements of a vector

Displaying 20 results from an estimated 10000 matches similar to: "Select exactly n elements of a vector"

2009 Jun 02
1
help on understanding a code
Dear R user, I am trying to understand this following code. Basically it's using a permutation method to calculate p value. But I would like to know exactly how the permutation works. #calculates null statistics tt0 <- 0 set.seed(123) B <- 100 for(i in 1:B) { v <- sample(y) tt0 <- c(tt0,ttest(dat,v)$tt) } tt0 <- tt0[-1] #form p-values att <- abs(tt) att0 <- abs(tt0) v
2009 Apr 14
1
mean fold change issues and p values
I am new to R and have two scripts written slightly different but should to relatively the same thing but my lack of experience with the program I can not figure out the what I need to do to correct it. The first script gives me a consistent mean fold change values with every run but can generate negative p values for some. For the second version of the script, the fold changes seem to be very
2012 Mar 01
2
'break' function in loop
Dear R helpers, I have some difficulties in using ''break'' function with loop, and the followings are my script. What I try to do is (1) permute ''or'' first; (2) doing t-test if this ''or'' pass criteria 1 (k=1); (3) end the loop when I get 10 permutations; (4) redo everything again but this time use criteria 2 (k=2) (I have more criteria 1:n).
2009 Sep 23
1
dotchart to barplots
Hi, I am trying to plot the following data so that it can be visually represented well. I tried the dotchart but I felt it was too spread out. Then I tried the barplot which is good enough for me. Is there a way to give the labels for the y-axis as in the dot chart? Also, I feel the grey level is confusing, so is there options for designs within the bars? I cannot use color as the journal wants
2003 Jun 04
3
Slow ttests in R-devel
Hello ... I've noticed that some of our Bioconductor code was running drastically slower under current R-devel vs. current R-patched - one example is below using a ttest. I have the following snippet of code that demonstrates the problem while avoiding "real" code that takes an extremely long time to finish on R-devel: library(genefilter) data(eset) eset$cov1 z <-
2009 Mar 22
2
Following progress in a lapply() function
Dear all, I am processing a very long and complicated list using lapply through a custom function and I would like to generate some sort of progress report. For instance, print a dot on the screen every time 1000 item have been process. Or even better, reporting the percent of the list that have been process every 10%. However, I can't seem to figure out a way to achieve that. For instance,
2012 Dec 12
4
Matrix multiplication
Hi, I have a transition matrix T for which I want to find the steady state matrix for. This could be approximated by taking T^n , for large n. T= [ 0.8797 0.0382 0.0527 0.0008 0.0212 0.8002 0.0041 0.0143 0.0981 0.0273 0.8802 0.0527 0.0010 0.1343 0.0630 0.9322] According to a text book I have T^200 should have reached the steady state L L
2004 Feb 10
4
The ttest.c example in R under MS Windows
We are trying to compile and run the ttest.c example that comes with R (in C:\Program Files\R\rw1081\src\library\windlgs\src\ttest.c). After compiling it with MS Visual C++ we load the DLL with dyn.load. So far it seems good, but when we try to call it from R (after running C:\Program Files\R\rw1081\src\library\windlgs\R\windlgs.R) R crashes. We have tried changing the exports from DLL but have
2009 Aug 28
1
extracting pvalues from ttest
Hello list, I have a similar issue as this post http://tolstoy.newcastle.edu.au/R/e6/help/09/04/11438.html#options2 and I used the suggestion provided by Jorge with modifications to my data do.call(c,lapply(your_list_with_the_t_tests,function(x) x$p.value)) but I am getting the following error after excuting the code B<-by(eo,eo$PlateID, function(.sub) t.test(mcp1~Self_T1D,data=.sub,
2007 Aug 14
4
Problem with "by": does not work with ttest (but with lme)
Hello, I would like to do a large number of e.g. 1000 paired ttest using the by-function. But instead of using only the data within the 1000 groups, R caclulates 1000 times the ttest for the full data set(The same happens with Wilcoxon test). However, the by-function works fine with the lme function. Did I just miss something or is it really not working? If not, is there any other possibility to
2001 Dec 09
1
plot.design()
Greetings- I'm working through Pinheiro and Bates' _Mixed Effects Models in S and S-Plus_ using R (1.3.1 for linux). On page 13 (okay, so I haven't got that far :)) is: plot.design( ergoStool) which returns on my system: > plot.design(ergoStool) Error: couldn't find function "plot.design" any ideas? Thanks.
2005 Apr 04
1
RDCOMServer for R 2.0.1 + Windows ?
Has anyone managed to get this working? Here's what I did: I got the binary build for R2.0.1 from the Omegahat download page, and made a small change to the registerClassID function ( to make it use the right path to RDCOMServer.dll). Then I tried to replicate the simple TTest example from the same web site. The COM class definition and registration worked fine for me. To test this, I
2008 Mar 06
1
can't merge zoo ojects and convert to ts (been trying for 2 days)
I'm stuck, but am sure it can be done I just don't understand how. I have data in an irregular timeseries. I want to be able to use stl to visualise the data (see seasonal parts etc), so I need to change to regular series of class ts (I think). I am using 2 zoo objects one is regular and the other is my irregular data. I am then merging to create the object I want but when I try to change
2009 Mar 07
2
ttest in R
Dear list, i am a biologist who needs to do some ttest between disease and non disease, sex, genotype and the serum levels of proteins on a large number of individuals. i have been using excel for a long time but it is very tedious and time consuming. i am posting the data below and ask your help in generating a code to get this analysis done in R. thanks gender disease genotype data M N CC
2003 Sep 05
3
all values from a data frame
Hello, I've a data frame with 15 colums and 6000 rows, and I need the data in a single vector of size 90000 for ttest. Is there such a conversion function in R, or would I have to write my own loop over the colums? thanks for your help + kind regards Arne
2000 Dec 15
2
debugger not recognizing C routine names
Something seems to have changed with the debugger option since I used it last, unless I've forgotten something really stupid (much more likely) . The debugger doesn't seem to recognise the names of C routines ***************** [jonm at localhost jonm]$ cat test.c #include "S.h" void test(int *x,int *y){ y[0]=x[0]+2; } [jonm at localhost jonm]$ R COMPILE test.c gcc
2011 Aug 01
2
Errors, driving me nuts
Greetings all, I am getting this error that is driving me nuts... (not a long trip, haha) I have a set of files and in these files I want to calculate ttests on rows 'compareA' and 'compareB' (these will change over time there I want a variable here). Also these files are in many different directories so I want a way filter out the junk... Anyway I don't believe that this is
2008 Mar 15
2
Please find the error in my code
hello everybody I use the following code for my programming & it runs with the error as specified below.Any help that would disolve the error will be highly appreciated. Thanks in advance my code looks like this #### R programme for simulating the power of the two sample t test vs various #### non-parametric alternatives sim.size <- 200 sample.size <- 10 set.seed(231) mu1 <- 0 delta
2010 May 05
2
t.test per line
Dear All, I apologize for this trivial question, I can not find the solution I try to use t.test function per line in the data.frame, But i dont'understand the error message my program is as follows group1<-gl(2,20) fun<-function(x){ m<-data.frame(group1,x) #anova(aov(x ~ group1, m)) t.est(x ~ group1,m) } ttest<- apply(data, 1, fun) Error in t.test.default(x = c(1, 1,
1999 Aug 31
1
basic help
Sorry to ask this but does anyone knows a good text that helps with the basic programming side of R. I understand the statistics behind most of R but i have real difficulty with the data types and how R views them. As a part of that could you help me with another problem. I know how to read data in from a file in terms of read.table but how do i single a column out or even just download a