[R] Merge two dataframes of different column length and row length by two columns at a time

2006-07-21 Thread Gunther Höning

Hello,

I have two dataframes of the following structures:

str(a)
`data.frame':   1354896 obs. of  14 variables:
 $ V1 : int  0 1 2 3 4 5 6 7 8 9 ...
 $ V2 : int  0 0 0 0 0 0 0 0 0 0 ...
 $ V3 : int  74 12305 103 12337 46 57 12446 90 12097 79 ...
 $ V4 : num11.8 1529.2   17.8 1579.46.7 ...
 $ V5 : int  88 11040 104 11557 56 58 11040 74 10991 81 ...
 $ V6 : num15.5 1921.3   20.3 1888.2   12.6 ...
 $ V7 : int  87 8793 90 10142 67 64 9264 73 8589 71 ...
 $ V8 : num16.0 1750.6   15.2 1783.7   11.0 ...
 $ V9 : int  68 11279 93 11831 43 61 11234 82 10919 76 ...
 $ V10: num11.5 1999.5   39.0 1842.25.0 ...
 $ V11: int  110 12456 92 12063 60 59 12393 82 11831 77 ...
 $ V12: num21.4 1974.7   33.9 1689.9   10.6 ...
 $ V13: int  81 10887 101 10874 62 74 5 79 10789 93 ...
 $ V14: num19.5 1812.3   31.7 1524.1   11.9 ...
 str(b)
`data.frame':   1213901 obs. of  4 variables:
 $ V1: int  0 1 2 3 5 6 7 8 9 10 ...
 $ V2: int  0 0 0 0 0 0 0 0 0 0 ...
 $ V3: Factor w/ 54676 levels str23,str53,..: 54676 54676 54676 54676
54676 54676 54676 54676 54676 54676 ...
 $ V4: Factor w/ 3 levels Match,NoMatch,..: 2 2 2 2 2 2 2 2 2 2 ...
 

I want to merge these dataframes by V1 and V2 of a and b. The combination of
V1, V2 is a unique key.
Note that b is smaller than a.

Any suggestions to solve this problem ?





Gunther Höning

Diplom Physiker
Bioinformatiker

Langenbeckstraße1
55131 Mainz

