Displaying 20 results from an estimated 30 matches for "datamatrix".
2010 Sep 08
3
Regression using mapply?
Hi,
I have huge matrices in which the response variable is in the first
column and the regressors are in the other columns. What I wanted to do
now is something like this:
#this is just to get an example-matrix
DataMatrix <- rep(1,1000);
Disturbance <- rnorm(900);
DataMatrix[101:1000] <- DataMatrix[101:1000]+Disturbance;
DataMatrix <- matrix(DataMatrix,ncol=10,nrow=100);
#estimate univariate linear model with each regressor-column, response
in the first column
for(i in 2:10){
result <- lm(DataMatri...
2011 Feb 10
3
Permuting rows of a matrix
Hi,
I need to permute the rows of a matrix, where each row is independently rearranged. A simple solution is this:
shuffled <- datamatrix <- matrix(1:24, ncol = 4)
for (i in 1:nrow(datamatrix)) { shuffled[i, ] <- sample(datamatrix[i, ]) }
> datamatrix
[,1] [,2] [,3] [,4]
[1,] 1 7 13 19
[2,] 2 8 14 20
[3,] 3 9 15 21
[4,] 4 10 16 22
[5,] 5 11 17 23
[6,] 6 12 18 24...
2010 Dec 07
2
longer object length is not a multiple of shorter object length
In datamatrix[, "y"] == datamatrix[, "y"][-1] :
longer object length is not a multiple of shorter object length
out = c(FALSE,datamatrix[,'y'] == datamatrix[,'y'][-1])
and I do not know why I get that error, the resulting out matrix is somehow
one row larger than datamatri...
2009 May 14
3
memory usage grows too fast
...lculate the frequency of a given pattern. For example, a toy dataset is as follows.
Col1 Col2 Col3 Col4
01 02 02 00 => Freq of ?02? is 0.5
02 02 02 01 => Freq of ?02? is 0.75
00 02 01 01 ?
My code is quite simple as the following to find the pattern ?02?.
OccurrenceRate_Fun<-function(dataMatrix)
{
tmp<-NULL
tmpMatrix<-apply(dataMatrix,1,match,"02")
for ( i in 1: ncol(tmpMatrix))
{
tmpRate<-table(tmpMatrix[,i])[[1]]/ nrow(tmpMatrix)
tmp<-c(tmp,tmpHET)
}
rm(tmpMatrix)
rm(tmpRate)
return(tmp)
gc()
}
The problem is the memory usage grows very...
2007 Feb 13
1
Questions about results from PCAproj for robust principal component analysis
...ata matrix of dimensions RxC (R is the number of rows /
observations, C the number of columns / variables). PCAproj returns a list
of class princomp, similar to the output of the function princomp. In a
case where I can run princomp, I would get the following, from executing
dmpca = princomp(datamatrix) :
- the vector, sdev, of length C, contains the standard deviations of the
components in
order by descending value; the squares are the eigenvalues of the
covariance matrix
- the matrix, loadings, has dimension CxC, and the columns are the
eigenvectors of the
covariance matrix, in the same...
2008 Mar 03
2
handling big data set in R
Hello R users,
I'm wondering whether it is possible to manage big data set in R? I
have a data set with 3 million rows and 3 columns (X,Y,Z), where X is
the group id. For each X, I need to run 2 regression on the submatrix.
I used the function "split":
datamatrix<-read.csv("datas.csv", header=F, sep=",")
dim(datamatrix)
# [1] 2980523 3
names(datamatrix)<-c("X","Y","Z")
attach(datamatrix)
subX<-split(X, X)
subY<-split(Y,X)
subZ<-split(Z,X)
n<-length(subdata) ### number of groups
s1<-s...
2011 Dec 27
0
DataMatrix barcode generator/reader
Hello,
I have an existing legacy app written in .NET that will be rewritten
with Rails. One of the key components of the App is to generate and
read datamatrix barcodes from a PDF. I''ve looked online and message
posts but haven''t see anything worthwhile for reading / generting
datamatrix barcodes. Any recommendations for this?
Todd
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk&q...
2004 Jul 13
5
Help with factanal and missing values
Hi list,
I'm performing a series of confirmatory factor analysis on different
groupings of items from data collected with questionnaires. There are some
missing values.
For those sets with no missing values I call
factanal(datamatrix,factors=n)
where datamatrix is a table of all observations for the items under
investigation.
This call fails when there are missing values.
help(factanal) does not give an example on calls with na.action and and
mentiones a formula.
(Venables and Ripley, 2002 give only one example on p. 323...
2007 Dec 06
1
Randomizing one column in the dataMatrix
I have huge data file, and I would like randomize just one column at a time ,
is there any easy way?
Thanks a lot.
--
View this message in context: http://www.nabble.com/Randomizing-one-column-in-the-dataMatrix-tf4957535.html#a14197423
Sent from the R help mailing list archive at Nabble.com.
2010 May 25
1
Assigning NA to a rows of a dataframe/datamatrix
Dear R-users, I have a problem, I have the following dataframe:
d<-data.frame(
'y1'=c(1,2,1,2,1,NA,NA),
'y2'=c(1,2,1,1,1,2,1),
'y3'=c(1,NA,1,NA,NA,2,1),
'y4'=c(NA,2,NA,1,1,2,NA),
'a'=c(1,1,1,1,1,1,2)
)
where the last variable counts the number of missing values in a row. Now, i want to set rows where a>1 to NA and arrive at something like the
2012 Jul 24
4
ERROR : cannot allocate vector of size (in MB & GB)
..." Error: cannot allocate vector of size 82.4 Mb "
My requirement is, spilt data from Huge-size-file(.csv) to no. of small csv
files.
Here i will give no of lines to be 'split by' as input.
Below i give my code
-------------------------------
SplitLargeCSVToMany <- function(DataMatrix,Destination,NoOfLineToGroup)
{
test <- data.frame(read.csv(DataMatrix))
# create groups No.of rows
group <- rep(1:NROW(test), each=NoOfLineToGroup)
new.test <- cbind(test, group=group)
new.test2 <- new.test
new.test2[,ncol(new.test2)] <- NULL
# now g...
2004 Apr 27
1
beginners k means clustering question
...9
30924
33988
36975
40422
42911
50501
51593
53729
54338
55497
57337
61993
62601
66229
69815
69933
70760
71340
75921
83972
90134
91061
.
.
.
is it possible to cluster this data since it is in a single column ?
I have used the following R commands:
data <- read.table("cluster.txt")
dataMatrix <- t(data)
I then tried to cluster using the following:
xcl <-cclust(dataMatrix,2,20,verbose=TRUE,method="kmeans")
when I run this i receive the following error message:
Error in x[rank(runif(xrows))[1:ncenters], ] :
incorrect number of dimensions
I would be gratef...
2009 Jan 20
1
heatmap.2 color issue
Dear All:
I tried to use heatmap.2 to generate hierarchical clustering using the following command:
heatmap.2(datamatrix, scale="row", trace="none", col=greenred(256), labRow=genelist[,1], margins=c(10,10), Rowv=TRUE, Colv=TRUE)
datamatrix is subset of a RMA normalized data subset by a genelist.
The problem is a lot of times, the z-score in key are from, like -5 to 15 or -15 to 5, as a result,...
2012 Aug 10
1
Split CSV as per file size
Hi here i have a code to split a csv file as per group of line.
The code given below,
------------------------------------
SplitCSVByLine <- function(DataMatrix,Destination,NoOfLineToGroup)
{
input <- file(DataMatrix, "r")
fileNo <- 1
repeat
{
myLines <- readLines(input, n=NoOfLineToGroup)
if (length(myLines) == 0) break
writeLines(myLines, sprintf(paste(Destination,"Split_File_%05d.cs...
2011 Nov 21
5
R ignores number only with a nine under 10000
Hello R users,
I'm trying to replace numerical values in a datamatrix with strings. R does
this except for numbers under 10000 starting with a 9 (eg 98, 970, 9504
etc). This is really weird and I wondered whether someone had encountered
such a problem or knows the solution. I'm using the next script:
test_1 <- read.table("5+ref_151111clusters3.csv",...
2009 Jul 03
1
fix() and edit() not working with Rcmdr and german LANG-variable
Dear Mailinglist,
I just set up an R 2.9.1 environment with Rcmdr 1.4-6 on Ubuntu Jaunty
9.04. As I'm from Germany my $LANG variable is set to "de_DE.UTF-8".
Now, when I open up Rcmdr and try to edit a new datamatrix there is no
edit window appearing:
Datenmatrix <- edit(as.data.frame(NULL))
ERROR: invalid device
In addition, there are plenty of warning messages in the terminal window:
[...]
Warning: X11 protocol error: BadWindow (invalid Window parameter)
Warning: X11 protocol error: BadWindow (invalid...
2011 Apr 05
0
kmeans clustering java
...d values for the lower triangle..
re.eval ("rmatrix [ii,jj] <- "+ data[i][j].toString());
System.out.print(data[i][j].toString()+",");
}
System.out.println();
}
REXP rt = re.eval("r_matrix");
String bindString = "DATAMATRIX <- cbind(rmatrix[,1],";
for (int k = 0; k<columns-2;k++ ){
if(k<columns-3){
bindString = bindString+"rmatrix[,"+(k+2)+"],";
}else{
bindString = bindString+"rmatrix[,"+(k+2)+"])";
}
}
rt = re.eval(bindString);
//cl...
2009 Nov 02
4
Frequency
BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS
Hi All,
I have a data set "x" with several variables. Sample of the data is shown
below
V1 v2 v3 v4
5 6 9 10
3 4 7 10
4 6 10 18
I want the frequency of each data point sorted by their occurrence.
Below is the output that I want
10 =3
6=2
4=2
9=1
5=1
7=1
3=1
How do
2005 Mar 10
2
Logistic regression goodness of fit tests
...s it using lrm as above. Now the problem is that for some models I run into an error to which I can find no reference whatsoever on the mailing list or on the web. It is as follows:
test.lrm <- lrm(cclo ~ elev + aspect + cti_var + planar + feat_div + loamy + sands + sandy + wet + slr_mean, data=datamatrix, x = T, y = T)
singular information matrix in lrm.fit (rank= 10 ). Offending variable(s):
slr_mean
Error in j:(j + params[i] - 1) : NA/NaN argument
Now if I add the singularity criterion and make the value smaller than the default of 1E-7 to 1E-9 or 1E-12 which is the default in calibrate, it w...
2006 May 09
1
visualisation of Self organising map
Hello R users,
I'm using SOM() to cluster a gene expression data set
the syntax i used was
dataGrid <- c(somgrid(xdim = 3, ydim = 3, topo = c("rectangular","hexagonal")))
dataClusters <- SOM(dataMatrix, grid = dataGrid)
plot(dataClusters)
it seems that this works just fine but the thing i can't figure out is
how to determine where each data point has been clustered.
any suggestions are welcome
thanks in advance
richard mendes