[R] How to perform clustering without removing rows where NA is present in R

2013-12-07 Thread Gundala Viswanath
I have a data which contain some NA value in their elements. What I want to do is to **perform clustering without removing rows** where the NA is present. I understand that `gower` distance measure in `daisy` allow such situation. But why my code below doesn't work? __BEGIN__ # plot heat map

[R] Why daisy() in cluster library failed to exclude NA when computing dissimilarity

2013-12-07 Thread Gundala Viswanath
Hi, According to daisy function from cluster documentation, it can compute dissimilarity when NA (missing) value(s) is present. http://stat.ethz.ch/R-manual/R-devel/library/cluster/html/daisy.html But why when I tried this code library(cluster) x - c(1.115,NA,NA,0.971,NA) y -

[R] Replacing part of delimited string with R's regex

2013-07-10 Thread Gundala Viswanath
I have the following list of strings: name - c(hsa-miR-555p,hsa-miR-519b-3p,hsa-let-7a) What I want to do is for each of the above strings replace the text after second delimiter with zzz. Yielding: hsa-miR-zzz hsa-miR-zzz hsa-let-zzz What's the way to do it? [[alternative HTML

[R] How to include ifelse condition to adjust QPLOT font size

2013-06-25 Thread Gundala Viswanath
I have a data which I plot using this code. Attached is the plot _BEGIN_ library(ggplot2) dat.m - read.delim(http://dpaste.com/1269939/plain/,sep=;) colnames(dat.m) - c(ensg,mirna_hgc,variable,value) dat.m.y - subset(dat.m,dat.m$variable==y) qplot(value,data=dat.m.y, geom=bar, origin=-0.05,

[R] All against all correlation matrix with GGPLOT Facet

2013-06-09 Thread Gundala Viswanath
I have the following data: v - rnorm(13) w - rnorm(13) x - rnorm(13) y - rnorm(13) z - rnorm(13) Using GGPLOT facet, what I want to do is to create a 5*5 matrix, where each cells plot the correlation between each pair of the above data. E.g. v-v,v-w; v-x,...,z-z What's the way to do it?

[R] How to expand.grid with string elements (the half!)

2013-06-09 Thread Gundala Viswanath
I have the following result of expand grid: d - expand.grid(c(x,y,z),c(x,y,z)) What I want is to create a combination of strings but only the half of the all combinations: Var1 Var2 1xx 2yx 3 yy 4 zy 5 xz 6zz What's the way to do it? G.V.

[R] Choice of statistical test (in R) of two apparently different distributions

2013-05-08 Thread Gundala Viswanath
I have the following list of data each has 10 samples. The values indicate binding strength of a particular molecule. What I want so show is that 'x' is statistically different from 'y', 'z' and 'w'. Which it does if you look at X it has more values greater than zero (2.8,1.00,5.4, etc) than

[R] Standard Error and P-Value from cor()

2013-04-18 Thread Gundala Viswanath
Is there a native way to produce SE of correlation in R's cor() functions and p-value from T-test? As explained in this web http://www.sjsu.edu/faculty/gerstman/StatPrimer/correlation.pdf (page 14.6) The standard error is sqrt((1-r^2)/(n-2)), where n- is the number of sample. - G.V.

[R] How to remove all characters after comma in R

2013-04-01 Thread Gundala Viswanath
I have the following list of strings: x - c(foo, foo2, foo3, bar, qux, qux1) what I want to do is to obtain foo, bar qux Namely for each element in the vector obtain only string before the first comma. What's the way to do it? - G.V. [[alternative HTML version deleted]]

[R] Transforming 4x3 data frame into 2 column df in R

2013-01-31 Thread Gundala Viswanath
I have the following data frame: foo w x y z n 1.51550092 1.4337572 1.2791624 1.1771230 q 0.09977303 0.8173761 1.6123402 0.1510737 r 1.17083866 1.2469347 0.8712135 0.8488029 What I want to do is to change it into : newdf 1 nw 1.51550092 2 q w

[R] Best way to plot normalization in R

2013-01-28 Thread Gundala Viswanath
I have a data that looks like this: mRNA Value --- mRNA1 30 mRNA2 199 ...... ... mRNA1000 13 Then I'll normalize the value based on the

[R] R package for normalizing microarray with few samples

2013-01-27 Thread Gundala Viswanath
I have only *two* datasets from normal and cancer samples. CancerNormal -- mRNA1 3049 mRNA2 199200 ... ... ... mRNA1000 1340 Each samples contain several thousan mRNA microarray

[R] Alternative to heat.color(x)

2012-05-15 Thread Gundala Viswanath
The colors generated by heat.color(x) is too saturated. Where is there alternative command similar to that but non-heated' which also I can input the value 'x'. - G.V. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Renaming names in R matrix

2012-05-15 Thread Gundala Viswanath
I have the following matrix: dat [,1] [,2] [,3][,4] foo 0.7574657 0.2104075 0.02922241 0.002705617 foo 0.000 0.000 0. 0.0 foo 0.000 0.000 0. 0.0 foo 0.000 0.000 0. 0.0 foo 0.000

[R] How to use the value of rect to determine the location of legend

2012-05-15 Thread Gundala Viswanath
Given the attached plot, how can I locate the center text with Mean and SD so that it can be placed exactly under ---emp.? The current code I have is this: L = list(bquote(Em.Mean ==.(new_avg)),bquote(Em.SD==.(new_std)), bquote(Th.Mean ==.(theor_avg)), bquote(Th.SD==.(theor_sd)))

[R] How to plot diagonal line at any coordinate range in R

2012-03-11 Thread Gundala Viswanath
Dear expert How can we plot diagonal across (from bottom-left-hand corner to top right-hand corner), at any given coordinate range For example plot(c(-2,3), c(-1,5), type = n, xlab=x, ylab=y, asp = 1) or plot(c(0,1000), c(0,334), type = n, xlab=x, ylab=y, asp = 1) I tried abline with the

[R] Howto plot ROC Curve Directly from SN/PPV

2012-02-16 Thread Gundala Viswanath
Dear expert, Given such data: #Cutpoint SN (1-PPV) 5 0.560.01 7 0.780.19 9 0.910.58 How can I plot ROC curve with R that produce similar result like the attached file? I know ROCR package but it doesn't take such input. - GV

[R] How to Create Nested Data Frame

2011-01-31 Thread Gundala Viswanath
Dear Experts, I have a data that looks like this. file1=dat1.tab file2=dat2.tab dat1-read.table(file1) print(dat1) V1 V2 1 1 43 2 1 43 3 1 43 dat2-read.table(file2) print(dat2) V1 V2 1 1 43 2 1 21 3 1 43 4 1 43 5 1 24 6 0 24 The column V1 refer to labels and V2 to

Re: [R] How to Create Nested Data Frame

2011-01-31 Thread Gundala Viswanath
:50, Gundala Viswanath a écrit : Dear Experts, I have a data that looks like this. file1=dat1.tab file2=dat2.tab dat1-read.table(file1) print(dat1)   V1 V2 1  1 43 2  1 43 3  1 43 dat2-read.table(file2) print(dat2)   V1 V2 1  1 43 2  1 21 3  1 43 4  1 43 5  1 24 6  0 24

[R] List of List in Data Frame

2011-01-31 Thread Gundala Viswanath
Dear sirs, I have a data that is generated like this: dat1 - data.frame(V1 = rep(1, 5), V2 = sample(c(40:45), 5)) dat2 - data.frame(V1 = sample(c(0,1), 5, replace = TRUE), V2 = sample(c(40:45), 5, replace = TRUE)) What I want to do is to obtain a data frame that contain list of list. hiv

[R] How to Plot Two Curves Into One Page

2011-01-31 Thread Gundala Viswanath
I have a R script that contain these lines for plotting: plot(foo,lwd=2,lty=3,col=red, main=); plot(bar,lwd=2,lty=3,col=blue); legend(0.6,0.6,c('Default','Probabilistic'), col=c('red','blue'),lwd=3); But it generate 1 file (Rplot.pdf) with two pages. Each page for 1 plot. Is there a way I can

Re: [R] How to Plot Two Curves Into One Page

2011-01-31 Thread Gundala Viswanath
=blue); legend(0.6,0.6,c('Default','Probabilistic'), col=c('red','blue'),lwd=3); A second option would be setting up a suitable layout. For this, please take a look at ?layout. Best, Jorge On Tue, Feb 1, 2011 at 12:20 AM, Gundala Viswanath wrote: I have a R script that contain these lines

