Displaying 20 results from an estimated 2000 matches similar to: "help on understanding a code"
2009 May 31
2
convert the contents of a date.frame to a matrix
Dear R user,
I am trying to convert the contents of a date.frame to a matrix. Since there
are negative values in the date.frame, when I use data.matrix(x,
rownames.force = NA), the resulting matrix is not the same as the original
one. Basically I think R treats the numbers in the date.frame as character
and converts it to corresponding numerics.
Any idea on this issue?
Many Thanks,
Hongyuan
2016 Jul 04
2
cat() in proc.time?
Does anyone know if there's a reason that proc.time() uses cat()
rather than message() to print the output when there has been an error
in the process of timing?
line 31 of time.R,
https://github.com/wch/r-source/blob/e5b21d0397c607883ff25cca379687b86933d730/src/library/base/R/time.R#L31
on.exit(cat("Timing stopped at:", ppt(proc.time() - time), "\n"))
This means that
2006 Dec 15
6
Query regarding linking R with Matlab
Thank you sir for your prompt reply.
Currently i am stuck at point where I need to call an available Matlab program from an R 2.4.0 interface. How can I do this? I have downloaded the R.matlab file and also the manual in pdf. But still i am not able to get through the problem. I will be grateful to you if you can elaborate me on this.
Awaiting your reply,
regards,
Bhanu Kalyan K
2016 Jul 17
1
cat() in system.time() ?
On Fri, 15 Jul 2016, Martin Maechler wrote:
> Hi Ben (and everyone else),
>
> as this did not attract attention yet, let me start
>
>>>>>> Ben Bolker <bbolker at gmail.com>
>>>>>> on Mon, 4 Jul 2016 11:49:40 -0400 writes:
>
> > Does anyone know if there's a reason that proc.time() uses cat()
> > rather than
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
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
2002 Aug 12
1
Select exactly n elements of a vector
In discussing permutation tests, _Modern Applied Statistics With S Plus_ suggests this (IMHO) rather elegant approach to generating a distribution of t-tests:
d<- ...some data...
ttest <- function(x) mean(x)/sqrt(var(x)/length(x))
n<-1000
res<-numeric(n)
for(i in 1:n) res[i] <- ttest(x<-d*sign(runif(10)-0.5)
The problem is that the sign(runif) results in random permutation of
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
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
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 <-
2007 May 04
3
Error in if (!length(fname) || !any(fname == zname)) { :
Dear R users,
I tried to fit a cox proportional hazard model to get estimation of stratified survival probability. my R code is as follows:
cph(Surv(time.sur, status.sur)~ strat(colon[,13])+colon[,18] +colon[,20]+colon[,9], surv=TRUE)
Error in if (!length(fname) || !any(fname == zname)) { :
missing value where TRUE/FALSE needed
Here colon[,13] is the one that I want to stratify and the
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,
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
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
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 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,
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
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
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