Re: [R] duplicate data

2013-02-05 Thread Rui Barradas

Hello,

To average the values of z in case of duplicated x and y, you can use

s2 - aggregate(z ~ x + y, data = sorpe, FUN = mean)


Hope this helps,

Rui Barradas

Em 05-02-2013 07:06, Richard Müller escreveu:

Hello,

I have a long list of x-, y- and z-data and try to generate a heatmap.
Obviously there are several data with identical x- and y-values. I get
the following error message:

Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap = extrap,  :
   duplicate data points: need to set 'duplicate = ..'

Unfortunately there seems no help screen on duplicate. I'd prefer to
average the z-values in case there are identical x/y-values. Is that
possible?

If necessary for an answer I'll copy the short script below.

Thanks for helping!
Richard

%
  #RM¨u 5.2.2013, r.muel...@oeko-sorpe.de
require(akima)  # Das Paket akima wird ben¨otigt, um
# nicht vorhandene Punkte zu interpolieren# und einen 
sch¨onen
Farbgradienten hinzukriegen
sorpe - read.csv(bis_130204-korr.csv)
pdf(sorpe.pdf)  # Es wird nicht auf den Bildschirm gezeichnet,
# sondern ein PDF-Dokument erstellt.
zr - range(290,220) # Hier wird der Bereich f¨ur die z-Werte# festgelegt:


plot(ylim = c(7.9, 8),  # Der Bereich der Achsen wird definiert
xlim = c(51.30, 51.4),
x ~ y,  # Es soll ein x-y-Diagramm werden
sorpe,
# Aufruf der x-, y-, z-Tabelle
pch = NA)   # Die Punkte f¨ur die x-y-Wertepaare sollen unsichtbar 
sein (’NA’)
sorpe.li - interp(sorpe$x, sorpe$y, sorpe$z)
# Hier werden die fehlenden Punkte interpoliert
image(sorpe.li, # In das Diagramm wird ein Rasterbild aus den
interpolierten Werten gezeichnet
zlim = zr,  # Der vorher definierte Wertebereich wird aufgerufen
col = rev(rainbow(  # Ein in R vordefiniertes Farbmodell wird verwendet
30, start = 0, end = 8/12)),
# mit 30 Farbabstufungen, die den z-Werten zugeordnet 
werden.
add = TRUE) # Das Bild wird ¨uber das bereits Vorhandene# gezeichnet
contour(sorpe.li,   # Isohypsen werden eingezeichnet
add = TRUE)
points(sorpe,   # Die urspr¨unglichen Messpunkte werden
pch = 1)# eingezeichnet, und zwar als Kreise







__
R-help@r-project.org 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] duplicate data

2013-02-04 Thread Richard Müller
Hello,

I have a long list of x-, y- and z-data and try to generate a heatmap.
Obviously there are several data with identical x- and y-values. I get
the following error message:

Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap = extrap,  :
  duplicate data points: need to set 'duplicate = ..'

Unfortunately there seems no help screen on duplicate. I'd prefer to
average the z-values in case there are identical x/y-values. Is that
possible?

If necessary for an answer I'll copy the short script below.

Thanks for helping!
Richard

%
 #RM¨u 5.2.2013, r.muel...@oeko-sorpe.de
require(akima)  # Das Paket akima wird ben¨otigt, um
# nicht vorhandene Punkte zu interpolieren# und einen 
sch¨onen
Farbgradienten hinzukriegen
sorpe - read.csv(bis_130204-korr.csv)
pdf(sorpe.pdf)# Es wird nicht auf den Bildschirm gezeichnet,
# sondern ein PDF-Dokument erstellt.
zr - range(290,220)# Hier wird der Bereich f¨ur die z-Werte# festgelegt:


plot(ylim = c(7.9, 8),  # Der Bereich der Achsen wird definiert
xlim = c(51.30, 51.4),
x ~ y,  # Es soll ein x-y-Diagramm werden
sorpe,
# Aufruf der x-, y-, z-Tabelle
pch = NA)   # Die Punkte f¨ur die x-y-Wertepaare sollen unsichtbar 
sein (’NA’)
sorpe.li - interp(sorpe$x, sorpe$y, sorpe$z)
# Hier werden die fehlenden Punkte interpoliert
image(sorpe.li, # In das Diagramm wird ein Rasterbild aus den
interpolierten Werten gezeichnet
zlim = zr,  # Der vorher definierte Wertebereich wird aufgerufen
col = rev(rainbow(  # Ein in R vordefiniertes Farbmodell wird verwendet
30, start = 0, end = 8/12)),
# mit 30 Farbabstufungen, die den z-Werten zugeordnet 
werden.
add = TRUE) # Das Bild wird ¨uber das bereits Vorhandene# gezeichnet
contour(sorpe.li,   # Isohypsen werden eingezeichnet
add = TRUE)
points(sorpe,   # Die urspr¨unglichen Messpunkte werden
pch = 1)# eingezeichnet, und zwar als Kreise