[R] Random Integer Number in Uniform Distribution

2010-10-25 Thread Gundala Viswanath
Is there a way to do it? At best what I can achieve is non integer: runif(10, min=1, max=100) [1] 51.959151 56.654146 63.630251 3.172794 4.073018 11.977437 86.601869 [8] 75.788618 11.734361 6.770962 -G.V. __ R-help@r-project.org mailing list

[R] How To Extract Row from A Data Frame

2010-10-03 Thread Gundala Viswanath
I have a data frame that looks like this: print(df) V2 V3 V4 V5 V6 V7 V8 V9V10V11V12 1 FN 8.637 28.890 31.430 31.052 29.878 33.215 32.728 32.187 29.305 31.462 2 FP 19.936 30.284 33.001 35.100 30.238 34.452 35.849 34.185 31.242 35.635 3 TN 0.000 17.190

[R] Accessing Element of a Table

2010-10-01 Thread Gundala Viswanath
I have the following structure: str(propn) table [1:2(1d)] 0.674 0.326 - attr(*, dimnames)=List of 1 ..$ label: chr [1:2] o x print(propn) label o x 0.6738347 0.3261653 How can I access the value of o and x I tried this but fail print(propn$label[,o]; - G.V.

[R] What's the meaning of Species ~ . in IRIS data

2010-09-29 Thread Gundala Viswanath
I am refering to a function call like this: data(iris) x - svmlight(Species ~ ., data = iris) I tried to see the content of it by typing: Species ~ . but it gives nothing. How can I see it's content ? - P.Dubois __ R-help@r-project.org mailing

[R] How to get a proportion of a Vector Member

2010-09-29 Thread Gundala Viswanath
I have a vector that looks like this: foo [1] o o o x o o o o o x x o x How can we find the percentage of o and x in that vector in R? - G.V __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

[R] Accessing Vector of A Data Frame

2010-09-29 Thread Gundala Viswanath
I have a variable that looks like this: print(pred$posterior) ox 1 2.356964e-03 9.976430e-01 2 8.988153e-01 1.011847e-01 3 9.466137e-01 5.338627e-02 4 2.731429e-11 1.00e+00 Now what I want to do is to access o and x How come this approach fail?

[R] Normalizing Vector with Negative Numbers

2010-09-26 Thread Gundala Viswanath
Dear expert, I have a series of number that looks like this x - c(-0.005282, 0.000314, 0.002851, -2.5059217162, -0.007545, -1.0317758496, 0.001598, -1.2981735068, 0.072411) How can I normalize it in R so that the new numbers is ranging from 0 to 1 ? - G.V.

[R] Conditional Splitting a Vectors into Two Vectors

2010-07-06 Thread Gundala Viswanath
Suppose I have two vectors of same dimensions: x -c(0.49534,0.80796,0.93970,0.8) count -c(0,33,0,4) How can I group the vectors 'x' into two vectors: 1. Vector `grzero` that contain value in x with `count` value greater than 0 and 2. Vector `eqzero` with value in x with

[R] Creating DataFrame of Vectors Data Structure for Classification

2010-07-05 Thread Gundala Viswanath
Dear Experts, I have a input file that looks like this -0.438185,svm,1 -0.766791,svm,1 0.695282,svm,-1 0.759100,svm,-1 0.034400,svm,1 0.524807,svm,1 -0.27647800,nn,1 -0.16120810,nn,-1 0.63911350,nn,1 0.400554110,nn,1 0.429192240,nn,-1 0.454239140,nn,1 How can I create a data structure in R so

[R] How to Plot With Different Marker ( ‘x ’ and ‘o’) Based on Condition in R

2010-07-05 Thread Gundala Viswanath
Dear Expert, I have a data that looks like this: for_y_axis -c(0.49534,0.80796,0.93970,0.8) for_x_axis -c(1,2,3,4) count -c(0,33,0,4) What I want to do is to plot the graph using for_x_axis and for_y_axis but will mark each point with o if the value is equal to 0(zero) and with x if

[R] Decreasing Cumsum Function?

2010-03-22 Thread Gundala Viswanath
Hi all, I have a frequency data that looks like this. 3 2 1 5 What I want to get is the decreasing cumulative of this data yielding 11 8 6 5 0 Is there any? I am aware of cumsum(), which will yield 3 5 6 11. But it is not what I want. - G.V. __

[R] How to plot two cumulative frequency graph together

2010-03-18 Thread Gundala Viswanath
Dear masters, I have data that looks like this: #val Freq1 Freq2 0.000 178 202 0.001 4611 5300 0.002 99 112 0.003 26 30 0.004 17 20 0.005 15 20 0.006 11 14 0.007 11 13 0.008 13 13 ...many more lines.. Full data can be found here: http://dpaste.com/173536/plain/ What I intend to do is to have

[R] Filling Empty Column with String in read.table

2009-09-17 Thread Gundala Viswanath
I have a data file that looks like this. __DATA__ D7KAR5Z02F447V 176 G 0.22 D7KAR5Z02J3WLG 94 A 1.0529 D7KAR5Z02F4K6L 198 a 0.13 D7KAR5Z02J4SYO 67 C 0.9528 D7KAR5Z02J4SYO 83 C 1.0129 D7KAR5Z02J4SYO 97 T 0.13 D7KAR5Z02J4SYO 166 A 0.9427 I want the rows

[R] Fastest Way to Divide Elements of Row With Its RowSum

2009-09-16 Thread Gundala Viswanath
I have a data frame (dat). What I want to do is for each row, divide each row with the sum of its row. The number of row can be large 1million. Is there a faster way than doing it this way? datnorm; for (rw in 1:length(dat)) { tmp - dat[rw,]/sum(dat[rw,]) datnorm - rbind(datnorm, tmp);

[R] Truncating (not rounding) scientific value in R

2009-09-08 Thread Gundala Viswanath
How can I truncate the scientific value keeping two digits decimal. For example from: 6.95428812397439e-35 into 6.95e-35 -E.W. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] How Does One Use the Value of Density Function?

2009-09-07 Thread Gundala Viswanath
How do people usually use the result of density function (e.g. dnorm)? Especially when its value can be greater than 1. What do they do with such density 1? dnorm(2.02,2,.24) [1] 1.656498 - G.V. __ R-help@r-project.org mailing list

[R] Function to Normalize Numerical Vector in R

2009-09-07 Thread Gundala Viswanath
Is there any? - G.V. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[R] Best Way to Compute/Approximate(?) Probabilty of a Point in a Given Distribution

2009-09-04 Thread Gundala Viswanath
AFAIK, R only has pnorm which computes the probability of getting a value smaller or equal to x from a normal distribution N[mean,stdev]. For example: R pnorm(0, 4, 10) [1] 0.3446 means there is 34.46% chance of getting a value equal to or smaller than 0 from a N(4, 10) distribution. What I

[R] Subsetting Data Frame based On Specified K Value

2009-09-03 Thread Gundala Viswanath
I have a data that looks like this: http://dpaste.com/88988/plain/ How can I extract/subset the data frame based on selected uniq ID. Let's say I want the first K uniq ID. I want to be able to specify the parameter K here, (i.e. given K=3, we hope to extract dat$V2 = 0,1,2). I'm stuck with this

[R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
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

Re: [R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
-project.org] Namens Gundala Viswanath Verzonden: woensdag 2 september 2009 12:10 Aan: r-h...@stat.math.ethz.ch Onderwerp: [R] 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

Re: [R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: Gundala Viswanath [mailto:gunda...@gmail.com] Verzonden: woensdag 2 september 2009 14:33 Aan: ONKELINX

Re: [R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: Gundala Viswanath [mailto:gunda...@gmail.com] Verzonden: woensdag 2 september 2009 14:47 Aan: ONKELINX, Thierry CC: r-h...@stat.math.ethz.ch Onderwerp: Re: [R] Howto Superimpose Multiple Density Curves Into One Plot Hi

Re: [R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
- Van: Gundala Viswanath [mailto:gunda...@gmail.com] Verzonden: woensdag 2 september 2009 14:54 Aan: ONKELINX, Thierry CC: r-h...@stat.math.ethz.ch Onderwerp: Re: [R] Howto Superimpose Multiple Density Curves Into One Plot str(dat) 'data.frame':   200 obs. of  2 variables:  $ V1: num  0.98

Re: [R] Howto Superimpose Multiple Density Curves Into One Plot

2009-09-02 Thread Gundala Viswanath
is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: Gundala Viswanath [mailto:gunda...@gmail.com] Verzonden

[R] Howto fit normal curve into histogram using GGPLOT2

2009-09-02 Thread Gundala Viswanath
Currently, I am doing it this way. x - mtcars$mpg h-hist(x, breaks=10, col=red, xlab=Miles Per Gallon, main=Histogram with Normal Curve) xfit-seq(min(x),max(x),length=40) yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) yfit - yfit*diff(h$mids[1:2])*length(x) lines(xfit, yfit, col=blue, lwd=2) But

[R] Normalized Y-axis for Histogram Density Plot

2009-09-01 Thread Gundala Viswanath
I have the following data which I tried to draw the probability density plot. Here is the code I have: x - read.table(mydat.txt); d - rep(x$V2,times=x$V3); hist(d,probability=T, xlab=FlowSignal); But why the y-axis range from 0 to 6, instead of 0 to 1? What's the correct way to plot it? #id

[R] How to extract integer in a data frame

2009-04-21 Thread Gundala Viswanath
frame where the entry in V1 has (x.000) as its decimal. yielding wanted_dat V1 V2 V3 1 0.000 2 554889 2 123.000 03209 What's the way to do it in R? - Gundala Viswanath Jakarta - Indonesia __ R-help

[R] Coloring X, Y and Main Label

2009-04-17 Thread Gundala Viswanath
Dear all, I have no problem coloring the axis and plot, following these procedures: http://www.nabble.com/Coloring-X-and-Y-axis-tt22989739r0.html#a22989739 However the X,Y and Main Label stays in black. How can we change their colors? - Gundala Viswanath Jakarta - Indonesia

[R] How to control distance between rows of figures in multiple plots

2009-04-16 Thread Gundala Viswanath
Dear all, I have a plot with 2 x 2 figures matrix in it. pdf(~/Desktop/myplot.pdf,width=13,height=7) par(mfrow=c(2,2)) # follow by some code Now the distance between figures of row 1 and row 2 is too wide. How can I modify? - Gundala Viswanath Jakarta - Indonesia

[R] Coloring X and Y axis

2009-04-10 Thread Gundala Viswanath
Dear all, Is there a way to do it? The following code: pdf(test.pdf) plot(1,1,col=red) dev.off() Only colors the plot into red, but not x and y axis (inclusive the tick marks). - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org

[R] Howto Plot With Transparent Background

2009-04-08 Thread Gundala Viswanath
Is there a way to do it in R? Especially generating plot in EPS/PDF format. By transparent I mean clear (not white) background. I want to attached it to dark PPT slides. - Gundala Viswanath __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] Filling in Gapped Interval of a Data Frame As Series

2009-04-05 Thread Gundala Viswanath
16 6 44.5 17 7 5.00 Is there a way to do it in R? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

[R] Howto Disable Scientific Numeric in X-axis for Plotting

2009-04-02 Thread Gundala Viswanath
- Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible

[R] How to force an point in x-axis to appear in plot

2009-04-02 Thread Gundala Viswanath
marks. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

[R] Barplot With Selected X-Axis Region

2009-03-24 Thread Gundala Viswanath
information, hence I am aware that I dont' want: plot(hist(dat[dat =-500 dat =500])) - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] Howto Supress Extra Blank Page in gridBase

2009-03-19 Thread Gundala Viswanath
(grid) library(gridBase) opar - par(no.readonly=TRUE) par(opar) grid.newpage() pushViewport(viewport(width=0.5, height=0.5)) grid.rect(gp=gpar(col=grey, lty=dashed)) par(omi=gridOMI()) par(mfrow=c(2, 2), mfg=c(1, 1), mar=c(3, 3, 1, 0)) for (i in 1:4) { plot(1:10) } __ END__ - Gundala Viswanath

[R] Cumulative Plot with Given X-Axis

2009-03-18 Thread Gundala Viswanath
0.0141398 0.0142373 7 0.0101515 0.0102948 8 0.0308843 0.031294 9 0.0095504 0.00960626 10 0.00729676 0.0073713 - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https

[R] Simple Plot with Grid's Viewport

2009-03-18 Thread Gundala Viswanath
); } } dev.off() __END__ - Gundala Viswanath __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

