Displaying 20 results from an estimated 1000 matches similar to: "Superimposing Line over Histogram in Density Plot"
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
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 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 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 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
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 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)
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 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 10
1
Concat Multiple Plots into one PNG figure
Dear experts,
I tried to put the two plots into one final PNG figure
with the following script.
However instead of giving 2 plots in one figure,
it only gives the the last plot in one figure.
What's wrong with my script below?
__BEGIN__
in_fname <- paste("mydata.txt.",sep="")
out_fname <- paste("finalplot.png",sep="")
dat <-
2008 Oct 21
5
how to plot the histogram and the curve in the same graph
i want to plot the histogram and the curve in the same graph.if i have a set
of data ,i plot the histogram and also want to see what distribution it
was.So i want to plot the curve to know what distribution it like.
--
View this message in context: http://www.nabble.com/how-to-plot-the-histogram-and-the-curve-in--the-same-graph-tp20082506p20082506.html
Sent from the R help mailing list archive at
2009 Sep 02
1
Howto Superimpose Multiple Density Curves Into One Plot
I have a data that looks like this:
http://dpaste.com/88561/plain/
And I intend to create multiple density curve into one plot, where each curve
correspond to the unique ID.
I tried to use "sm" package, with this code, but without success.
__BEGIN__
library(sm)
dat <- read.table("mydat.txt");
plotfn <- ("~/Desktop/flowgram_superimposed.pdf");
pdf(plotfn);
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
...
2008 Jun 14
1
plotting regression line
Hello,
I'm trying to plot an exponential regression line through my data
(scatterplot with trend line), but can't find a way to do that. it is to be
the best fit possible.
--
View this message in context: http://www.nabble.com/plotting-regression-line-tp17837683p17837683.html
Sent from the R help mailing list archive at Nabble.com.
2008 Jun 16
2
Creating a Hash from Data.Frame
Hi,
I have the following data frame:
> print(mydatframe)
__DATAFRAME__
V1 V2 V3
1 1007_s_at DDR1 discoidin domain receptor tyrosine kinase 1
2 1053_at RFC2 replication factor C (activator 1) 2, 40kDa
3 117_at HSPA6 heat shock 70kDa protein 6 (HSP70B')
__END__
Is there a way to create a hash with
V2 as Key and V3 as its value?
- Gundala Viswanath
Jakarta - Indonesia
2008 Jul 05
3
trying to superimpose a line plot onto a histogram
Hello,
I'm trying to superimpose a line plot onto a histogram but I'm not having
any luck. I've attached the dataset. What I did was:
> hist(data,freq=F)
Now I'm trying to superimpose the following points with a line connecting
them onto the histogram:
x y
100 0.535665393824959
200 0.212744329736556
300 0.0844933242968584
400 0.0335572838043417
500
2009 Jan 05
1
Process File Line By Line Without Slurping into Object
Dear all,
In general practice one would slurp the whole file
using this method before processing the data:
dat <- read.table(filename)
or variations of it.
Is there a way we can access the file line by line
without slurping/storing them into object?
I am thinking something like this in Perl:
__BEGIN__
open INFILE, '<' , 'filename.txt' or die $!;
while (<INFILE>) {
2008 Jun 16
1
Separator with " | " for read.table
Hi,
I have the following data file to be parsed and captured as a data frame:
__DATA__
#GDS_ID GENE_NAME GENE_DESCRIPTION GENE_FUNCTION
1007_s_at | DDR1 | discoidin domain receptor tyrosine kinase 1 | protein-coding
1053_at | RFC2 | replication factor C (activator 1) 2, 40kDa | protein-coding
117_at | HSPA6 | heat shock 70kDa protein 6 (HSP70B') | protein-coding
__END__
In particular it is
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 21
1
Howto Restart A Function with Try-Error Catch
Hi all,
I have a function - let's call it "myfunction". This function is based
on some random
number generator. Now, once in a while the function will break/crash depending
on the random number it generate inside the function.
To avoid the problem, what I intend to do is the following:
1. Catch the try-error using class.
2. Redo the function if it returns "try-error"
3.