-- 
Richard Müller . Am Spring 9 . D-58802 Balve
http://www.oeko-sorpe.de - http://www.phytoplankton.info -
http://independent.academia.edu/Richard

__
R-help@r-project.org 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] duplicate data

2013-02-04 Thread Pascal Oettli

Hello,

From ?interp.old

duplicate   

character string indicating how to handle duplicate data points. 
Possible values are


error
produces an error message,

strip
remove duplicate z values,

mean,median,user
calculate mean , median or user defined function (dupfun) of 
duplicate z values.



HTH,
Pascal


Le 13/02/05 16:06, Richard Müller a écrit :

Hello,

I have a long list of x-, y- and z-data and try to generate a heatmap.
Obviously there are several data with identical x- and y-values. I get
the following error message:

Error in interp.old(x, y, z, xo = xo, yo = yo, ncp = 0, extrap = extrap,  :
   duplicate data points: need to set 'duplicate = ..'

Unfortunately there seems no help screen on duplicate. I'd prefer to
average the z-values in case there are identical x/y-values. Is that
possible?

If necessary for an answer I'll copy the short script below.

Thanks for helping!
Richard

%
  #RM¨u 5.2.2013, r.muel...@oeko-sorpe.de
require(akima)  # Das Paket akima wird ben¨otigt, um
# nicht vorhandene Punkte zu interpolieren# und einen 
sch¨onen
Farbgradienten hinzukriegen
sorpe - read.csv(bis_130204-korr.csv)
pdf(sorpe.pdf)  # Es wird nicht auf den Bildschirm gezeichnet,
# sondern ein PDF-Dokument erstellt.
zr - range(290,220) # Hier wird der Bereich f¨ur die z-Werte# festgelegt:


plot(ylim = c(7.9, 8),  # Der Bereich der Achsen wird definiert
xlim = c(51.30, 51.4),
x ~ y,  # Es soll ein x-y-Diagramm werden
sorpe,
# Aufruf der x-, y-, z-Tabelle
pch = NA)   # Die Punkte f¨ur die x-y-Wertepaare sollen unsichtbar 
sein (’NA’)
sorpe.li - interp(sorpe$x, sorpe$y, sorpe$z)
# Hier werden die fehlenden Punkte interpoliert
image(sorpe.li, # In das Diagramm wird ein Rasterbild aus den
interpolierten Werten gezeichnet
zlim = zr,  # Der vorher definierte Wertebereich wird aufgerufen
col = rev(rainbow(  # Ein in R vordefiniertes Farbmodell wird verwendet
30, start = 0, end = 8/12)),
# mit 30 Farbabstufungen, die den z-Werten zugeordnet 
werden.
add = TRUE) # Das Bild wird ¨uber das bereits Vorhandene# gezeichnet
contour(sorpe.li,   # Isohypsen werden eingezeichnet
add = TRUE)
points(sorpe,   # Die urspr¨unglichen Messpunkte werden
pch = 1)# eingezeichnet, und zwar als Kreise







__
R-help@r-project.org 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] duplicate data between two data frames according to row names

2012-07-18 Thread jeff6868
Hi everybody.

I'll first explain my problem and what I'm trying to do. 
Admit this example:
I'm working on 5 different weather stations.
I have first in one file 3 of these 5 weather stations, containing their
data. Here's an example of this file:

DF1 - data.frame(station=c(ST001,ST004,ST005),data=c(5,2,8))

And my two other stations in this other data.frame:

DF2 - data.frame(station=c(ST002,ST003),data=c(3,7))

I would like to add geographical coordinates of these weather stations
inside these two data.frames, according to the number of the weather
station.

All of my geographical coordinates for each of the 5 weather stations are
inside another data frame:

DF3 -
data.frame(station=c(ST001,ST002,ST003,ST004,ST005),lat=c(40,41,42,43,44),lon=c(1,2,3,4,5))

My question is: how can I put automatically these geographical coordinates
inside my first 2 data frames, according to the number of the weather
station?

For this example, the first two data frames DF1 and DF2 should become:

