[R] R: polygon error?

2007-05-26 Thread Guazzetti Stefano
It seems to me that you are using polygon in a wrong way. What you probably need could be something like: polygon(c(rev(t$z), t$z), c(rep(0, nrow(t)), t$ht), col=2, border=NA) Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di LL Inviato:

[R] R: Simple programming question

2007-05-18 Thread Guazzetti Stefano
try also this dfr$score-factor(dfr$var3 %in% sort(unique(dfr$var3), decr=T)[1:2] * dfr$var3, labels=c(low, mid, high)) Hope this helps, Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Lauri Nikkinen Inviato: venerdì 18 maggio

[R] R: extract from a data frame

2007-04-23 Thread Guazzetti Stefano
Oats[Oats$Variety %in% c(Victory, Golden Rain),] or subset(Oats, Variety %in% c(Victory, Golden Rain)) Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di elyakhlifi mustapha Inviato: lunedì 23 aprile 2007 9.56 A: R-help@stat.math.ethz.ch Oggetto: [R]

[R] R: math-operations

2007-03-30 Thread Guazzetti Stefano
I guess you need %% and %/% try 513 %/% 100 [1] 5 513 %% 100 [1] 13 ?%% Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Schmitt, Corinna Inviato: venerdì 30 marzo 2007 15.34 A: r-help@stat.math.ethz.ch Oggetto: [R] math-operations Hallo

[R] R: Searching and deleting elements of list

2007-03-08 Thread Guazzetti Stefano
you could try mapply mydata2-mapply([, mydata, lapply(mydata, function(x) !x %in% A)) mydata2[[1]]-A #to replace the obviously deleted elements of A mydata2 mydata2[[1]] mydata2[[2]] mydata2[[3]] mydata2[[4]] Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL

[R] R: Grouping columns in a data frame based on the values of a column

2006-09-15 Thread Guazzetti Stefano
Perhaps using 'ave' and 'cut': df - data.frame(x=runif(100, 0.1, 1), y=rnorm(100, 0.2, 0.6)) df$xcut-cut(df$x, seq(0, 1, 0.1)) df$z-ave(df$y, df$xcut) df[order(df$x),] Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di [EMAIL PROTECTED] Inviato:

[R] R: data.frame to shape

2006-08-09 Thread Guazzetti Stefano
assuming that the rows are sorted correctly dat id x y 1 50 1647685 4815259 2 50 1647546 4815196 3 50 1647454 4815294 4 50 1647405 4815347 5 50 1647292 4815552 6 50 1647737 4815410 7 74 1647555 4815201 8 74 1647464 4815023 9 74 1646970 4815129 10 74 1646895 4815264 11 74

[R] R: the first and last case

2006-07-26 Thread Guazzetti Stefano
could it be dat[unlist(tapply(1:nrow(dat), ind, range)),] ? stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Mauricio Cardeal Inviato: 26 July, 2006 14:22 A: r-help@stat.math.ethz.ch Oggetto: [R] the first and last case

[R] R: determination of number of entries in list elements

2006-05-19 Thread Guazzetti Stefano
You need lapply or sapply for example: sapply(yourlist, length) then you can do subset(yourlist, sapply(yourlist, length) yourlength) Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Benjamin Otto Inviato: 19 May, 2006 12:10 A:

[R] R: R: [Re:] function to replace missing values with median value?]]

2006-05-04 Thread Guazzetti Stefano
PROTECTED] [mailto:[EMAIL PROTECTED] conto di Guazzetti Stefano Inviato: Thursday, May 04, 2006 07:55 AM A: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Oggetto: [R] R: [Re:] function to replace missing values with median value?]] there is also

[R] R: [Re:] function to replace missing values with median value?]]

