Displaying 20 results from an estimated 1000 matches similar to: "generating lower triangular matrix"
2007 Oct 18
2
error: unused arguments
Hi
what does this mean when i get above error? When I call function foo(),
specifying parameters a and b as below
a<-5
b<-6
> y <- foo(a,b)
> Error in foo(a, b) : unused argument(s) (6)
Thanks
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to bu...{{dropped:24}}
2007 Jul 03
2
vertically concatenating data frames
Hi,
what is the recommended way to vertically concatenate 2 data frames with
the same column names but different number of rows?
My problem is something along these lines:
df1 <- data.frame(var1=var1,var2=var2,var3=var3) # nrow(df1)=1000
df2 <- data.frame(var1=var4,var2=var5,var3=var6) # nrow(df2)=2000
I tried df <- c(df1,df2), no success. stack does not seem to be
appropriate
2007 Jul 12
2
lead
Hi,
is there any function in R that shifts elements of a vector to the
opposite direction of what Lag() of the Hmisc package does? (something
like, Lag(x, shift = -1) )
Thanks
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
2007 Jul 17
2
poor rbind performance
Hi
I rbind data frames in a loop in a cumulative way and the performance
detriorates very quickly.
My code looks like this:
for( k in 1:N)
{
filename <- paste("/tmp/myData_",as.character(k),".txt",sep="")
myDataTmp <- read.table(filename,header=TRUE,sep=",")
if( k == 1) {
myData <- myDataTmp
}
else{
myData
2007 Jun 14
2
connecting to DB2 database
Hi,
i am trying to connect to a DB2 server using the DBI library.
getData <- function()
{
driver <- dbDriver("DB2")
conn <- dbConnect(driver,"server","uname","pword")
data <- dbSendquery(conn, "select etc.")
}
When I run the function, i get the error
> data <- getData()
Error in
2007 Jul 02
1
compute time span in months between two dates
Hi,
I am just starting to play with R. What is the recommended manner for
calculating time spans between 2 dates? In particular, should I be using
the "chron" or the "date" package (so far I just found how to calculate
a timespan in terms of days)?
Thanks
Zava
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to
2007 Jul 05
1
converting list to an array
Hi,
I have a list myList (see below) that consists of id's $'7',....,$'10'
and each id has an individual array, the length of which can vary from
id to id.
How can I convert this list into an array, ie. stacking the individual
arrays into one large array?
Thanks
Zava
myList:
$`7`
[1] 20050201 20050301 20050401 20050501
$`8`
[1] 20050201 20050301 20050401
2007 Jul 18
1
passing a parameter to a file from command line
Hi,
I have a file fileFoo.R, say that contains these two lines, invoking
function foo that is specified in "foo_details.R":
source("foo_details.R")
foo(parameter1)
I want to specify and pass parameter1 in my command line when invoking R
in linux: R --no-save <fileFoo.R.
How can I do that?
And how can I retrieve the value of parameter1 in my fileFoo.R function
2007 Mar 28
5
Large matrix into a vector
Hi,
I have a matrix HR(9x27). I would like to make a
single vector with elements: t(HR[,1]) followed by
t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
way of converting this matrix into a vector rather
doing something like c(t(HR[,1]), t(HR[,2]), t(HR[,3])
..)?
Thanks in Advance.
Kind regards,
Ezhil
____________________________________________________________________________________
2003 Jul 06
1
Conditional Distribution of MVN variates
Hi Folks,
Given k RVs with MVN distribution N(mu,S) (S a kxk covariance matrix),
let (w.l.o.g.) X1 denote the first r of them, and X2 the last (k-r).
Likewise, let mu1 and mu2 denote their respective expectations.
Then, of course, the expectation of X2 given X1=x1 is
mu2 + S21*inv(S22)*(x1 - mu1)
and the covariance matrix of X2 given X1=x2 is
S22 - S21*inv(X11)*S12
where Sij is the
2007 May 09
3
Removing a list of Objects
Hi,
I have a simple beginner's question on removing a list of
objects. Say I have objects C243.Daily1, C243.Daily2...C243.Daily5 in my
workspace. I'd like to remove these without using rm five times.
So I write.
> a <- list(paste("C243.Daily",sep="",1:5))
> rm(a)
Obviously this wouldn't work, as it would only remove the object a.
But is there any way
2008 May 10
3
Creating Matrix
Hello,
I have two data.
x<-c(1, 2, 1, 3, 2)
y<-c(3, 1, 2, 3, 5)
1. How do i create matrix from this two.
what i want is this
x y
1 1 3
2 2 1
3 1 2
4 3 3
5 2 5
2. what is the best way to use chisq.test to get the p.value
thanks
Claire
--
View this message in context: http://www.nabble.com/Creating-Matrix-tp17168173p17168173.html
Sent from the R help mailing list
2011 Nov 15
1
Convert full matrix 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
2005 Mar 01
2
almost lower triangular matrices
I have output from a program which produces a distance matrix I want to
read into a clustering program in R.
The output is a .txt file and is 'almost' lower triangular in the sense
that it is just the triangle below the diagonal.
So for example a 4-by-4 distance matrix appears as,
1
2 3
4 5 6
i.e. it looks like a lower triangular of a 3-by3.
I thought I might be able
2005 Jul 12
2
simple question: reading lower triangular matrix
Dear list,
I will like to learn how to read a lower triangular matrix in R. The
input file *.txt have the following format:
A B C D E
A 0
B 1 0
C 2 5 0
D 3 6 8 0
E 4 7 9 10 0
How this can be done?
Thanks in advance for your help
Rog??rio
2011 Nov 28
2
Principal componet plot from lower triangular matrix file
Hi,
I have a comma separated file with element names in first column like shown
below :
Name_1,0
Name_2,0.8878,0
Name_3,0.6777,0.7643,0
Name_4,0.9844,0.1234,0.1414,0
Original data is a 10000x10000 symmetric matrix (600 MB). To reduce file
size, I have minimized matrix to only lower triangle. Is there a (memory)
efficient way to 1) read file 2) compute first and second principal
components and
2012 Feb 15
3
built a lower triangular matrix from dataframe
Hello!
I'm trying to build a lower triangular matrix (with zeros in the diagonal)
from a particular dataframe.
The matrix I have to construct has 203 rows and 203 columns and that makes
20503 values to be included within (that's why I can't do it manually).
To illustrate the dataframe I have, I'll give you an example of a dataframe
and matrix with dimensions 6x6 (to make it
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
2006 Feb 15
1
power law
Dear list,
Does anyone know how to fit the power law distribution?
I have the empirical distribution and would like to check whether it fits
power law (with the power estimated from the data).
Any hints are appreciated
Best regards
Galina
[[alternative HTML version deleted]]
2009 Jul 22
3
How to use macro variable in a text string
I want to use read.table to input many files, each for a different year. I
would like to use the macro variable 't' to refer to the exact file that I
would like to input the data using read.table. How could I do this? Thank
you!
for (t in 1970:2005)
{ edge <- read.table(file="edge_t.csv", header=T, sep=",")
## I will have many rows of code following the