[R] Invalid Type of Char Argument When Sum() is Used

2009-03-13 Thread Gundala Viswanath
that it gives such error? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal

[R] Modifying Names from (x,y] into x

2009-02-25 Thread Gundala Viswanath
Hi, I have the following data that looks like this: names(dat) [1] (-2329,-2319] (-1399,-1389] (-669.4,-659.4] How can I modify those names into just this? [1] -2329 -1399 -669.4 - Gundala Viswanath Jakarta - Indonesia __ R

[R] Remove top-K elements in Vector

2009-02-18 Thread Gundala Viswanath
Hi all, Suppose I hve this vector: x [1] 3 4 7 17 22 12 15 12 3 3 1 1 How can I remove the top-3 element. Yielding only: [1] 17 22 12 15 12 3 3 1 1 - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https

[R] Barplot with Sorted X-Axis

2009-02-18 Thread Gundala Viswanath
the second bar (value = 76) id placed on the right to the first. (8.048,18.05] (-21.95,-11.95] 81 76 This is the command I use to plot: barplot(x,ylab=Number of Unique Tags, xlab=Expected - Observed) - Gundala Viswanath Jakarta - Indonesia

Re: [R] Barplot with Sorted X-Axis

2009-02-18 Thread Gundala Viswanath
Hi Jim, or sorting the columns of the above table if that is what you are using to plot. How do you do that? Yes I am using that data exactly for the plotting. - GV. Jim __ R-help@r-project.org mailing list