DF1 -
data.frame(station=c(ST001,ST004,ST005),lat=c(40,43,44),lon=c(1,4,5),data=c(5,2,8))
and
DF2 -
data.frame(station=c(ST002,ST003),lat=c(41,42),lon=c(2,3),data=c(3,7))

I need to automatize this method because my real dataset contains 70 weather
stations, and each file contains other (or same sometimes) stations , but
each station can be found in the list of the coordinates file (DF3).

Is there any way or any function able to do this kind of thing?

Thank you very much!




--
View this message in context: 
http://r.789695.n4.nabble.com/duplicate-data-between-two-data-frames-according-to-row-names-tp4636845.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] duplicate data between two data frames according to row names

2012-07-18 Thread Eik Vettorazzi
Hi Jeff,
looks like a job for ?rbind and ?merge

merge(rbind(DF1,DF2),DF3)


hth

Am 18.07.2012 10:21, schrieb jeff6868:
 Hi everybody.
 
 I'll first explain my problem and what I'm trying to do. 
 Admit this example:
 I'm working on 5 different weather stations.
 I have first in one file 3 of these 5 weather stations, containing their
 data. Here's an example of this file:
 
 DF1 - data.frame(station=c(ST001,ST004,ST005),data=c(5,2,8))
 
 And my two other stations in this other data.frame:
 
 DF2 - data.frame(station=c(ST002,ST003),data=c(3,7))
 
 I would like to add geographical coordinates of these weather stations
 inside these two data.frames, according to the number of the weather
 station.
 
 All of my geographical coordinates for each of the 5 weather stations are
 inside another data frame:
 
 DF3 -
 data.frame(station=c(ST001,ST002,ST003,ST004,ST005),lat=c(40,41,42,43,44),lon=c(1,2,3,4,5))
 
 My question is: how can I put automatically these geographical coordinates
 inside my first 2 data frames, according to the number of the weather
 station?
 
 For this example, the first two data frames DF1 and DF2 should become:
 
 DF1 -
 data.frame(station=c(ST001,ST004,ST005),lat=c(40,43,44),lon=c(1,4,5),data=c(5,2,8))
 and
 DF2 -
 data.frame(station=c(ST002,ST003),lat=c(41,42),lon=c(2,3),data=c(3,7))
 
 I need to automatize this method because my real dataset contains 70 weather
 stations, and each file contains other (or same sometimes) stations , but
 each station can be found in the list of the coordinates file (DF3).
 
 Is there any way or any function able to do this kind of thing?
 
 Thank you very much!
 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/duplicate-data-between-two-data-frames-according-to-row-names-tp4636845.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org 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.
 


-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und 
Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; 
Gerichtsstand: Hamburg

Vorstandsmitglieder: Prof. Dr. Guido Sauter (Vertreter des Vorsitzenden), Dr. 
Alexander Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus 

__
R-help@r-project.org 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] duplicate data between two data frames according to row names

2012-07-18 Thread jeff6868
merge is enough for me, thanks!
I was thinking about a loop, or a function like grep, or maybe another
function.
I'll have to think easier next time!
Thanks again! 

--
View this message in context: 
http://r.789695.n4.nabble.com/duplicate-data-between-two-data-frames-according-to-row-names-tp4636845p4636859.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] duplicate data between two data frames according to row names

2012-07-18 Thread arun


Hi,

You could use merge, join etc.
merge(DF3,DF2)
 # station lat lon data
#1   ST002  41   2    3
#2   ST003  42   3    7
library(plyr)
 join(DF3,DF2,type=inner)
Joining by: station
#  station lat lon data
#1   ST002  41   2    3
#2   ST003  42   3    7

#or
join(DF3,DF2,type=right)


Hope this helps
A.K.



- Original Message -
From: jeff6868 geoffrey_kl...@etu.u-bourgogne.fr
To: r-help@r-project.org
Cc: 
Sent: Wednesday, July 18, 2012 4:21 AM
Subject: [R] duplicate data between two data frames according to row names

Hi everybody.

I'll first explain my problem and what I'm trying to do. 
Admit this example:
I'm working on 5 different weather stations.
I have first in one file 3 of these 5 weather stations, containing their
data. Here's an example of this file:

DF1 - data.frame(station=c(ST001,ST004,ST005),data=c(5,2,8))

And my two other stations in this other data.frame:

DF2 - data.frame(station=c(ST002,ST003),data=c(3,7))

I would like to add geographical coordinates of these weather stations
inside these two data.frames, according to the number of the weather
station.

All of my geographical coordinates for each of the 5 weather stations are
inside another data frame:

