similar to: how to read in a txt file with some blanks

Displaying 20 results from an estimated 6000 matches similar to: "how to read in a txt file with some blanks"

2007 Nov 10
7
How to more efficently read in a big matrix
Dear list, I need to read in a big table with 487 columns and 238,305 rows (row names and column names are supplied). Is there a code to read in the table in a fast way? I tried the read.table() but it seems that it takes forever :( Thanks a lot! Best, Allen
2007 Nov 14
3
How to get row numbers of a subset of rows
Hello list, I read in a txt file using <B<-read.table(file="data.snp",header=TRUE,row.names=NULL) by specifying the row.names=NULL so that the rows are numbered. Below is an example after how the table looks like using <B[1:10,1:3] SNP Chromosome PhysicalPosition 1 SNP_A-1909444 1 7924293 2 SNP_A-2237149 1 8173763
2007 Dec 23
3
How to remove some rows from a data.frame
Hello list, I have a data frame M like: BAC chr pos s1 s2 RP11-80G24 1 77465510 -1 0 RP11-198H14 1 78696291 -1 0 RP11-267M21 1 79681704 -1 0 RP11-89A19 1 80950808 -1 0 RP11-6B16 1 82255496 -1 0 RP11-210E16 1 228801510 0 -1 RP11-155C15 1 230957584 0 -1 RP11-210F8 1
2007 Dec 06
2
hclust in heatmap.2
Dear list, I am using heatmap.2(x) to draw a heatmap. Ideally, I want to the matrix x clustered only by columns and keep the original order of rows unchanged. Is there a way to do that in heatmap.2()? Thanks a lot! Any suggestions will be appreciated! Best, Allen [[alternative HTML version deleted]]
2007 Nov 29
2
How to take the ave of two rows in a data frame
> Dear list, > I have a data frame like: > > > log2.ratios[1:3,1:4] > ID a1 a2 a3 > 1 GS1-232B23 -0.0207500 0.17553833 0.21939333 > 2 RP11-82D16 -0.1896667 0.02645167 -0.03112333 > 3 RP11-62M23 -0.1761700 0.08214500 -0.04877000 > 4 RP11-62M23 0.2761700 -0.15214500 -0.05877000 > the 3rd and
2007 Nov 30
1
about col in heatmap.2
Hi list, My data set is comprised of 47 columns and about 700 rows. Most of the values would be around 2, while some will go beyond in either direction, higher or lower. Is there a way to specify the parameter of col or others if necessary to have the range of representing colors be 0----8, and make dark for 2, red for higher than 2 and green for lower than 2. Is there a way to do this? Thanks a
2007 Dec 15
1
how to threshold a matrix
Dear list, I have a matrix M (2500 rows and 9 columns). It looks like 2.2 0.1 2.6 3.6 ...... 0.4 1.9 2.7 4.2...... 1.8 2.5 4.3 2.2....... ..................... If I want to do: (1) if M[i,j]>=0.3, M[i,j]=1 (2) if M[i,j]<=-0.3, M[i,j]=-1 (3) Otherwise, M[i,j]=0 Is there a way to ceil and floor the data? Thanks a lot! Allen [[alternative HTML
2007 Nov 18
1
how to sort a data.frame by ascending some columns
Dear list, I have a data frame (238304 rows and 6 columns). I want the data frame sorted by two columns in ascending order. I am showing the first 5 rows of the data frame > clones.info[1:5,1:6] USER_CLONE_ID CHROMOSOME Expr1002 KB_POSITION Allele_A WELL_ID 1 SNP_A-1855402 17 41419603 41419603 C rs17572851 2 SNP_A-4249904 17 41420045 41420045 A rs17572893 3 SNP_A-2174835 18 41407760
2001 May 10
2
Scanning data lines with blanks in character vars
Hello, I'm trying to read data in from a file using scan(). The last field is a character string that contains blanks. I had read it in in S-Plus using this code: ifile <- list(entry=0,measure=0,st=0,count=0,score=0, error=0,inmsq=0,instd=0,outms=0,outstd=0,displc=0,ptbis=0,a=0, r="",name="") if.widths <- c(1, 5, 8, 3, 6, 7, 7, 7, 7, 7, 7, 7, 7, 2,
2007 Nov 22
2
Heatmap problem
Hi friends, I used heatmap(as.matrix(y2),col=rainbow(256),scale = "column") to generate the heatmap. But it did not show the code that which color correspond the value. Is there any parameter for this in heatmap()? Thanks a lot! Allen [[alternative HTML version deleted]]
2008 Nov 12
1
read.table with many blanks (reposting)
Thanks Jim for pointing out how to properly ask. Here is is my question and a small subset of the data and output. I have a data set with many blanks. The blanks should be replaced with zero once imported. I tried read.table, read.csv (R 2.8 version),or scan, but none was successful. Any suggestion, please.. thanks. Keun-Hyung >garoben=read.table("c:\\Rdata\\garoben.txt",header=T,
2007 Nov 14
2
About print a label in plot
Dear list, Hello! I have a question about how to print a label in the plot. I am using the following code: <pdf("mel4_chr3_11cancer_cghFLasso.pdf", height=6, width=5);plot(Disease.FL, index=i, type="Single",main="Plot of Labels");dev.off(); But "Plot of Labels" has not been printed. Any suggestions? Thanks a lot! Allen
2004 Jul 10
1
read.table, read.fwf, and na.strings (PR#7075)
# Your mailer is set to "none" (default on Windows), # hence we cannot send the bug report directly from R. # Please copy the bug report (after finishing it) to # your favorite email program and send it to # # r-bugs@r-project.org # ###################################################### Is this intended behavior for the read.fwf(na.strings="-999")? I anticipated that
2010 Feb 01
6
Import fixed-format ascii file with mixed record types
I need to import several ascii files in fixed format with two different record types. The data comes from European Labor Force Surveys, wich is a household survey. The first record type is for people over 16 years, and the second much sorter is for people aged 15 or less (this record has a filler with several blanks to get the same record length). The files tipically have 160000 records, with 176
2006 Sep 26
2
colClasses: supressed 'NA'
Hi, The colClasses seem to be supressing 'NA' vlaues. How do I fix this? R script and first 5 lines of output is below. File "test2.dat" has blanks that are read as "NA" when I do not use 'colClasses', but as blanks when I use 'colClasses'. temp.df <- read.fwf("test2.dat", width=c(10,1,1,1,1,2,2,3,3,1),
2006 Oct 06
2
Extreme slowdown with named vectors. A bug?
Tried the following with R --vanilla on the Rv2.4.0 release (see details at the end). I think the script and its comments speaks for itself, but the outcome is certainly not wanted. for (n in 58950:58970) { cat("n=", n, "\n", sep=""); # Clean up first rm(names, x, y); gc(); # Create a named vector of length n # Try with format "%5d" and it
2007 Nov 29
2
How to manipulate a data frame
Dear list, I have a data frame like: > log2.ratios[1:3,1:4] Clone a1 a2 a3 1 GS1-232B23 -0.0207500 0.17553833 0.21939333 2 RP11-82D16 -0.1896667 0.02645167 -0.03112333 3 RP11-62M23 -0.1761700 0.08214500 -0.04877000 how to make it to look like: > log2.ratios[1:3,1:4] a1 a2
2011 Mar 28
2
Import variable labels to data frame columns
Hi, I'm new to R and I'm stuck trying to import some data from a .dat file I've been given. The tricky bit for me is that the data has both variable values and labels? The data looks like this, Id=1 time=2011-03-27 19:23:40 start=1.4018 end=1.4017 Id=2 time=2011-03-27 19:23:40 start=1.8046 end=1.8047 Id=1 time=2011-03-27 19:23:50 start=1.4017 end=1.4018 Id=2
2010 Oct 28
2
replace text at certain positions in a file
Hello, I am working with R version 2.10.1 under windows. In a text file, I need to replace all characters at certain column positions with blanks. For example, say the file contains two lines and looks like this: ab34cd78e fg3 hi78j I'd like to replace everything at positions 3-4 and 7-8 with blanks, so the output should be: ab cd e fg hi j [I'm not sure if this is really an R
2007 Nov 15
1
Plot problem
Dear list, I have a question about using plot(). I tried the code: <pdf("mel_chr_all_13cancer_cghFLasso_all.pdf", height=6, width=11);plot( Disease.FL, index=1:4, type="All");dev.off(); and it went through well which outputed 4 plots for 4 samples in one page. But if I increase the numbers of plots(samples) which I want, saying to 11,