[R] Insert value in a Vector Alternately

2009-02-18 Thread Gundala Viswanath
V12 V13V14 V15 V16 0 0.00380959 0.00380959 0.00380959 0 .00380083 0.00380083 0.00380083 Is there a quick way to do it in R? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https

[R] Plotting Binned Data

2009-02-17 Thread Gundala Viswanath
can I fix the code so that it gives a exact plot to dat above, with same number of bins and its respective frequency? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Generating Numbers With Certain Distribution in R

2009-02-11 Thread Gundala Viswanath
Dear all, Thanks so much, the latest version by Gustav work just fine. In the first version, the outcome is more digital than contiguous. - Gundala Viswanath Jakarta - Indonesia On Wed, Feb 11, 2009 at 10:35 PM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: On Wed, Feb 11, 2009 at 2:15 PM

[R] Generating Numbers With Certain Distribution in R

2009-02-10 Thread Gundala Viswanath
Dear all, Is there a way to generate K numbers of integer (K = 10^6). The maximum value of the integer is 200,000 and minimum is 1. And the occurrences of this integer follows a lognormal distribution. - Gundala Viswanath Jakarta - Indonesia __ R

[R] Meaning of Inner Product (%*%) Between Slot and Vector

2009-01-26 Thread Gundala Viswanath
does %*% work in the above example? 2. Is there a more understandable (naive) way to implement such product in this context? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Faster Printing Alternatives to 'cat'