DF3 -
data.frame(station=c(ST001,ST002,ST003,ST004,ST005),lat=c(40,41,42,43,44),lon=c(1,2,3,4,5))

My question is: how can I put automatically these geographical coordinates
inside my first 2 data frames, according to the number of the weather
station?

For this example, the first two data frames DF1 and DF2 should become:

DF1 -
data.frame(station=c(ST001,ST004,ST005),lat=c(40,43,44),lon=c(1,4,5),data=c(5,2,8))
and
DF2 -
data.frame(station=c(ST002,ST003),lat=c(41,42),lon=c(2,3),data=c(3,7))

I need to automatize this method because my real dataset contains 70 weather
stations, and each file contains other (or same sometimes) stations , but
each station can be found in the list of the coordinates file (DF3).

Is there any way or any function able to do this kind of thing?

Thank you very much!




--
View this message in context: 
http://r.789695.n4.nabble.com/duplicate-data-between-two-data-frames-according-to-row-names-tp4636845.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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@r-project.org 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] duplicate data points on a line graph

2009-07-16 Thread Chuck Cleland
On 7/15/2009 9:56 PM, Carl Witthoft wrote:
 If you want to take the second  approach, it can be relatively easily
 generalized by calculating the cex values based on the count of ordered
 pairs in the original dataset.
 
 Here's a data set:
 xy
  x y
 [1,] 1 4
 [2,] 1 5
 [3,] 2 3
 [4,] 3 3
 [5,] 4 5
 [6,] 5 2
 [7,] 1 4
 [8,] 2 3
 
 Here's the same set fully sorted:
 
 xy[order(x,y),]-xyord
  x y
 [1,] 1 4
 [2,] 1 4
 [3,] 1 5
 [4,] 2 3
 [5,] 2 3
 [6,] 3 3
 [7,] 4 5
 [8,] 5 2
 
 There's gotta be some very simple way to create a series of values for
 cex but I'm missing it, other than a loop like
 
 cexvec-rep(1,8)
 for i in 2:8 {
 if (xyord[i,1]==xyord[i-1,1]  xyord[i,2]== xyord[i-1,2] ) {
 
 cexvec[i]-cexvec[i-1]+1
 }
 }

  How about using ave() like this:

x - sample(0:4, 60, replace=TRUE)
y - sample(0:4, 60, replace=TRUE)
xy - data.frame(x, y)
xy$freq - ave(xy$x, x, y, FUN=length)

with(xy, plot(x, y, cex=freq))

 You get the idea, sort of  :-)
 
 Carl
 
 
 On 7/15/2009 2:19 PM, NDC/jshipman wrote:
 Hi,
 I am new to R plot.  I am trying to increase the data point
 observation when duplicate data points exist

 xy
 110
 110
 23
 45
 9 8


 in the about example  1, 10 would be displayed larger than the other
 data points.  Could someone give me some assistance with this problem
 
   A couple of simple approaches:
 
 x - c(1,1,2,4,9)
 
 y - c(10,10,3,5,8)
 
 plot(jitter(x), jitter(y))
 
 plot(x, y, cex=c(2,2,1,1,1))
 
 757-864-7114
 LARC/J.L.Shipman/jshipman
 Jeffery.L.Shipman at nasa.gov
 
 __
 R-help@r-project.org 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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@r-project.org 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] duplicate data points on a line graph

2009-07-16 Thread Jim Lemon

NDC/jshipman wrote:

Hi,
I am new to R plot.  I am trying to increase the data point 
observation when duplicate data points exist


xy
110
110
23
45
9 8


in the about example  1, 10 would be displayed larger than the other 
data points.  Could someone give me some assistance with this problem

Hi Jeffery,
Have a look at sizeplot, cluster.overplot and count.overplot in the 
plotrix package.


Jim

__
R-help@r-project.org 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] duplicate data points on a line graph

2009-07-15 Thread NDC/jshipman

Hi,
	I am new to R plot.  I am trying to increase the data point  
observation when duplicate data points exist


x   y
1   10
1   10
2   3
4   5
9   8


in the about example  1, 10 would be displayed larger than the other  
data points.  Could someone give me some assistance with this problem





757-864-7114
LARC/J.L.Shipman/jshipman
jeffery.l.ship...@nasa.gov

__
R-help@r-project.org 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] duplicate data points on a line graph

2009-07-15 Thread Dieter Menne



LARC/J.L.Shipman/jshipman wrote:
 
   I am new to R plot.  I am trying to increase the data point  
 observation when duplicate data points exist
 
 x y
 1 10
 1 10
 2 3
 4 5
 9 8
 
 in the about example  1, 10 would be displayed larger than the other  
 data points.  Could someone give me some assistance with this problem
 