[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Calculate x-values from a spline

2006-07-28 Thread Gunther Höning
Hello,

I calculate splines from messured points(x,y) of an unknown function f(x).
e.g.
x - c(0.004115, 0.012345, 0.037037, 0.10, 0.30, 1.00)
y - c(37, 50, 45, 60, 50, 66)
w - c(0.8540541, 0.832, 0.882, 0.798, 0.822, 0.8151515) as
weights
f - smooth.spline(x,y,w)

Now I have y-values and want to calculate the x-value(s) from this spline.
There is no further limitation to the spline, like monotonicity or anything
else..

Does anyone know how to do this ?

Gunther



[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] AffyChip Background Analysis

2006-08-29 Thread Gunther Höning
Dear list,

I want to analyse some HG133Plus2.0 Affymetrix chips.
The first thing I intent to do, is just to perform a background correction
(mas, rma, gcrma,...) with the cel files.
Then I want to take a look at the files.
How can I do this ? 

Gunther

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Question on AffyBatch

2006-09-06 Thread Gunther Höning
Dear list,

I'm trying to find out the following in an AffyBatch.

To get the indices from a loction on a chip I use the function xy2i() for
the hgu133plus2 by Affymetrix.
But now I want to know the name of the probe located at this spot. How can
this be done?
And what about the locations used as QC?

Gunther

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Question on apply()

2006-09-18 Thread Gunther Höning
 Dear list,

I try to do the following:
I have an list of length n, with elements done by smooth.spline
(SmoothList).
Now I have a matrix with n rows and m columns with x-values(Xarray) 
Now I want ot predict the y-values.
Therefor I want to take the first element of SmoothList and the first row of
Xarray and predict for each element in Xarray the y value.
And then take the second element of SmoothList and second row of Xarray,
third row of SmoothList and third row of Xarray and so on

I tried following:

NewValues - function(x,LIST){predict(LIST,x)}
apply(Xarray, 2, NewValues,SmoothList)

But it don't work.

Could anybody help please ?

Gunther

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question on apply() with more information...

2006-09-18 Thread Gunther Höning
Ok.
I tried this too, but it still doesn't work.
Here some more information to try out, but just an excerpt of Xarray

x - c(0.11,0.25,0.45,0.65,0.80,0.95,1)
Y - matrix(c(15,83,57,111,150,168,175,37,207,142,277,375,420,437),nrow=2)

sm - function(y,x){smooth.spline(x,y)} 
SmoothList - apply(Y,1,sm,x)
NewValues - function(x,LIST){predict(LIST,x)} 
Xarray -
matrix(c(0.15,0.56,0.66,0.45,0.19,0.17,0.99,0.56,0.77,0.41,0.11,0.63,0.42,0.
43),nrow=2)


apply(Xarray, 2, NewValues,SmoothList)
apply(Xarray, 2, NewValues,LIST=SmoothList)



-Ursprüngliche Nachricht-
Von: Petr Pikal [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 18. September 2006 08:43
An: Gunther Höning; r-help@stat.math.ethz.ch
Betreff: Re: [R] Question on apply()

Hi

not much information about what can be wrong. As nobody knows your Xarray
and SmoothList it is hard to guess. You even omitted to show what does not
work
So here are few guesses.

predict usually expects comparable data
apply(Xarray, 2, NewValues,LIST=SmoothList)


HTH
Petr




On 18 Sep 2006 at 8:05, Gunther Höning wrote:

From:   Gunther Höning [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Mon, 18 Sep 2006 08:05:28 +0200
Subject:[R] Question on apply()

  Dear list,
 
 I try to do the following:
 I have an list of length n, with elements done by smooth.spline 
 (SmoothList).
 Now I have a matrix with n rows and m columns with x-values(Xarray) 
 Now I want ot predict the y-values. Therefor I want to take the first 
 element of SmoothList and the first row of Xarray and predict for each 
 element in Xarray the y value. And then take the second element of 
 SmoothList and second row of Xarray, third row of SmoothList and third 
 row of Xarray and so on
 
 I tried following:
 
 NewValues - function(x,LIST){predict(LIST,x)} apply(Xarray, 2, 
 NewValues,SmoothList)
 
 But it don't work.
 
 Could anybody help please ?
 
 Gunther
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented, 
 minimal, self-contained, reproducible code.

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question on apply() with more information...

2006-09-18 Thread Gunther Höning
Hi,

I tried both ideas, but it isn't that what I'm looking for.
I want to avoid for loop, because the matrix is of big size(1200*1200
entries)

With a loop I would do:

for ( i in seq(along = SmoothList))
{
Xarry[i,] - predict(SmoothList[[i]],Xarry[i,])$y
} 

Actually I want to do more than just to predict a value, but it isn't
important for the initial question...

Gunther

-Ursprüngliche Nachricht-
Von: Petr Pikal [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 18. September 2006 11:44
An: Gunther Höning
Cc: r-help@stat.math.ethz.ch
Betreff: Re: AW: [R] Question on apply() with more information...

Hi

If I am correct apply do not choose from SmoothList as you expected. 
Instead probably

lapply(SmoothList, predict,Xarray)
or
mapply(predict,SmoothList, Xarray)

can give you probably what you want.

HTH
Petr


On 18 Sep 2006 at 9:26, Gunther Höning wrote:

From:   Gunther Höning [EMAIL PROTECTED]
To: 'Petr Pikal' [EMAIL PROTECTED],
r-help@stat.math.ethz.ch
Subject:AW: [R] Question on apply() with more information...
Date sent:  Mon, 18 Sep 2006 09:26:01 +0200

 Ok.
 I tried this too, but it still doesn't work.
 Here some more information to try out, but just an excerpt of Xarray
 
 x - c(0.11,0.25,0.45,0.65,0.80,0.95,1)
 Y -
 matrix(c(15,83,57,111,150,168,175,37,207,142,277,375,420,437),nrow=2)
 
 sm - function(y,x){smooth.spline(x,y)} SmoothList - apply(Y,1,sm,x) 
 NewValues - function(x,LIST){predict(LIST,x)} Xarray - 
 matrix(c(0.15,0.56,0.66,0.45,0.19,0.17,0.99,0.56,0.77,0.41,0.11,0.63,0
 .42,0. 43),nrow=2)
 
 
 apply(Xarray, 2, NewValues,SmoothList) apply(Xarray, 2, 
 NewValues,LIST=SmoothList)
 
 
 
 -Ursprüngliche Nachricht-
 Von: Petr Pikal [mailto:[EMAIL PROTECTED]
 Gesendet: Montag, 18. September 2006 08:43
 An: Gunther Höning; r-help@stat.math.ethz.ch
 Betreff: Re: [R] Question on apply()
 
 Hi
 
 not much information about what can be wrong. As nobody knows your 
 Xarray and SmoothList it is hard to guess. You even omitted to show 
 what does not work So here are few guesses.
 
 predict usually expects comparable data apply(Xarray, 2, 
 NewValues,LIST=SmoothList)
 
 
 HTH
 Petr
 
 
 
 
 On 18 Sep 2006 at 8:05, Gunther Höning wrote:
 
 From: Gunther Höning [EMAIL PROTECTED]
 To:   r-help@stat.math.ethz.ch
 Date sent:Mon, 18 Sep 2006 08:05:28 +0200
 Subject:  [R] Question on apply()
 
   Dear list,
  
  I try to do the following:
  I have an list of length n, with elements done by smooth.spline 
  (SmoothList). Now I have a matrix with n rows and m columns with
  x-values(Xarray) Now I want ot predict the y-values. Therefor I want 
  to take the first element of SmoothList and the first row of Xarray 
  and predict for each element in Xarray the y value. And then take 
  the second element of SmoothList and second row of Xarray, third row 
  of SmoothList and third row of Xarray and so on
  
  I tried following:
  
  NewValues - function(x,LIST){predict(LIST,x)} apply(Xarray, 2,
  NewValues,SmoothList)
  
  But it don't work.
  
  Could anybody help please ?
  
  Gunther
  
  __
  R-help@stat.math.ethz.ch mailing list 
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html and provide commented, 
  minimal, self-contained, reproducible code.
 
 Petr Pikal
 [EMAIL PROTECTED]
 

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Accessing C- source code of R

2006-09-26 Thread Gunther Höning
Dear list,

I'm looking for the sources code of parts of R, (e.g. spline).
Does anyone know where I can access it ?

Gunther

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Accessing C- source code of R

2006-09-27 Thread Gunther Höning
That's exactly what I was looking for...

Thanks!
Gunther

-Ursprüngliche Nachricht-
Von: Uwe Ligges [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 26. September 2006 10:13
An: Gunther Höning
Cc: r-help@stat.math.ethz.ch
Betreff: Re: [R] Accessing C- source code of R



Gunther Höning wrote:
 Dear list,
 
 I'm looking for the sources code of parts of R, (e.g. spline).
 Does anyone know where I can access it ?

I plan to write a corresponding R Help Desk article on Accessing the
source. A draft is available from:
http://www.statistik.uni-dortmund.de/~ligges/R_Help_Desk_preview.pdf

Can you please tell me if this description is sufficient?

Thanks,
Uwe Ligges


 Gunther
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 3 dimensional histogram

2007-02-16 Thread Gunther Höning
Dear list,

I want to plot a 3 dimensional histogram and  I am looking for a funktion
to do so.
I have a dataframe with the following information:

1  0.50  -0.5   -1
a 13  11  6   2   1   
b 9   8   6   5   3   
c 5   4   3   2   1
d 8   4   3   1   0

The first column is the name, the other columns are the amounts under a
certain threshold. 
First row are the thresholds.

Can anybody help me ?

Gunther

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Sorting dataframe by different columns

2007-06-08 Thread Gunther Höning
Dear list,

I have a very short question,
Suggest a dataframe of four columns.

df - data.frame(w,x,y,z)

I want this ordered the following way:
first by :x, decreasing = FALSE
and 
secondly by: z, decreasing =TRUE

How can this be done ?

Thanks

Gunther

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.