2009-01-17 Thread Gundala Viswanath
suggestion already, I have memory problem x - cbind(dat$V1, as.character(dat$V2)) Error: cannot allocate vector of size 4.2 Gb Execution halted - Gundala Viswanath Jakarta - Indonesia On Sat, Jan 17, 2009 at 11:39 PM, hadley wickham h.wick...@gmail.com wrote: On Sat, Jan 17, 2009 at 7:59 AM

Re: [R] Faster Printing Alternatives to 'cat'

2009-01-17 Thread Gundala Viswanath
How do you do that Henrik? Write.table doesn't have that option. Usage: write.table(x, file = , append = FALSE, quote = TRUE, sep = , eol = \n, na = NA, dec = ., row.names = TRUE, col.names = TRUE, qmethod = c(escape, double)) - Gundala Viswanath Jakarta

[R] Value Lookup from File without Slurping

2009-01-16 Thread Gundala Viswanath
, yielding: 0.02 0.7 However, I want to avoid slurping whole repo.txt into an object (e.g. hash). Is there any ways to do that? The reason I want to do that because repo.txt is very2 large size (milions of lines, with tag length 30 bp), and my PC memory is too small to keep it. - Gundala Viswanath

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gundala Viswanath
for my naive question. - Gundala Viswanath Jakarta - Indonesia On Fri, Jan 16, 2009 at 9:09 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Jan 16, 2009 at 5:52 AM, r...@quantide.com r...@quantide.com wrote: I agree on the database solution. Database are the rigth tool to solve

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gundala Viswanath
Hi, Unless you specify an in-memory database the database is stored on disk. Thanks for your explanation. I just downloaded 'sqldf'. Where can I find the option for that? In sqldf I can't see the command. I looked at: envir = parent.frame() doesn't appear to be the one. - Gundala Viswanath

Re: [R] Summary of Total Object.Size in R Script

2009-01-15 Thread Gundala Viswanath
Sorry for my late reply. Thank you so much Jim. This script of yours is very2 useful. I have used it. - Gundala Viswanath Jakarta - Indonesia On Wed, Jan 14, 2009 at 12:17 AM, jim holtman jholt...@gmail.com wrote: Here is a function I use to see how big the objects in my workspace

[R] Howto access object of object

2009-01-14 Thread Gundala Viswanath
How can I acces Slot 'ra' only? I tried print(x$ra) but fail. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

[R] Obtain numbers from vector of NAs and numbers

2009-01-14 Thread Gundala Viswanath
all. [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 9 18 8 17 18 [26] 13 9 5 6 7 9 10 11 13 14 3 17 2 1 14 3 3 13 4 4 16 Is there a quick way to do it? I tried grep([0-9], vect) but fail. - Gundala Viswanath Jakarta - Indonesia

[R] Extracting Hash via Vector

2009-01-13 Thread Gundala Viswanath
of bounds we expect the output of 'extracted' to be a vector as well. When the key is not present to give NA in vector - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Extracting Hash via Vector

2009-01-13 Thread Gundala Viswanath
Thanks for your most reasonable reply, Henrique. - Gundala Viswanath Jakarta - Indonesia On Tue, Jan 13, 2009 at 8:01 PM, Henrique Dallazuanna www...@gmail.com wrote: Try this: unlist(ifelse(q %in% names(x), x[q], NA)) On Tue, Jan 13, 2009 at 8:49 AM, Gundala Viswanath gunda...@gmail.com

[R] Summary of Total Object.Size in R Script

2009-01-13 Thread Gundala Viswanath
the exact byte size. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self

[R] Can't Destroy Dim Names

2009-01-12 Thread Gundala Viswanath
1QABA ... But why this command fail to do it? dimnames(mat) - NULL Btw, the object size for keeping matrix with dim names is greater than without, right? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https

[R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
, and query around ~1 million element. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
Hi Jorge and all, How can I modified your code when query size can be bigger than repository, meaning that it can contain repeats. e.g. qr - c(AAC, ATT, ATT,AAC, ATT, ATT, AAT, ATT, ATT, ) Sorry, I should have mentioned this earlier. - Gundala Viswanath Jakarta - Indonesia On Tue, Jan

[R] Returning Non-Unique Index with Which (alternatives?)

2009-01-12 Thread Gundala Viswanath
instead? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
Yes Jim, exactly. BTW, I found from ?match Matching for lists is potentially very slow and best avoided except in simple cases. Since I am doing this for million of tags. Is there a faster alternatives? - Gundala Viswanath Jakarta - Indonesia On Tue, Jan 13, 2009 at 12:14 PM, jim

Re: [R] Fast way to finding index in Vector

2009-01-12 Thread Gundala Viswanath
DACCD BEAAD CDDDA ABDCA ACACC DADAA ABCAD ... system.time(y - match(x,z)) user system elapsed 0.2 0.0 0.2 str(y) int [1:2000] 1 2 3 4 5 6 7 8 9 10 ... On Mon, Jan 12, 2009 at 10:17 PM, Gundala Viswanath gunda...@gmail.com wrote: Yes Jim, exactly. BTW, I found from

[R] Converting Factor to Vector

2009-01-12 Thread Gundala Viswanath
(new_repo) [1] AAA AAT AAC AAG ATA ATT... I tried as.vector(), but it remains the same factor. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

Re: [R] Converting Factor to Vector

2009-01-12 Thread Gundala Viswanath
... - Gundala Viswanath Jakarta - Indonesia On Tue, Jan 13, 2009 at 2:40 PM, bill.venab...@csiro.au wrote: as.character() Bill Venables http://www.cmis.csiro.au/bill.venables/ -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

[R] Converting Numerical Matrix to List of Strings

2009-01-11 Thread Gundala Viswanath
of Row in matrix = length of vector ( = 4). 3. Character a encode as 0, c - 1, g - 2, t - 3 Length of strings are assumed to be uniform within the vector, and it can be greater than 3 (up to 40 characters). - Gundala Viswanath Jakarta - Indonesia

[R] Pack and Unpack Strings in R

2009-01-09 Thread Gundala Viswanath
my $dat ( @data ) { my $decompressed = unpack 'b*', $dat; $decompressed =~ s/(..)/$digmap{$1}/ge; print $decompressed\n; # or do further processing on $dat } __END__ - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing

[R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread Gundala Viswanath
(2Gb) for ( s in 1:length(x) ) { cat(as.character(foo[s]),\t,bar[s],\t, qux[s],\n) } __END__ for x of size ~1.5million, takes more than 10 hours to print. On my Linux 1994.MHz AMD processor. Is there any faster alternatives to cat ? - Gundala Viswanath Jakarta - Indonesia

Re: [R] Faster Printing Alternatives to 'cat'

2009-01-08 Thread Gundala Viswanath
want to do, not how you want to do it. On Thu, Jan 8, 2009 at 6:12 AM, Gundala Viswanath gunda...@gmail.com wrote: 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

[R] Extracting File Basename without Extension

2009-01-08 Thread Gundala Viswanath
Dear all, The basename() function returns the extension also: myfile - path1/path2/myoutput.txt basename(myfile) [1] myoutput.txt Is there any other function where it just returns plain base: myoutput i.e. without 'txt' - Gundala Viswanath Jakarta - Indonesia

[R] Changing Matrix Header

2009-01-06 Thread Gundala Viswanath
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 02 I tried: as.matrix(x) But failed. - Gundala Viswanath Jakarta - Indonesia __ R

[R] Destroying Attributes of a Matrix

2009-01-06 Thread Gundala Viswanath
Dear all, I have the following structure of a matrix str(mdat) num [1:32268, 1:10] 0 0 0 0 0 0 0 0 0 0 ... - attr(*, dimnames)=List of 2 ..$ : NULL ..$ : NULL How can I destroy the attributes such that it simply gives: str(mdat) num [1:32268, 1:10] 0 0 0 0 0 0 0 0 0 0 ... - Gundala

[R] Function to Check Object's Memory Size

2009-01-06 Thread Gundala Viswanath
Dear all, Does R has any function that measures how much memory hold by any particular object? - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] How to extract range of colums in a data frame

2009-01-04 Thread Gundala Viswanath
TTCTCCGGCGACCACCGAGATCTACACTCTTTCC 18.0 7 9.00 18.0 12.0 18.0 15.0 16 1 TTCTCCGGCGACCACCGCGATCTACACTCTTTCC 18.0 7 9.00 18.0 12.0 18.0 15.0 My question is how can I extract the column V3 up to V9 into another new data frame. I tried this but failed: str - paste(V, 3:9, sep=) print(dat$str) - Gundala

[R] Process File Line By Line Without Slurping into Object

2009-01-04 Thread Gundala Viswanath
: __BEGIN__ open INFILE, '' , 'filename.txt' or die $!; while (INFILE) { my $line = $_; # then process line by line } __END__ the reason I want to do that is because the data I am processing are large (~ 5GB), my PC may not be able to handle that. - Gundala Viswanath Jakarta - Indonesia

  1   2   >