2006-05-03 Thread Guazzetti Stefano
there is also a replace function -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di [EMAIL PROTECTED] Inviato: Thursday, May 04, 2006 07:31 AM A: [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Oggetto: [R] [Re:] function to replace

[R] R: Dotplot x-axis

2006-04-14 Thread Guazzetti Stefano
Take a look at the scales argument in dotpolot. Maybe you need something like: position-exp(-5:0)/(1+exp(-5:0)) dotplot(type~freq/(3027-freq), scales=list(x=list(log=T, at=position, lab=round(position, 3))) ) Stefano -Messaggio originale- Da: [EMAIL PROTECTED]

[R] R: Fw: Controling the x or y limit

2006-02-10 Thread Guazzetti Stefano
perhaps you are looking at something like plot(0, xlim=c(0,20), xaxt=n) axis(1, at=pretty(0:20, 10)) Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Subhabrata Inviato: venerdì 10 febbraio 2006 7.05 A: r-help Cc: [EMAIL PROTECTED] Oggetto: [R] Fw:

[R] R: dataframe subset

2006-02-08 Thread Guazzetti Stefano
Dear Bernhard, if I understand correctly your question may be you want something like df-data.frame(x=sample(1:10, 100, repl=T), y=sample(1:5, 100, repl=T)) subset(df, x%in%y) Regards, Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL

[R] R: Graph with values of coordinates of points in x axis

2005-06-15 Thread Guazzetti Stefano
try: plot(x, y, type=l, xlab=Months, xaxt=n, ylab=Y values) axis(1, at=0:5*6) Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di Massimiliano Tripoli Inviato: mercoledì 15 giugno 2005 10.35 A: r-help@stat.math.ethz.ch

R: [R] weighted.mean and tapply (again)

2005-05-26 Thread Guazzetti Stefano
what about using mapply? splitted.value-with(x.1, split(VALUE, GROUP)) splitted.freq-with(x.1, split(FREQUENCY, GROUP)) mapply(weighted.mean, splitted.value, w=splitted.freq) Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] conto di [EMAIL

[R] unexpected behaviour of 'curve' function

2004-11-26 Thread Guazzetti Stefano
Dear all, curve(x^3*(1-x)^7, from = 0, to = 1) works as expected but, omitting the xlim or the to and from arguments and calling curve more than once: par(mfrow = c(2,2)) for (i in 1:4) curve(x^3*(1-x)^7) gives an expected (al least to me) result. Note also that a pu object is returned by

R: [R] How to plot this

2004-11-17 Thread Guazzetti Stefano
Hi, looking at ?plot.density you will find a zero.line argument: set it to FALSE and no gray lines will appear in the plot. plot(density(y), zero.line = F, main= , ann = F, xlim = c(0, 4), ylim = c(0, 1), lty = 2, col = 4, axes = F) #and the add mtext(side = 1, line = 0, text = Environmental

R: [R] retrieve rows from frame assuming criterion

2004-07-23 Thread Guazzetti Stefano
Assuming your data.frame is called data data[data$PUNTAR==c(IX49,IX48),] is probably what you want Stefano -Messaggio originale- Da: Luis Rideau Cruz [mailto:[EMAIL PROTECTED] Inviato: venerdì 23 luglio 2004 15.37 A: [EMAIL PROTECTED] Oggetto: [R] retrieve rows from frame

R: [R] retrieve rows from frame assuming criterion [corrected]

2004-07-23 Thread Guazzetti Stefano
sorry for my previus (WRONG) answer, as someone already pointed out a solution could be subset(data, PUNTAR==c(IX49,IX48)) -Messaggio originale- Da: Guazzetti Stefano Inviato: venerdì 23 luglio 2004 15.55 A: 'Luis Rideau Cruz'; [EMAIL PROTECTED] Oggetto: R: [R] retrieve rows from

R: R: [R] retrieve rows from frame assuming criterion [corrected]

2004-07-23 Thread Guazzetti Stefano
: venerdì 23 luglio 2004 16.30 A: Guazzetti Stefano Cc: Luis Rideau Cruz; [EMAIL PROTECTED] Oggetto: Re: R: [R] retrieve rows from frame assuming criterion [corrected] On Fri, 23 Jul 2004, Guazzetti Stefano wrote: sorry for my previus (WRONG) answer, as someone already pointed out

R: [R] proportions confidence intervals

2004-07-12 Thread Guazzetti Stefano
You should consider prop.test or binom.test. The problem you will find is that these functions are not intended to do what you want but to give you one confidence interval at a time. However a starting point could be : I-sample(1:50) #the numerator N-sample(50:200, 50) #the denominator

R: [R] Creating Binary Outcomes from a continuous variable

2004-07-07 Thread Guazzetti Stefano
consider a cutpoint of 20 x-runif(100, min=1, max=50) as.integer(x 20) Stefano -Messaggio originale- Da: Doran, Harold [mailto:[EMAIL PROTECTED] Inviato: mercoledì 7 luglio 2004 14.57 A: [EMAIL PROTECTED] Oggetto: [R] Creating Binary Outcomes from a continuous variable Dear

R: [R] help with histogram

2004-05-07 Thread Guazzetti Stefano
Maybe you want something like: x-rnorm(1000) hist(x, breaks=100, col=ifelse(abs((hist(x, breaks=100, main=))$breaks) 1.669, 4,2)) see also the density argument in ?hist Stefano -Messaggio originale- Da: Martin Olivier [mailto:[EMAIL PROTECTED] Inviato: venerdì 7 maggio 2004 14.40

R: [R] lines and glm

2004-04-08 Thread Guazzetti Stefano
You probably mean something like: ti - 1:1000 e1 - rnorm(1000) e2 - rnorm(1000) x - 0.0001*ti+e1 y2 - -2+x+e2 y - ifelse(y20,1,0) plot(x, y, pch = 16, col = darkblue, main = expression(paste(Scatter diagram of , italic(y[t]), against , italic(x[t]))), xlab =

R: [R] Changing background in splom et al.

2004-03-03 Thread Guazzetti Stefano
trellis.device(bg=white, color=F) before your call to splom could make what you want but take also a look at ?trellis.par.set Stefano -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Inviato: mercoledì 3 marzo 2004 12.10 A: r-help Oggetto: [R] Changing