similar to: Reading an upper triangular matrix

Displaying 20 results from an estimated 8000 matches similar to: "Reading an upper triangular matrix"

2007 Feb 02
5
reading very large files
Hi all, I have a large file (1.8 GB) with 900,000 lines that I would like to read. Each line is a string characters. Specifically I would like to randomly select 3000 lines. For smaller files, what I'm doing is: trs <- scan("myfile", what= character(), sep = "\n") trs<- trs[sample(length(trs), 3000)] And this works OK; however my computer seems not able to handle
2011 Jul 12
1
suggestions regarding reading in a messy file
I have a file in stata format, which I have read in, and I am trying to create a text file. I have exported the data using various delimiters, but I'm unable to read it back in. I originally read in the file with: library(foreign) myData <- read.dta("mydata.dta") I then exported it with write.table using comma, tab, and exclamation marks as a delimiter. When I was unable to
2002 Feb 16
3
Symbol "£" crashs R in Win98
Dear R users, > version platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.1 year 2002 month 01 day 30 language R I was trying to read in some data in a text file. In the data file, some of the column headings
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
2005 Oct 02
2
convering upper triangular matrix into vector
Hi I have two symmetrical distance matrices and want to compute the correlation coefficient between them (after turning them into vectors). Is there a way of selecting only the upper triangular part of each matrix, then convert this into a vector so I can compute the correlation? Many Thanks Eleni Rapsomaniki
2009 Feb 11
4
Efficent way to create an nxn upper triangular matrix of one's
The code below create an nxn upper triangular matrix of one's. I'm stuck on finding a more efficient vectorized way - Thanks. --Dale n <- 9 data <- matrix(data=NA, nrow=n, ncol=n) data for (i in 1:n) { data[,i] <- c(rep(1,i), rep(0,n-i)) } data
2011 Sep 26
2
Triangular matrix upper to down
Hi, suppose that we have a triangular upper matrix A test <- matrix(ncol = 4, nrow = 4) test[1, ] <- c(NA,1,1,1) test[2, ] <- c(NA,NA,1,1) test[3, ] <- c(NA,NA,NA,1) test[4, ] <- c(NA,NA,NA,NA) I know how quickly set diagonal value diag(test) <- 1. But how quickly set down value i.e. matrix is symmetrical? Is there in r project any quickly function? Thanks, Best Marcin
2017 Jun 18
2
Problema con Histograma con porcentajes usando ggplot
#Simple table con frecuencias absolutas y crear relativas count =table(ess$stflife) percent = 100* (count)/sum(count) Carlos he creado a esto a nivel general en vez de usar prop.table. Según lo que dices o entiendo, debo de usar la función ddply para hacerlo a nivel de todos los paises, y entiendo que ddply (, c(""), debo de indicar los paises? Saludos 2017-06-18 17:37 GMT-05:00
2006 Jul 13
1
writeForeignSAS and potential extensions
Dear R-devel, I've made some potential extensions to writeForeignSAS in 'foreign' that I wanted to pass along if anyone is interested. I've attached the diff -u output against the version found in foreign_0.8-15 and an .R file with my changes. (In this .R file, the function is named writeForeignSAS7 to simplify testing/comparisons.) I've tried to alter the current
2008 Jan 02
2
Seeking a more efficient way to read in a file
Hi. I have a matrix stored in a large, tab-delimited flat file. The first row contains column names. Because the matrix is symmetric, the file has lower triangular format, so the second row contains one number, the third row two numbers, etc. In general, row k+1 contains k numbers; the matrix has 3000 rows, so the file has 3001 rows. The file has variable length records, so each row ends
2003 Nov 05
1
read.table leaves out data when reading multiple-line records (PR#4955)
Dear all, I discovered that read.table (RW1.8.0) leaves out data when reading multiple-line records. Replication code at the end Best regards Jens Oehlschlägel > filename <- "c:/tmp/c2.csv" > > data <- data.frame(a=c("c", "e\nnewline"), b=c("d", '"quoted simpleline"')) > > #look at the data >
2008 Oct 12
1
Conditionally skip over "for(..){" and "}"??
Hi Folks, I'm wondering if there's a secret trick to achieve the following. I have some big code for analysis related to a named variable, which will be one of several in the columns of a dataframe, and I would like to be able to choose between a run for just one of these variables, or a run which loops over them all. So, for a single run, I could have the following kind of thing in a
2017 Aug 13
1
ggplot's aes_ doesn't work as expected for x=factor()
I'm learning how to use ggplot in a programming approach where I supply variable names on the fly. Using aes_ doesn't work as I expected when x = factor(x). Is this a bug or am I not understanding something? # toy dataset df <- data.frame(LogicalVar = c(FALSE, TRUE, FALSE, TRUE, FALSE, TRUE), Var1 = c(0.01, 0.01, 1, 1, 30, 30), pct1 = c(12, 88, 60,
2010 Jul 29
1
[PATCH] Reflow logic to make it easier to follow
The control flow was: if (!y) { ppix = ... } if (y) { ... } else if (x) { use ppix for something } else { use ppix for something } Merge the if(!y) block with the two else branches. This avoids a false-positive in the clang static analyzer, it can't know that !y and x are mutually exclusive. The result looks something like this: if (y) { ... } else { ppix = ... if (x) {
2017 Jun 19
2
Problema con Histograma con porcentajes usando ggplot
Creo que esto me da para DK, y luego veré como aplicar el barplot ess %>% filter(cntry %in% c("DK")) %>% count (stflife) %>% mutate (freq = (n /sum(n)*100))%>% print 2017-06-18 19:01 GMT-05:00 Antonio Rodriguez Andres < antoniorodriguezandres70 en gmail.com>: > He conseguido el total para un país, pero no me deja usar percent = > count() /sum(count),
2001 Dec 29
1
Slow 'read.table' in R 1.4.0 (PR#1232)
The 'read.table' function appears to be up to 10X slower in R 1.4.0 than R 1.3.1 for some of the data sets I read in. I was comparing the source code for the 2 versions and see that it was rewritten in R 1.4.0. I think I found out what part of the problem might be. I was comparing R1.3.1 and R1.4.0 code and it appears that a statement is missing in some of the code for R 1.4. This is
2010 Aug 11
2
assignment functions with inherited class error
# Two test for a class like this: setClass("XXX", representation=representation( "matrix" ) ) i<-new("XXX"); m=matrix(); colnames(m)<-c("colA"); i at .Data=m; # >i # An object of class ?XXX? # colA #[1,] NA #________________________________________________________________________ #First Test "varnames<-" <- function(x,value){
2009 Oct 02
3
help with regexp mass substitution
Hello * i have to rename a lot of variables, and, given that they have regular name constructs, I would like to use regexps. Here's a dump of my head(names(df)) varnames <- c("id.quest", "txt.1.3", "col1.1.3", "col2.1.3", "col3.1.3", "col4.1.3", "col5.1.3", "txt.2.3", "col1.2.3",
2002 Feb 22
1
Summary: read.table on Mac OS X, CARBON vs. DARWIN
Thanks a lot, James!! The problem is fixed. On the version 1.4.0 Mac/darwin (the latest available version for this system) the function read.table (which is called from read.delim etc., too) has the bug you explained. Inserting the row nlines <- nlines+1 after lines <- c(lines, line) removes this bug. M. On Friday, February 22, 2002, at 02:33 PM, james.holtman at convergys.com
2012 May 16
3
triangular matrices input/output
Hi, Is there any package that deals with triangular matrices? Say ways of inputting an upper (lower) triangular matrix? Or convert a vector of length 6 to an upper (lower) triangular matrix (by row/column)? Thanks! ----- ###################### PhD candidate in Statistics Big R Fan Big LEGO Fan Big sTaTs Fan ###################### -- View this message in context: