Displaying 20 results from an estimated 500 matches similar to: "Writing a list to a file !"
2005 Dec 06
2
how to extract row& col names from a matrix
Dear all,
I like to extract row names & column names from the named matrix......
like......
a<-matrix(1:6,2)
ro<-c("aa","bb")
co<-c("dd","ee","ff")
dimnames(a)<-list(ro,co)
a
>
dd ee ff
aa 1 3 5
bb 2 4 6
from the above matrix "a"
I like to extract
rownames separately like
2005 Dec 17
1
How to reverse the sequence of axis Y ??
Hello R-users!
My (simple?) doubt: How to reverse the sequence of axis Y ??
the diagram below illustrate my idea...
(default)
|
|
. |
. |
. |
3 |
2 |
1 |
0 +----------------------------
0 1 2 3 ...
like I want...
0 |
1 |
2 |
3 |
. |
. |
. |
|
+----------------------------
0 1 2 3 ...
thanks in advance
klebyn
2005 Dec 04
4
Construct a data.frame in a FOR-loop
Say I have a FOR-loop for computing powers (just a trivial example)
for(i in 1:5)
{
x<-i^2
y<-i^3
}
How can I create a data.frame and a 3D plot of (i,x(i),y(i)), i.e. for
each iteration
Thanks,
Serguei Kaniovski
--
___________________________________________________________________
??sterreichisches Institut f??r Wirtschaftsforschung (WIFO)
Name: Serguei Kaniovski
2005 Dec 06
4
R newbie...
Hello,
I'm a new user...
I have a function :
calculate <- function(x,y)
{
z <- x + y
}
I would like to use the result (z) with another function :
recalculate <- function(...)
{
a <- z^2
}
But R says that z does not exist...
How can I use z in an another function ?
Thank you for your answer...
--
David
[[alternative HTML version deleted]]
2005 Dec 09
3
R-how to group the data
Hello R - users,
This may sound simple to may people:
I have a list of data as follows
type value
y 7
y 7
y 8
y 8
y 8
y 9
y 9
y 9
y 9
y 10
y 10
y 10
y 10
y 11
y 11
y 12
y 12
y 14
y 14
y 14
y 15
y 17
y 20
y 20
y 20
y 20
y 25
2005 Dec 15
5
How to simulate correlated data
Hello there,
I would like to simulate X --Normal (20, 5)
Y-- Normal (40, 10)
and the correlation between X and Y is 0.6. How do I do it in R?
Thank you very much
Lisa Wang Msc.
Princess Margaret Hospital
Toronto, Ca
2005 Nov 28
6
How define global Variable?
Hello,
I try to define a global variable.
My example:
R> a <- "old"
R> test <- function () { a <- "new" }
R> test()
R> a # shoud be "new"
This doesn't work. I would like to modify the variable "a" in a
procedure. How can I do that.
Thank you for helping.
Sven Kn侟ppel (Germany-Berlin)
2005 Nov 04
2
Simplify iterative programming
Dear,
I am looking for the simplification of a formula to improve the
calculation speed of my program. Therefore I want to simplify the
following formula:
H = sum{i=0..n-1 , [ sum {j=0..m-1 , sqrt ( (Ai - Bj)^2 + (Ci -
Dj)^2) } ] }
where:
A, C = two vectors (with numerical data) of length n
B, D = two vectors (with numerical data) of length m
sqrt = square root
Ai = element of A with index
2005 Nov 12
4
matrix subset
Dear R-helpers,
I apologize for this certainly simple question.
I have the following R lines :
> m = matrix(1:12 , 3 , 4);
> m
[,1] [,2] [,3] [,4]
[1,] 1 4 7 10
[2,] 2 5 8 11
[3,] 3 6 9 12
> m1 = subset(m , m[,2]>=5);
> m1
[1] 2 3 5 6 8 9 11 12
but in fact I would appreciate m1 to be also a matrix,
and thus would like to get :
2008 Jul 10
2
false discovery rate !
Dear All,
It is not a typical R question (though I use R for this) but I thought someone will help me. For the list of P values, I have calculated FDR using p.adjust() in R (bioconductor). But my FDR values are same for all the P values. When do we get same FDR values? Does the smallest P values should less than 1/N? (where N is the number of P values)
Thanks in advance.
Kind regards,
Ezhil
2007 Mar 28
5
Large matrix into a vector
Hi,
I have a matrix HR(9x27). I would like to make a
single vector with elements: t(HR[,1]) followed by
t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
way of converting this matrix into a vector rather
doing something like c(t(HR[,1]), t(HR[,2]), t(HR[,3])
..)?
Thanks in Advance.
Kind regards,
Ezhil
____________________________________________________________________________________
2005 Oct 26
3
Storing graphics output in PNG format.
Dear All,
How can I store hist() or any plot output graphics in
PNG format? I tried with bitmap() but not getting the
result. Appreciate your help on fixing this.
Thanks in Advance.
Regrads,
Ezhil
2008 Nov 21
2
Extracting diagonal matrix
Dear All,
I have a correlation matrix of size 100 x 100 and would like to extract the diagonal matrix from it. I have used the for loop to store tha correlation values of the diagonal matrix. Is there a 'R way' of doing this?
Thanks in advance.
Kind regards,
Ezhil
2009 Sep 11
3
Working with large matrix
Dear All,
I have large matrix (46000 x 11250). I would like to do the linear regression for each row. I wrote a simple function that has lm() and used apply(mat,1,func). The issue is that it takes ages to load the file and also to finish the lm. I am using LINUX 64 bit with 32G mem. Is there an elegant and fast way of completing this task?
Thanks in advance.
Kind regards,
Ezhil
2012 Mar 08
4
Correlation between 2 matrices but with subset of variables
Dear All,
I have two matrices A (40 x 732) and B (40 x 1230) and would like to calculate correlation between them. I can use: cor(A,B, method="pearson") to calculate correlation between all possible pairs. But the issue is that there is one-many specific mappings between A and B and I just need to calculate correlations for those pairs (not all). Some variables in A (proteins, say p1)
2008 Jul 15
2
Problem installing R on openSUSE 10.3
Dear All,
I am trying to install R 2.7 on my openSUSE 10.3. I have faithfully followed instruction at http://cran.r-project.org/bin/linux/suse/ReadMe.txt. I have downloaded all the RPMs but still R complains about:
libtcl8.4.so is needed by R-base-2.7.1-6.1.i586
I searched for this library and found a one, tcl-8.4.15-22.i586.rpm at openSUSE distribution site and installed. But R still complains
2012 May 03
1
Identifying case by groups in a data frame
Hi everyone,
I would like to identify the case by groups that is just bigger that
avg plus sd. For example, using species as group and petal.wid as my
variable in the iris data.
What's the better way to doit? creating a function?
So,the question is to identify the single element of each species that is just larger than a cut-off point (i.e. larger than mean + sd)
I made this, but I can not
2007 Apr 27
2
Scatter Plot in R - Help
Dear All,
I am using the following commands to do the scatter
plot of two vectors, say X and Y.
plot(X,Y, col="blue")
abline(a=1,b=1, col="red")
abline(a=-1,b=1, col="green")
I would like to split the scatter plot into 3 part
with 3 different colors: (i) points lies between 2
lines, (ii) points above line 1, and (iii) points
below line 2. I am struggling to do
2010 Feb 16
3
error : unused argument(s) when boxplot
Dear all,
I am a total beginner in R, so sorry if this is the wrong place. I am using R 2.10.1 on a Mac (Mac OS 10.6.2).
I have this small dataset :
growth sugar
75 C
72 C
73 C
61 F
67 F
64 F
62 S
63 S
I have no problem reading the table, or getting the summary, but if I try boxplot(growth~sugar, ylab="growth", xlab="sugar", data=Dataset), I have the following error :
2012 Mar 10
2
Issues in installing rgl in Mac OS 10.6.8
Dear All,
I am trying to install rgl on my mac notebook from the source file. I tried using: /usr/bin/R64 CMD INSTALL rgl_0.92.798.tar.gz and get the following
error message:
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ?rgl?
* removing
?/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl?
*