Displaying 20 results from an estimated 20000 matches similar to: "How to make t.test handle "NA" and "essentially constant values" ?"
2008 Feb 05
2
How to generate table output of t-test
Hi,
Given
test <- matrix(c(1, 1,2,2), 2,2)
t <- apply(test, 1, t.test)
How can I obtain a table of p-values, confidence interval etc, instead of
[[1]]
One Sample t-test
data: newX[, i]
t = 3, df = 1, p-value = 0.2048
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-4.853102 7.853102
sample estimates:
mean of x
1.5
[[2]]
2008 Jan 29
2
add/subtract matrices, ignoring NA or missing values
Hi,
For example, given two 2x2 matrices m1 and m2. I would like to add/subtract
element by element
> m1
[,1] [,2]
[1,] NA NA
[2,] 1 2
> m2
[,1] [,2]
[1,] 1 NA
[2,] NA 2
> m1 + m2
[,1] [,2]
[1,] NA NA
[2,] NA 4
How can I ignore the NA, and get this ? Hope the solution can be extended to
subtract and modulo also.
[,1] [,2]
2008 Feb 04
3
counts of each column that are not NA, and/or greater than column means
Hi,
Given a test matrix, test <- matrix(c(1,2,3,NA,2,3,NA,NA,2), 3,3)
A) How to compute the counts of each column (excluding the NA) i.e., 3, 2, 1
B) How to compute the counts of each column (excluding the NA) that are
greater than the column means ? i.e., 1, 1, 0
I could write a for loop, but hope to use better alternative.
[[alternative HTML version deleted]]
2008 Jul 22
4
Is text(..., adj) upside down? (Or am I?)
?text says
"'adj' allows _adj_ustment of the text with respect to '(x,y)'.
Values of 0, 0.5, and 1 specify left/bottom, middle and
right/top,
respectively."
But it looks like 0, 1 specify top, bottom respectively in the y
direction.
plot(1:4)
text(2,2, "adj=c(0,0)", adj=c(0,0))
text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red
2005 Apr 15
1
treatment of zero and negative elements in matrix indices
Matrix indexing seems to give rather "variable" results when zeros or
negative values are included among the indices (in terms of both error
messages and in terms of the number of returned values when there is no
error message).
Is this the intended behavior?
I couldn't see any comments about zeros or negative values in matrix
indices in either ?"[" or Section 3.4.2
2007 Feb 08
1
Re : Re: setting a number of values to NA over a data.frame.
Hi again,
Awfully sorry John, I should have been sleeping and did not see your
full post....
here is a way, unless I miss the point again :
fake<-as.data.frame(cbind(seq(1,10,by=1),c(rep(1,4),rep(0,4),rep(2,2))))
# from my previous post
# one moree column this time !
fake3<-cbind(fake,fake$V2)
index<-c(2,3)
fake3[,index][fake3[,index]==0]<-NA
not nice, but seems to do the job.
2011 Sep 05
5
Unable to connect
Hello,
I have been using xen under open-suse 11.4 for almost half
an year now. This week I had to reformat the provider and so I did
install everything again (now there is a dual boot and microsoft windows
server 2008 installed on the first half partition of the disk) again
open-suse 11.4 and xen. I do start the xen kernel at grub but when I try
to connect and/or creat a new domU the folling
2005 Jul 05
2
Derivative of a function
Suppose I have a simple function that returns a matrix, such as:
test <- function(x){ return(matrix(c(x,x^2,x^3,x^4),2,2)) }
so that test returns:
[ x x^3 ]
[ x^2 x^4 ]
Is it possible for me to get the derivative of an expression such as:
c(1,0) %*% test() %*% c(0,1)
The vectors are used just to "index" the matrix.
I don't want a value, but the expression to work with
2008 Feb 14
1
How to check cy5 and cy3 values were lowess normalized
Hi,
I have some microarray data, cy5 and cy3 values are in log2. Is there a
way to check they have undergone lowess normalization ?
Thanks
Stanley
[[alternative HTML version deleted]]
2008 Feb 13
3
indices of rows containing one or more elements >0
Hi,
Given test <- matrix(c(0,2,0,1,3,5), 3,2)
> test[test>0]
[1] 2 1 3 5
These are values >0
> which(test>0)
[1] 2 4 5 6
These are array indices of those values >0
> which(apply(test>0, 1, all))
[1] 2
This gives the row whose elements are all >0
I can't seem to get indices of rows containing one or more elements >0
[[alternative HTML version deleted]]
2007 Feb 08
1
Re : Re: setting a number of values to NA over a data.frame.
Hi John,
Unless I miss a point, why dont you try something like :
# some fake data
> fake<-as.data.frame(cbind(seq(1,10,by=1),c(rep(1,4),rep(0,4),rep(2,2))))
V1 V2
1 1 1
2 2 1
3 3 1
4 4 1
5 5 0
6 6 0
7 7 0
8 8 0
9 9 2
10 10 2
# change 0 by NA
> fake[fake==0]<-NA # or fake$V2[fake$V2==0]<-NA if you
2012 Feb 17
3
editing import data, strings
Regards.
I'm a beginner in programing, so I have a basic question for you.
If someone could help me please..
I want to create a function, which will be able to export files from excel.
I tried with
a <- read.csv(file, sep =",", as.is = TRUE, row.names = 1, header = TRUE),
.. but instead of numbers, it gives me strings for example: "299,311".
I can handle this string
2005 Apr 29
0
handling of zero and negative indices in src/main/subscript.c:mat2indsub() (PR#7824)
This message contains a description of what looks like a bug, examples
of the suspect behavior, a proposed change to the C code to change this
behavior, example of behavior with the fix, and suggestions for 3 places
to update the documentation to reflect the proposed behavior. It is
submitted for consideration for inclusion in R. Comments are requested.
Currently, the code for subscripting
2001 Dec 31
2
iproute & kernel 2.4.17
hi all..
i just noticed while patching ulog(patch-o-matic) with
kernel-2.4.17--->patch not applied !
would be gratefull if someone can help on this
( Gurus ''am not a programmer pls.):-(
arindam
2003 Jan 20
2
bug desc.
hello.
i am running samba-2.2.7 on a RH7.2 Kernel 2.4.7-10.
i am using the left side (the folders tree section) of the windows explorer
on WinNT4 SP6 station, and I move folders arround. most of the times after i
move a folder there is no change in the presentation, in order to see the
new folders tree i have to refresh the screen (F5).
i will be gratefull for any advice / replay.
tx.
2005 May 06
0
(PR#7824) handling of zero and negative indices in
I've put this in (with some different wording). Although S blithely
accepts mis-dimensioned index matrices I agree this is wrong and have made
it an error.
On Fri, 29 Apr 2005 tplate@acm.org wrote:
> This message contains a description of what looks like a bug, examples
> of the suspect behavior, a proposed change to the C code to change this
> behavior, example of behavior with
2009 Nov 04
1
Search values and create a new matrix
Hi
You wrotte me in R help and I´m very gratefull.
I couldn´t reply because an illness.
I writte this to see if you can help to solve. I´m a begginer (I´m 20 years
old ) but I´m trying to learn more about this program also I´m learning
Octave.
I need to create a matrix in R whose values depends on the values of other
matrix. You see:
I have a first "R" matrix whose first row and
2011 Jan 26
2
a problem with is.na
Hello,
I have observed the following odd behavior of "is.na( )" and hope someone
can give me an explanation
Example:
X1=rep(1:2,5)[-1]
X2=rep(1:5,rep(2,5))[-1]
y= runif(9)
y[3]=NA
xtabs(y~x1+x2)
Now
xtabs(is.na(y)~x1+x2) says that cell 2,2 is NA
x2
x1 1 2
1 0 0
2 0 1
3 0 0
4 0 0
5 0 0
Whereas
xtabs(!is.na(y)~x1+x2) says that all but cell 1,1 and 2,2 are not NA
x2
2009 Nov 07
2
plot.window arguments being ignored?
Hi,
Why, when I run the script below, is my y-axis range command being ignored?
I.e., the y axis graphed consistently fits the line specified in the plot
command, but never fits the line I'm trying to add in the subsequent line
command.
This is my first R script, so if I'm doing anything else wacky that jumps
out, please let me know. I'm an advanced Stata user, but R is new to me.
2006 Sep 25
2
paste? 'cmd /c "c:\\pheno\\whap --file c:\\pheno\\smri --alt 1"'
Dear R users,
This command works (calling a programm -called whap- with file specifiers etc.):
>system('cmd /c "c:\\pheno\\whap --file c:\\pheno\\smri --alt 1 --perm 500"', intern=TRUE)
Now I need to call it from a loop to replace the "1" by different number, however I get lost using the quotes:
I tried numerous versions of:
>i<-1