Re: [R] Creating a matrix with an unknown variable

2013-06-26 Thread David Carlson
gy Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Blaser Nello Sent: Wednesday, June 26, 2013 11:03 AM To: Jennifer Tickner; r-help@r-project.org Subject: Re: [R] Creating a m

Re: [R] Creating a matrix with an unknown variable

2013-06-26 Thread Blaser Nello
. Best, Nello -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jennifer Tickner Sent: Mittwoch, 26. Juni 2013 10:18 To: r-help@r-project.org Subject: [R] Creating a matrix with an unknown variable Hi all I'm trying to create

[R] Creating a matrix with an unknown variable

2013-06-26 Thread Jennifer Tickner
Hi all I'm trying to create a matrix, A, with an unknown variable delta. The code I have so far is: D<-c(-1, -2/3, -1/3, 0, 1/3, 2/3, 1) A<-matrix(NA,nrow=7,ncol=7) for (i in 1:7) { for (j in 1:7) { A[i,j]<-exp(-((D[i]-D[j])/delta)^2) } } Of course, R comes up with an error message be

Re: [R] creating a matrix of ranked column data

2011-07-17 Thread Peter Langfelder
On Sun, Jul 17, 2011 at 11:18 AM, christian krahforst wrote: > I have a data frame (gom) or a matrix of trace metal data and some other > observations from water column samples taken at sea (e.g., 19 samples > (rows), 19 variables) > I can calc. the rank individually from each column of the attach

[R] creating a matrix of ranked column data

2011-07-17 Thread christian krahforst
I have a data frame (gom) or a matrix of trace metal data and some other observations from water column samples taken at sea (e.g., 19 samples (rows), 19 variables) I can calc. the rank individually from each column of the attached object. How can I create a matrix that contains the ranked data for

Re: [R] Creating a Matrix from a vector with some conditions

2011-01-09 Thread baptiste auguie
Hi, embed() seemed well-suited, but I couldn't figure out an elegant way to use it embed(c(A,A), 4)[1:4, 4:1] HTH, baptiste On 6 January 2011 22:34, ADias wrote: > > Hi > > Suppose we have an object with strings: > > A<-c("a","b","c","d") > > Now I do: > > B<-matrix(A,4,4, byrow=F) > > and I

Re: [R] Creating a Matrix from a vector with some conditions

2011-01-08 Thread Petr Savicky
On Thu, Jan 06, 2011 at 01:34:31PM -0800, ADias wrote: > > Hi > > Suppose we have an object with strings: > > A<-c("a","b","c","d") > > Now I do: > > B<-matrix(A,4,4, byrow=F) > > and I get > > a a a a > b b b b > c c c c > d d d d > > But what I really want is: > > a b c d > b c d a > c d

Re: [R] Creating a Matrix from a vector with some conditions

2011-01-07 Thread Petr Savicky
On Thu, Jan 06, 2011 at 01:34:31PM -0800, ADias wrote: > > Hi > > Suppose we have an object with strings: > > A<-c("a","b","c","d") > > Now I do: > > B<-matrix(A,4,4, byrow=F) > > and I get > > a a a a > b b b b > c c c c > d d d d > > But what I really want is: > > a b c d > b c d a > c d

Re: [R] Creating a Matrix from a vector with some conditions

2011-01-06 Thread David Winsemius
On Jan 6, 2011, at 4:34 PM, ADias wrote: Hi Suppose we have an object with strings: A<-c("a","b","c","d") Now I do: B<-matrix(A,4,4, byrow=F) and I get a a a a b b b b c c c c d d d d But what I really want is: a b c d b c d a c d a b d a b c How can I do this? How else? B<-matrix(A

[R] Creating a Matrix from a vector with some conditions

2011-01-06 Thread ADias
Hi Suppose we have an object with strings: A<-c("a","b","c","d") Now I do: B<-matrix(A,4,4, byrow=F) and I get a a a a b b b b c c c c d d d d But what I really want is: a b c d b c d a c d a b d a b c How can I do this? thank you A. Dias -- View this message in context: http://r.7896

[R] creating a matrix as input to lowess

2009-03-27 Thread Graves, Gregory
I have a very large file with many rows and columns. I want to create a plot with lowess. If I try the following it works fine: data(PrecipGL) plot(PrecipGL) lines(lowess(time(PrecipGL),PrecipGL),lwd=3, col=2) In my file, 2 columns are "nox" and "sdate", and are both typeof() = double.

Re: [R] Creating a matrix

2008-10-09 Thread John Kane
as reshape only seems to work on a variable named value. I think this is supposed to change in the near future). --- On Wed, 10/8/08, SP&BM <[EMAIL PROTECTED]> wrote: > From: SP&BM <[EMAIL PROTECTED]> > Subject: [R] Creating a matrix > To: r-help@r-project.org

Re: [R] Creating a matrix

2008-10-08 Thread jim holtman
You can read it in as a data.frame and then use 'aggregate' to get the mean: > x <- read.table(textConnection(' Seller Art. Unit_Price + 1 v1 p1 9.148352 + 2 v1 p1 2.858073 + 3 v1 p2 3.775315 + 4 v1 p2 9.821429 + 5 v1 p3 3.286827 +

[R] Creating a matrix

2008-10-08 Thread
Good evening. I have this following table and I would like to turn it into a matrix in which my rows would be filled with de "Sellers", my columns with my "Articles" and my data would be the mean unitary price used by each seller in each produt. Seller Art. Unit Price 1 v1 p1

Re: [R] creating a matrix subset based on a threshold cutoff

2008-03-04 Thread [EMAIL PROTECTED]
that's great, thanks On Tue Mar 4 12:29 , "Henrique Dallazuanna" sent: I think that this shoul works: do.call(rbind, apply(as.table(x), 1, function(.x).x[any(.x < cutoff)])) Change as.table(x) by your table On 04/03/2008, rich @ thevillas. eclipse. co. uk <[EMAIL

Re: [R] creating a matrix subset based on a threshold cutoff

2008-03-04 Thread Henrique Dallazuanna
I think that this shoul works: do.call(rbind, apply(as.table(x), 1, function(.x).x[any(.x < cutoff)])) Change as.table(x) by your table On 04/03/2008, rich @ thevillas. eclipse. co. uk <[EMAIL PROTECTED]> wrote: > > > > > sorry, it would probably better be described as a table > > thanks > > >

Re: [R] creating a matrix subset based on a threshold cutoff

2008-03-04 Thread [EMAIL PROTECTED]
sorry, it would probably better be described as a table thanks On Tue Mar 4 11:28 , "Henrique Dallazuanna" sent: You have a table or matrix? if is matrix: set.seed(123) x <- matrix(rnorm(100), 10, 10) cutoff <- -1.5 do.call(rbind, apply(x, 1, function(

Re: [R] creating a matrix subset based on a threshold cutoff

2008-03-04 Thread Henrique Dallazuanna
You have a table or matrix? if is matrix: set.seed(123) x <- matrix(rnorm(100), 10, 10) cutoff <- -1.5 do.call(rbind, apply(x, 1, function(.x).x[any(.x < cutoff)])) On 04/03/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >Hi, > > I have a table of x rows and y columns. The table is

[R] creating a matrix subset based on a threshold cutoff

2008-03-04 Thread [EMAIL PROTECTED]
Hi, I have a table of x rows and y columns. The table is huge and so i'd like to create a subset of the data containing rows where any of the y values are below a threshold, say 1e-4. Is there a simple way of doing this in R? thanks Rich _