similar to: How to more efficently read in a big matrix

Displaying 20 results from an estimated 6000 matches similar to: "How to more efficently read in a big matrix"

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 Nov 28
2
how to read in a txt file with some blanks
Hi list, Is there a way to read in a txt file with some blanks? The ideal way could be to replace blanks with NAs. Thanks a lot! Allen [[alternative HTML version deleted]]
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
2010 Apr 06
2
Merging data frames on two conditions
Hi Guys I have two data frames which I would like to merge on two conditions. I am doing the following (abstract form) new.data.frame <- merge(df1,df2, by=c("Col1","Col2")) It is giving me a null result. Basically I need to apply two conditions. I also tried sqldf but it is running forever. Will indexing help ? temp <- sqldf("select
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]]
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
2009 Mar 23
3
read in large data file (tsv) with inline filter?
I have a very large tab-delimited file, too big to store in memory via readLines() or read.delim(). Turns out I only need a few hundred of those lines to be read in. If it were not so large, I could read the entire file in and "grep" the lines I need. For such a large file; many calls to read.delim() with incrementing "skip" and "nrows" parameters, followed by grep()
2007 Nov 08
3
skip non-sequential lines using scan?
Hi all, Is there a way to skip non-sequential lines using the "skip" argument in the scan function? E.g., I have a matrix with 100 rows and 1e7 columns. I open a connection and want to read only lines 5, 7, 9, etc [i.e., seq(5,99,2)] It might seem that the syntax to do this would be something like this (if only the "skip" allowed vectors in the same way colClasses does in
2012 Nov 06
1
how Can make function for selecting the products
HI. I make this code: getdata<-function('a','b','c' ,'d','e','f'){ drv <- dbDriver("SQLite") con<-dbConnect(drv, "sqlite.db") lt<-dbListTables(con) myf<-data.frame(NULL) for (i in 1:length(lt)) { myfile<-dbReadTable(con,lt[i]) myfile1<-myfile[-c(14:44)] myfile1$MODEL<-gsub(" ",
2010 Apr 07
1
specifying header in sqldf() and RSQLite
I have a file that I'm planning on manipulating with sqldf(). The header for this file is malformed, and I was wondering if there's a way to specify the values of the header ahead of time. I can see there are T/F options for header in sqldf(... list(header=T, ...), but was wondering if there's a way to explicitly stated what the header should be. Thanks, Andrew [[alternative HTML
2009 May 27
2
How to set a filter during reading tables
We are reading big tables, such as, Chemicals <- read.table('ftp://ftp.bls.gov/pub/time.series/wp/wp.data.7.Chemicals',header = TRUE, sep = '\t', as.is =T) I was wondering if it is possible to set a filter during loading so that we just load what we want not the whole table each time. Thanks, -james
2011 Jun 22
1
question about read.columns
HI, Dear R community, I have a large data set names dd.txt, the columns are: there are 2402 variables. a1, b1, ..z1, a11, b11, ...z11, a111, b111, ..z111.. IF I dont know the relative position of the columns, but I know I need the following variables: var<-c(a1, c1,a11,b11,f111) Can I use read.columns to read the data into R? I have tried the following codes, but it does not work
2013 Feb 16
8
Unir varias columnas en una sola
Buenas a todos, relato directamente mi problema. Estoy preparando unos datos para ingresarlos en otro programa que requiere una columna de ID y el resto de la información toda seguida sin espacios. El echo es que yo tengo la información separada en columnas, por ejemplo: ID col2 col3 col4 col5 etc. y precisaría dejarla de la siguiente forma: ID col2col3col4col5 etc. Para luego escribir a
2011 Sep 14
4
Reading large, non-tabular files
Dear R-help, I have a very large ascii data file, of which I only want to read in selected lines (e.g. on fourth of the lines); determining which lines depends on the lines content. So far, I have found two approaches for doing this in R; 1) Read the file line by line using a repeat-loop and save the result in a temporary file or a variable, and 2) Read the entire file and filter/reshape it using
2009 May 03
2
is there a way to read a specific column from a txt file
Sometimes, it is too costly to read the whole data file into R. I am looking for solution in scan() and read.Lines() but don't they work. Thank you so much! -- ============================== WenSui Liu Acquisition Risk, Chase Blog : statcompute.spaces.live.com Tough Times Never Last. But Tough People Do. - Robert Schuller