similar to: repeat matrix rows as a whole

Displaying 20 results from an estimated 20000 matches similar to: "repeat matrix rows as a whole"

2011 Nov 02
1
difference between foo$a[2] <- 1 and foo[2,"a"] <- 1
Hallo Can anyone tell me the difference between foo$a[2] <- 1 and foo[2,"a"] <- 1 ? I thought that both expressions are equivalent, but when I run the following example, there is obviously a difference. > foo <- data.frame(a=NA,b=NA) > foo a b 1 NA NA > foo$a[1] <- 1 > foo$b[1] <- 2 > foo$a[2] <- 1 Error in `$<-.data.frame`(`*tmp*`,
2012 Nov 11
2
Cropping a matrix by rows
Hello r-help, I've been banging my head against the computer in an attempt to learn how to divide my matrix into segments by rows. I want to be able to return each segment as a newly named object. I've tried looking at the apply functions and creating a for loop but brain no work. Here's the basic starting objects that I believe would be needed to separate the matrix. mat <-
2013 Feb 01
2
Range difference of plot two arrays in one plot
Hello all, When I tried to plot the following two arrays in one figure with the following: x = c(0,0,0,10,20,30) y = c(40,50,60,70,80,90) plot(x, type='o', ylim=c(min(x),max(x))) par(new=T) plot(y, type='l', ylim=c(min(y),max(y))) Found that the first points and last points from those two arrays are overlapping together, but the value 30 is not equal to 90. How could I draw
2013 Nov 25
2
Durbin Watson Test Bound in R
Hi, How could I use R to check Durbin Watson Test Bound? Best, Rebecca
2012 Oct 08
3
Removing header from a matrix
I have three column vectors (X1, X2, X3).          X1  X2  X3        20   25  40        100 90  80 I want to put them as one matrix of dimention 2 by 3,  but remove headers(X1,X2,X3) from the matrix. I wrote as follows U<-cbind (X1,X2,X3) the headers are there. I need help please. Thanks Dereje [[alternative HTML version deleted]]
2012 May 25
4
Hash Table - Select and Change Data iniside Matrix
Hi, Here i have been a matrix like this, *NAME AGE PALCE TRUE/FALSE* ABC 20 INDIA XYZ 30 FRANCE PQR 40 USA MNO 30 KENIYA DEF 25 AUSTRALIA Here,* TRUE/FALSE* Column containing empty values. So my requirement what is , need to change all the *TRUE/FALSE *column value into "*TRUE*" where *AGE =
2012 Oct 30
1
sqlFetch doesn't read the whole objects.
Hi everyone, I connected a data in FileMaker server with odbcConnect. When I call the data "CANCERS" using sqlFetch, it looks okay. However, the number of obs was different with the actual number. If I read the same data from Microsoft Access, there are 656 obs. in it but srt() shows me 600 obs. Does anyone know why this happened and how to read all obs. from R? Thank you in advance.
2012 Aug 08
3
Outer product from matrix by row and a vector
Dear all, I am facing a challenge when applying the outer product with a matrix by rows. What I have is a rather big matrix, which I would like to convert into a different matrix by doing something like outer(matrix_row, vector, function(x,y) x[1]+5*x[4]/y) In order to get there, I tried to get the matrix into a list using the mefa package, as subsetting the original data appears too
2011 Nov 15
5
Convert back to lower triangular matrix
Given a vector;> ab = seq(0.5,1, by=0.1)> ab[1] 0.5 0.6 0.7 0.8 0.9 1.0 The euclidean distance between the vector elements is given by the lower triangular matrix > dd1 = dist(ab,"euclidean")> dd1    1   2   3   4   52 0.1                3 0.2 0.1            4 0.3 0.2 0.1        5 0.4 0.3 0.2 0.1    6 0.5 0.4 0.3 0.2 0.1 Convert the lower triangular matrix to a full
2012 Apr 25
1
Removing the rows from dataset
Hi, I have data set where i have col1,col2,col3,col4 i want to write a condition where the rows has to removed from the dataset for col1>10 Please help, Thanks Santosh -- View this message in context: http://r.789695.n4.nabble.com/Removing-the-rows-from-dataset-tp4585710p4585710.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
2013 Mar 08
2
Select rows from Data Frame with conditions
Hi all, I have two dataframes. The first (A) contains all the stock prices for today including today. So the first column is the stock Symbol and the second column is the stock price. The second (B) is the symbol list in the top 100 stocks. I want to pick out from dataframe A only the rows containing the symbols from B. i.e. something like: prices <- A[A[,1]==B,2] is there any
2012 Oct 15
2
Chopping a two column data frame by rows into a three dimensional array.
If I have a two column data frame like: > dat <- cbind("x"=c(1:100),"y"=c(100:1)) How can I create an array that splits every ten rows of that data frame into a third dimension of an array so that: > newarray[,,1] ,,1 x y 1 100 2 99 3 98 ... ... 10 91 ,,2 x y 11 90 12 89 ... ... ... Thanks. [[alternative HTML version deleted]]
2012 Apr 23
2
.rda vs. .RData
Are they the same with .RData being the newer format?? Thanks, ...Tao
2013 Oct 12
1
lmerTest
Hi, I'm trying to user lmer function from lmerTest package because, if I understood correectly, it allows to make better inference than lmer method from lme4 package. However, whatever I do I keep getting this error: Error in lme4::lFormula(formula = mark ~ ssCount + sTime+ : rank of X = 1660 < ncol(X) = 1895 any ideas what could be a problem? thanks, Srecko [[alternative HTML
2012 Sep 13
1
Error during matrix multiplication
Hi, I have two matrix from two different .csv files. #load .csv files a <- as.matrix(read.table("Whirr_127.csv", header=T, sep=",", row.names=1)) b <- as.matrix(read.table("Files_Whirr_127.csv", header=T, sep=",", row.names=1)) a b I managed to do transpose to 'b' without any error. transpose_task <- t(b) transpose_task But, when I tried
2013 May 04
1
how to best add columns to a matrix with many columns
Hi everyone, I have large data frame, say df1, with 165K columns, and all but the first four columns of df1 are numeric. I transformed the numeric data and obtained a matrix, call it data.m, with 165K - 4 columns, and then tried to create a second data frame by replacing the numeric columns of df1 by data.m. I did this in two ways, and both ways instantly used up all the available memory, so
2013 Oct 10
1
Rcpp and mclapply
Dear all, I have an R script that uses Rcpp, and I have been trying to parallelize it using mclapply (I tried with the multicore and the parallel library) Sometimes (not always, interestingly), the CPU use for each core drops, usually so that the total over all cores reaches 100%, i.e., as fast as if using just one single core fully. I tried my code directly from within emacs, and also using a
2017 Jul 16
3
readLines without skipNul=TRUE causes crash
hi, thank you for attempting this. it looks like your unix machine unzipped the txt file without corruption -- if you copied over the same txt file to windows 7, i don't think that would reproduce the problem? i think it needs to be the corrupted text file where R.utils::countLines( txtfile ) gives 809367. i am able to reproduce on two distinct windows machines but no guarantee i'm
2017 Jul 15
3
readLines without skipNul=TRUE causes crash
I am not able to reproduce this on a Linux platform: #######################3 fn1 <- "/home/jdnewmil/Downloads/Microdados ENEM 2009/Dados Enem 2009/DADOS_ENEM_2009.txt" sessionInfo() ## R version 3.4.1 (2017-06-30) ## Platform: x86_64-pc-linux-gnu (64-bit) ## Running under: Ubuntu 14.04.5 LTS ## ## Matrix products: default ## BLAS: /usr/lib/libblas/libblas.so.3.0 ## LAPACK:
2012 Jun 15
1
Divide all rows of a data frame by the first row.
Folks, I call the function calcAmorts like so: calcAmorts(prevAm, amort, myDates) Note that I use the package lubridate. The last line where do.call is called to first divide all the rows by the first row and then rbind gives the following error: Error in do.call("rbind", apply(amortsByYears, 1, "/", amortsByYears[, : second argument must be a list By contrast if