similar to: Regex for Special Characters under Grep

Displaying 20 results from an estimated 2000 matches similar to: "Regex for Special Characters under Grep"

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 <-
2010 Apr 20
1
3D surface plot with wireframe or persp?
Hello Dear, I have a function, like z=f(x,y), and try a surface plot with this function. But, on the reference of "wireframe" requires data option, so I generated x and y, and computed z with them. But, still I have a problem to draw a surface plot. The code and errors are ################################################## mle_beta0=64.43707; mle_beta1=-24365.16; # generating for
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 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
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 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) ) {
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 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 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.
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 Oct 06
2
Problem with Grep Under Loop
Dear all, I have no problem with this individual grep command: > datk <- grep("XM_528056", source$V1) > dat2 <- source[datk,] > print(dat2) V1 V2 V3 V4 V5 V6 V7 35995 XM_528056 panTro2 chr8 + 1775569 1896107 Chimpanzee BUT, when I run them under the loop it gives this error: > hm_acc <-
2010 Jan 21
2
Help with subset
I am so happy about learning how to read in multiple Excel files, that I have to try and make another improvement. I know what I have been doing is clumsy, but it works. Hopefully, someone can suggest a more elegant solution. As a novice, I have been using MS-Word and mail merge to write my code. I start with about 2 pages of code, and end up with 2,220 merged pages that I copy and paste into R.
2013 Jul 10
2
Replacing part of delimited string with R's regex
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 version deleted]]
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 ...
2013 Dec 07
1
How to perform clustering without removing rows where NA is present in R
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 with dendogram together. library("gplots") library("cluster")
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);