Displaying 20 results from an estimated 7000 matches similar to: "Howto reduce number of ticks in X, Y axis while still containing all the data"
2008 Dec 21
3
Globbing Files in R
Dear all,
For example I want to process set of files.
Typically Perl's idiom would be:
__BEGIN__
@files = glob("/mydir/*.txt");
foreach my $file (@files) {
# process the file
}
__END__
What's the R's way to do that?
- Gundala Viswanath
Jakarta - Indonesia
2008 Aug 05
2
Iterating Named List
Hi all,
I have the following named list:
> print(y)
$`200052_s_at`
[1] -1066.975 -1063.893 -1062.815 -1062.121 -1059.004
$`200071_at`
[1] -959.823 -953.980 -953.886 -948.781 -974.890
$`200084_at`
[1] -1135.804 -1132.863 -1128.197 -1128.633 -1125.890
What I want to do is to iterate this name list and process its members.
To do that I attempt the following code (but failed):
__BEGIN__
ny
2008 Jun 23
2
Pairwise Partitioning of a Vector
Hi,
How can I partitioned an example vector like this
> print(myvector)
[1] 30.9 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9
into the following pairwise partition:
PAIR1
part1 = 30.9
part2 = 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9
PAIR2
part1 = 30.9 60.1
part2 = 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9
....
PAIR9
part1 = 30.9
2008 Jun 12
1
Data.matrix fail to convert data.frame into matrix
Hi,
With the following codes, I attempt to convert
the data.frame into a matrix.
However I notice that data.matrix function doesn't
seem to work.
__ BEGIN__
dat <- read.table("mydata", comment.char = "!" , na.strings = "null");
# Select n-genes by random sample
# n = 1
nosamp <- 1
geneid <- sequence(nrow(dat))
geneid.samp <- sample(geneid,nosamp)
2009 Jan 08
2
Faster Printing Alternatives to 'cat'
Dear all,
I found that printing with 'cat' is very slow.
For example in my machine this snippet
__BEGIN__
# I need to resolve to use this type of loop.
# because using write(), I need to create a matrix which
# consumes so much memory. Note that "foo, bar, qux" object
# is already very large (>2Gb)
for ( s in 1:length(x) ) {
2008 Jun 16
4
Superimposing Line over Histogram in Density Plot
Hi,
Currently I have a density plot generated with this
snippet.
Is there a way I can add a line curve on top of it?
I mean in one figure
__BEGIN__
myhist <- hist(x
col="blue",
main = "Density Plot",
xlab = "Exp Level",
)
__END__
- Gundala Viswanath
Jakarta - Indonesia
2009 Jan 09
3
Pack and Unpack Strings in R
Dear all,
Does R has any function/package that can pack
and unpack string into bit size?
The reason I want to do this in R is that R
has much more native statistical function than Perl.
Yet the data I need to process is so large that it
required me to compress it into smaller unit -> process it -> finally
recover them back again into string with new information.
In Perl the
2008 Jun 11
3
Finding Coordinate of Max/Min Value in a Data Frame
Hi,
Suppose I have the following data frame.
__BEGIN__
> library(MASS)
> data(crabs)
> crab.pca <- prcomp(crabs[,4:8],retx=TRUE)
> crab.pca$rotation
PC1 PC2 PC3 PC4 PC5
FL 0.2889810 0.3232500 -0.5071698 0.7342907 0.1248816
RW 0.1972824 0.8647159 0.4141356 -0.1483092 -0.1408623
CL 0.5993986 -0.1982263 -0.1753299 -0.1435941 -0.7416656
CW
2008 Aug 05
1
About Creating a List by Parsing Text
Hi all,
I have the following data in which I want to parse and
store them in a list
__DATA__
> print(comp.ll)
[1] "\tGene 11340 211952_at RANBP5 k= 1 LL= -970.692 "
[2] "\tGene 11340 211952_at RANBP5 k= 2 LL= -965.35 "
[3] "\tGene 11340 211952_at RANBP5 k= 3 LL= -963.669 "
[4] "\tGene 12682 213301_x_at TRIM24 k= 1 LL= -948.527 "
2008 Jun 19
2
Create Matrix from Loop of Vectors, Sort It and Pick Top-K
Hi,
I have the following dataset (simplified for example).
__DATA__
300.35 200.25 104.30
22.00 31.12 89.99
444.50 22.10 43.00
22.10 200.55 66.77
Now from that I wish to do the following:
1. Compute variance of each row
2. Pick top-2 row with highest variance
3. Store those selected rows for further processing
To achieve this, I tried to: a) read the table and compute
variance for each row,
2008 Dec 22
3
Convert ASCII string to Decimal in R (vice versa) was: Hex
Hi Dieter,
Sorry my mistake. I wanted to convert them
into Decimal (not Hexadecimal).
Given this string, the desired answer follows:
> ascii_str <- "ORQ>IK"
79 82 81 62 73 75
> ascii_str2 <- "FDC"
70 68 67
- Gundala Viswanath
Jakarta - Indonesia
On Mon, Dec 22, 2008 at 5:49 PM, Dieter Menne
<dieter.menne at menne-biomed.de> wrote:
> Gundala
2008 Jul 01
1
Plotting Bi-Gamma Distribution
Hi all,
I've tried to plot a vector which has two peaks in the density.
This link shows the figure.
http://docs.google.com/View?docid=dcvdrfrh_1dk9r2rc7
The red line is normal curve and green line is gamma curve.
Notice that red line can correctly fit the histogram that has two peaks
(i.e. red curve also has two peaks).
But the gamma curve there only has one curve.
Is there a way I can
2009 Mar 19
1
Simple Plot with Grid's Viewport
Dear all,
I have the following code that try to plot
simple sinus curve into 2x2 grid in 1 page.
But this code of mine create 4 plots in 1 page
each. What's wrong with my approach?
__BEGIN__
library(lattice)
library(grid)
test.plot <- function(x,y) {
pushViewport(viewport(layout.pos.col=x, layout.pos.row=y))
pushViewport(viewport(width=0.6, height=0.6));
plot(sin,-pi,2*pi, main=
2008 Jun 24
5
Measuring Goodness of a Matrix
Hi all,
Suppose I have 2 matrices A and B.
And I want to measure how good each of this matrix is.
So I intend to compare A and B with another "gold standard"
matrix X. Meaning the more similar a matrix to X the better it is.
What is the common way in R to
measure matrix similarity (ie. A vs X, and B vs X) ?
- Gundala Viswanath
Jakarta - Indonesia
2008 Jul 07
4
Plot Mixtures of Synthetically Generated Gamma Distributions
Hi,
I have the following vector
which is created from 3 distinct distribution (three components) of gamma:
x=c(rgamma(30,shape=.2,scale=14),rgamma(30,shape=12,scale=10),rgamma(30,shape=5,scale=6))
I want to plot the density curve of X, in a way that it shows
a distinct 3 curves that represent each component.
How can I do that?
I tried this but doesn't work:
lines(density(x))
Please
2008 Aug 01
3
Grouping Index of Matrix Based on Certain Condition
Hi,
I have the following (M x N) matrix, where M = 10 and N =2
What I intend to do is to group index of (M) based on this condition
of "x_mn" , namely
For each M,
If x_m1 > x_m2, assign index of M to Group1
otherwise assign index of M into Group 2
> x
[,1] [,2]
[1,] 4.482909e-01 0.55170907
[2,] 9.479594e-01 0.05204063
[3,] 8.923553e-01 0.10764474
2008 Jun 23
3
Getting only label column of a data frame
Hi,
How can I extract the label only from a given data frame.
Fore example from this data frame.
> print(dataf)
V1 V2 V3 V4 V5 V6 V7 V8 V9
11145 14.3 17.1 31.2 41.7 45.8 49.8 68.6 70.6 72.9
3545 10.2 15.6 20.9 23.2 31.4 31.7 36.2 48.4 51.9
8951 15.2 17.5 20.0 21.4 32.4
2008 May 29
2
"Levels" error after printing
Hi all,
After running this code (attaches is the input file):
dat <- read.table("gene_prob.txt", sep = "\t")
n <- length(dat$V1)
print(n)
print(dat$V1)
I get this print out.
......
[8541] LOC552889 GPR15 SLC2A11 GRIP2 SGEF
[8546] PIK3IP1 RPS27 AQP7
8548 Levels: 3.8-1 A2M A4GALT A4GNT AAAS AAK1 AAMP AANAT AARSD1 AASS
...
2009 Jan 06
5
Changing Matrix Header
Dear all,
I have the following matrix.
> dat
A A A A A A A A A A
[1,] 0 0 0 0 0 0 0 0 0 0
[2,] 0 0 0 0 0 0 0 0 0 1
[3,] 0 0 0 0 0 0 0 0 0 2
How can I change it into:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0 0 0 0 0 0 0 0 0 0
[2,] 0 0 0 0 0 0 0 0 0 1
2008 Dec 24
2
Compressing String in R
Dear all,
What's the R way to compress the string into smaller 2~3 char/digit length.
In particular I want to compress string of length >=30 characters,
e.g. ACGATACGGCGACCACCGAGATCTACACTCTTCC
The reason I want to do that is because, there are billions
of such string I want to print out. And I need to save disk space.
- Gundala Viswanath
Jakarta - Indonesia