Not exactly what you want, but ?sunflowerplot might come close.

Dieter

-- 
View this message in context: 
http://www.nabble.com/duplicate-data-points-on-a-line-graph-tp24503299p24503357.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] duplicate data points on a line graph

2009-07-15 Thread Chuck Cleland
On 7/15/2009 2:19 PM, NDC/jshipman wrote:
 Hi,
 I am new to R plot.  I am trying to increase the data point
 observation when duplicate data points exist
 
 xy
 110
 110
 23
 45
 9 8
 
 
 in the about example  1, 10 would be displayed larger than the other
 data points.  Could someone give me some assistance with this problem

  A couple of simple approaches:

x - c(1,1,2,4,9)

y - c(10,10,3,5,8)

plot(jitter(x), jitter(y))

plot(x, y, cex=c(2,2,1,1,1))

 757-864-7114
 LARC/J.L.Shipman/jshipman
 jeffery.l.ship...@nasa.gov
 
 __
 R-help@r-project.org 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@r-project.org 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] duplicate data points on a line graph

2009-07-15 Thread baptiste auguie
Alternatively, you could make use of transparency (on some devices), or use
ggplot2 to map the number of observations to the point size,

d =
read.table(textConnection(
x   y
1   10
1   10
2   3
4   5
9   8
),head=T)

library(ggplot2)

# transparency
qplot(x, y, data=d, alpha=I(0.5))

d2 = unique(ddply(d,.(x,y), transform, count=length(x)))
# mapping number of obs.
qplot(x, y, data=d2,size=count)

HTH,

baptiste

2009/7/15 Chuck Cleland cclel...@optonline.net

 On 7/15/2009 2:19 PM, NDC/jshipman wrote:
  Hi,
  I am new to R plot.  I am trying to increase the data point
  observation when duplicate data points exist
 
  xy
  110
  110
  23
  45
  9 8
 
 
  in the about example  1, 10 would be displayed larger than the other
  data points.  Could someone give me some assistance with this problem

   A couple of simple approaches:

 x - c(1,1,2,4,9)

 y - c(10,10,3,5,8)

 plot(jitter(x), jitter(y))

 plot(x, y, cex=c(2,2,1,1,1))

  757-864-7114
  LARC/J.L.Shipman/jshipman
  jeffery.l.ship...@nasa.gov
 
  __
  R-help@r-project.org 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.

 --
 Chuck Cleland, Ph.D.
 NDRI, Inc. (www.ndri.org)
 71 West 23rd Street, 8th floor
 New York, NY 10010
 tel: (212) 845-4495 (Tu, Th)
 tel: (732) 512-0171 (M, W, F)
 fax: (917) 438-0894

 __
 R-help@r-project.org 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.


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] duplicate data points on a line graph

2009-07-15 Thread Carl Witthoft
If you want to take the second  approach, it can be relatively easily 
generalized by calculating the cex values based on the count of ordered 
pairs in the original dataset.


Here's a data set:
 xy
 x y
[1,] 1 4
[2,] 1 5
[3,] 2 3
[4,] 3 3
[5,] 4 5
[6,] 5 2
[7,] 1 4
[8,] 2 3

Here's the same set fully sorted:

xy[order(x,y),]-xyord
 x y
[1,] 1 4
[2,] 1 4
[3,] 1 5
[4,] 2 3
[5,] 2 3
[6,] 3 3
[7,] 4 5
[8,] 5 2

There's gotta be some very simple way to create a series of values for 
cex but I'm missing it, other than a loop like


cexvec-rep(1,8)
for i in 2:8 {
if (xyord[i,1]==xyord[i-1,1]  xyord[i,2]== xyord[i-1,2] ) {

cexvec[i]-cexvec[i-1]+1
}
}

You get the idea, sort of  :-)

Carl


On 7/15/2009 2:19 PM, NDC/jshipman wrote:
 Hi,
 I am new to R plot.  I am trying to increase the data point
 observation when duplicate data points exist

 xy
 110
 110
 23
 45
 9 8


 in the about example  1, 10 would be displayed larger than the other
 data points.  Could someone give me some assistance with this problem

  A couple of simple approaches:

x - c(1,1,2,4,9)

y - c(10,10,3,5,8)

plot(jitter(x), jitter(y))

plot(x, y, cex=c(2,2,1,1,1))

 757-864-7114
 LARC/J.L.Shipman/jshipman
 Jeffery.L.Shipman at nasa.gov

__
R-help@r-project.org 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.