where is the problem?
input:
A-c(2,3,2); B-c(1,2,1); C-c(4,4,5); D-c(3,5,4)
df-data.frame(A,B,C,D)
c1-1:2; c2-3:4
df[,c1]*df[,c2]
output:
A B
1 8 3
2 12 10
3 10 4
Peter Wolf
Christoph Scherber wrote:
Dear R users,
Suppose I have 2 parts of a dataframe, say
ABCD
2143
3245
2154
]+diff(par()$usr[3:4])*.017,
boxwex=0.02*diff(par()$usr[3:4]),pch=8)
Peter Wolf
*
__
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
concerning question 1: -- labeling of outliers --
you can get the outliers by boxplot(...)$out
try:
set.seed(17)
x-rexp(99)
names(x)-paste(x,1:99)
out-boxplot(x)$out
text(rep(1.1,length(out)), out, names(out))
Peter Wolf
Stephen D. Weigand wrote:
Dear Yulei,
On Sep 26, 2005, at 6:56 PM
1.483691
$4
[1] 1.745427
$5
[1] 1.602120
Peter Wolf
Frank Schmid wrote:
Dear R-users
For a given matrix of dimension, say (n,p), I'd like to extract for every
column those elements that are bigger than twice the interquartile range of
the corresponding column.
Can I get these elements without using
Martin Maechler wrote:
Peter == Peter Wolf [EMAIL PROTECTED]
on Wed, 21 Sep 2005 16:49:10 +0200 writes:
Peter In the moment I am writing an R function for drawing
Peter bagplots (two dimensional boxplots).
Peter For some elements of the plot are found numerically
do read the posting guide! http://www.R-project.org/posting-guide.html
???
dat-rnorm(100)
hist(dat,prob=TRUE)
x-seq(-3.5,3.5,length=100)
y-dnorm(x)
lines(x,y)
have a look at: http://cran.at.r-project.org/doc/manuals/R-intro.pdf
Peter Wolf
__
R-help
/software/R-wtools/bagplot/bagplot.R
( R code )
http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/bagplot/bagplot.pdf
(examples and description)
Now I am looking for examples to test / to improve my function.
Where can I get data sets and the corresponding correct bagplots?
Thanks
Peter Wolf
3 0.03
e 4 0.04 1 0.01 4 0.04 2 0.02
f 2 0.02 5 0.05 2 0.02 2 0.02
g 4 0.04 5 0.05 3 0.03 3 0.03
h 3 0.03 3 0.03 5 0.05 4 0.04
i 1 0.01 0 0.00 3 0.03 3 0.03
output-end
Peter Wolf
David Whiting wrote:
Hi,
I often need to take columns from two data.frames and 'splice' them
Try:
NAMES=c(NRes.1.2., NRes.1.3., NRes.1.4., NRes.1.5., NRes.1.6.)
pattern-NRes\.([0-9]*)\.([0-9]*)\.
data.frame(x=sub(pattern,\\1,NAMES),y=sub(pattern,\\2,NAMES))
@
output-start
Thu Aug 25 14:08:50 2005
x y
1 1 2
2 1 3
3 1 4
4 1 5
5 1 6
output-end
Peter Wolf
Anon. wrote:
I'm sure I'm
.
Can I have multiple subsets? I.e. In Stata: if( x 5 y 3 )
Try:
x-rnorm(20,0,5)
y-2*x+rnorm(20)
# plot without condition
plot(x,y)
# some conditions on x and y
index- x5 y3
plot(x[index],y[index])
Peter Wolf
TIA
Michael
to install the img-package for tcltk
For further info see:
http://www.wiwi.uni-bielefeld.de/~wolf/software/relax/relax.html
maintainer:
Hans Peter Wolf
Department of Economics
University of Bielefeld
[EMAIL PROTECTED]
R Editor for Literate Analysis and lateX
--- the all-in-one editor
(){
# Mark Hempelmann / Peter Wolf
par(bg=blue4, col=white, col.main=white,
col.sub=white, font.sub=2, fg=white) # set colors and fonts
samp - function(N,D) N*(1/4+D)/(1/4+D*N)
z-outer(seq(1, 800, by=10), seq(.0025, 0.2, .0025)^2/1.96^2,
samp) # create 3d matrix
]*DRY[4]+WET[2]*DRY[3]+WET[3]*DRY[2]+WET[4]*DRY[1],
WET[1]*DRY[5]+WET[2]*DRY[4]+WET[3]*DRY[3]+WET[4]*DRY[2]+WET[5]*DRY[1])
print(CYCLE.n)
[1] NA 20 90 190 360 640
Peter Wolf
Mohammad Ehsanul Karim wrote:
Dear list,
Is there anyway i can make the following formula short
by r-programming
for any help.
Peter Wolf
For illustration purpose a simple example follows:
you can get warnings after an error occured or after
exiting from the function but not at once after
x-matrix(1:3,2,2):
options(warn=0)
f-function(x){
x-matrix(1:3,2,2)
print(0)
warnings() # no warning
Prof Brian Ripley wrote:
On Wed, 18 May 2005, Peter Wolf wrote:
I am looking for a way to get a warning message
immediately after an evaluation within a function.
To get error messages you can use geterrmessage().
Well, only in an error handler, as an error normally throws you out
chcode() to define hex.to.dec(), dec.to.hex() and sum.hex()
to operate with hex numbers.
Peter Wolf
--
define chcode=
chcode - function(b, base.in=2, base.out=10, digits=0123456789ABCDEF){
# change of number systems, pwolf 10/02
# e.g.: from 2 2 2 2
)
@
output-start
decimal representation: 159
[1] 09F
output-end
Is chcode the function you are looking for?
Peter Wolf
Hanke, Alex wrote:
Help
I can produce the hexidecimal equivalent of a decimal number but I am having
a hard time reversing the operation. I'm good for hex representations to 159
and am
/foo)
output-start
[1] foo
output-end
or try:
strsplit(abc/foo,/)[[1]][2]
output-start
[1] foo
output-end
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org
] 1.48 0.00 1.53 0.00 0.00
[1] 1.17 0.00 1.22 0.00 0.00
[1] 4.10 0.01 4.39 0.00 0.00
[1] 2.58 0.01 3.24 0.00 0.00
[1] 1.10 0.00 1.29 0.00 0.00
Wed Oct 6 11:26:38 2004
[1] -79.34809 -79.34809 -79.34809 -79.34809 -79.34809 -79.34809
output-end
Peter Wolf
Robin Hankin wrote:
Hi
the manpage says
10 1013 10 10
[6,] 10 10 10 1024 10 10
[7,] 10 10 10 10 10 1013
[8,] 10 10 10 10 10 1024
... or integrate the loop into a.block.diag
Peter Wolf
best wishes
Robin
a.block.diag - function(a,b,pad=0) {
## a.block.daig
. In case of
x-array(1:8,rep(2,3)); y-array(-1,rep(2,3))
the function adiag will be a little bit faster.
Peter Wolf
Robin Hankin wrote:
Hi
I have two arbitrarily dimensioned arrays, a and b, with
length(dim(a))==length(dim(b)). I want to form a sort of
corner-to-corner version of abind
]] )
@
output-start
Wed Sep 22 14:43:09 2004
[[1]]
[1] -9 -18 -27 -36
[[2]]
[1] 0 0 0 0 0 0 0
[[3]]
[1] 20 20 20 20 20
output-end
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http
(with
~ 2000 rows). The dimensions of the matrices are not all the same. My
ideal would be a set of functions of the form
obj - create() # computes the object
save(obj,filename)
obj - load(filename)
Have a look at
? dump
? source
Peter Wolf
__
[EMAIL PROTECTED
there are two main ideas to improve the efficiency:
1. the comparison with the limit can be done at first
2. a matrix with boxsize*boxsize rows can be defined so that
you can apply function apply without using inner loops
*=
# parameters
size-1024; limit-0.7
# some data
set.seed(17);
Try:
x - data.frame(x1 = 1: 5, y11 = 1: 5,
x2 = 6:10, y21 = 6:10, y22 = 11:15,
x3 = 11:15, y31 = 16:20,
x4 = 16:20, y41 = 21:25, y42 = 26:30, y43 = 31:35)
df.names-names(x)
ynames-df.names[grep(y,df.names)]
xnames-substring(sub(y,x,ynames),1,2)
/posting-guide.html
what about:
mtdist- as.matrix(dist(Fbg['Test']))
dimnames(mtdist) - list( Fbg[ 'Family' ], Fbg[ 'Family' ] )
mtdist [ Fbg['Code']==m ,Fbg['Code']==t ]
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman
,)outer(y,y,),2,sum)
@
at last some polishing
*=
result-apply(outer(x,x,)outer(y,y,),2,sum)+1
names(result)-letters[1:8]
result
@
output-start
Wed Jun 2 10:59:03 2004
a b c d e f g h
1 1 1 1 1 2 2 3
output-end
in the case of more than 2 dimensions you have to add further
outer-operations
Peter Wolf
package:base R Documentation
Control Flow
Description:
...
Usage:
if(cond) expr
if(cond) cons.expr else alt.expr
for(var in seq) expr
...
Examples:
for(i in 1:5) print(1:i)
for(n in c(2,5,10,20,50)) {
x - rnorm(n)
cat(n,:, sum(x^2),\n)
}
Peter
?
Read the text of the warning again.
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
What about:
y-rnorm(100);z-sample(1:7,100,T);boxplot(y~z);points(y~z)
Peter Wolf
Ted Harding wrote:
Hi folks,
I have a vaiable Y and an associated factor Z at several (13)
levels.
boxplot(Y~Z)
produces a nice array of boxplots, one for each level of Z,
and each duly labaelled with its level of Z
[,x]
else NA))
names(x)-N
result-rbind(result,x)
}
result
}
rbind.data.frame.NA(B,A,C)
@
output-start
Fri Apr 30 15:21:21 2004
a b
1 1 NA
2 2 NA
3 3 NA
11 1 4
21 2 5
31 3 6
12 NA 4
22 NA 5
32 NA 6
output-end
Peter Wolf
Duncan Murdoch wrote:
On Fri, 30 Apr 2004 13:47:35
, parameter, etc. because
there is a function t().
Peter Wolf
Murray Keir wrote:
I've created a dataframe containing multiple ACF lists through the command
rev.acf-apply(rev.matrix, 2, acf, na.action=na.contiguous, lag.max=12, plot=FALSE)
where rev.matrix is an n by t matrix containing n time series
(){
on.off-tclvalue(cbValue)
if(on.off==1) tkconfigure(en, state=normal)
if(on.off==0) tkconfigure(en, state=disabled)
print(on.off)
}
tkbind(top,1,set.entry.state)
Do you know http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples?
Peter Wolf
need some additional features to be allowed to use the table-widget!
you have to include:
tclRequire(Tktable)
... and all is ok for 1.8.1 and I also hope for 1.9.0.
see: http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tktable.html
Peter Wolf
Hallo here is a simple proposal using tcltk-sliders.
Peter Wolf
# step 1: define general slider function
slider-function(refresh.code,names,minima,maxima,resolutions,starts,title=control,no=0,
set.no.value=0){
# pw 03/2004
if(no!=0)
return(as.numeric(tclvalue(get(paste(slider,no,sep
-- which increase the set of R programming
pearls
and will enrich the discussion in my lectures
Peter Wolf
Richard A. O'Keefe wrote:
I asked where index origin 0 would help.
(I am familiar with Dijkstra's article on why counting should start
at 0 and agree whole-heartedly. I am also convinced
experiments have been to implement APL functions
like take, drop, rotate, ... and now you are looking for a more elegant way
to manage origin 0 than +QUAD.IO.
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
){
j-i-1
a[adapt(0)]-a[adapt(i)]
while(a[adapt(j)]a[adapt(0)]){
a[adapt(j+1)]-a[adapt(j)]
j-j-1
}
a[adapt(j+1)]-a[adapt(0)]
}
return(a[-1])
}
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https
Peter Wolf
Fred J. wrote:
Hello
I have a data frame with many col.s and rows
V4 V5 V6 V7
3 4 5 6
1 4 4 1
2 4 4 1
4 0 5 1
since the data has the middle 2 rows with V5 and V6
are equal, I need to produce
V4 V5 V6 V7
3 4 5 6
this line removed and the value V7 = 1
/2)
ind-outer(which(x),(-m):m,+)
ind-ind[ind0 ind = length(x)]
x[ind]-TRUE
x
}
x-rep(FALSE,20); x[c(4,10,19)]-TRUE
expand.true(x,span=5)
[1] FALSE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE
[13] FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE
Peter Wolf
Petr Pikal
Frank Gerrit Zoellner wrote:
Hi!
I have a question concerning data frames and changing particular values in it.
I have set up a data frame containing n rows of observations od dimension m, so in each row there is a vector of size m. Now I want to introduce a cut off to tha data. Therfore I
,]111111111
[6,]011111110
[7,]011111110
[8,]001111100
[9,]000010000
Peter Wolf
0
Peter Wolf
Christof Bigler wrote:
I try to find a circular filter that I can export to be used in a
spatial software.
Assuming, we have a matrix, representing 9x9 regularly spaced points
Haiyan Chen wrote:
Hello,
1. After I generate a 100x50 matrix by x3-matrix(0,100,50);for (i in
1:100) {x1-rpois(50, mu[i]);x2-x1; x2[runif(50).01]-0; x3[i,]-x2},
2. I want to calculate means and sample variances of each row and create a
new matrix 100x2;
Try:
mean.var-function(n=10, m=5){
[EMAIL PROTECTED] wrote:
Hello,
Splus contains the function intbin(x,l).
This function allows to make a conversion from an integer x to a binary of
length l.
for example
intbin(3,2) returns 11
intbin(3,3) returns 011
Do you know how to do it in R ?
Thank you meriema
allan clark wrote:
Hi all
Another simple question.
I would like to plot three graphs one the same plot with different
colours. Say red, blue and black. Here are the functions.
r1-1+5*cos(2*pi*seq(1:100)/20)+rnorm(100)
r2-1+7*sin(2*pi*seq(1:100)/20)+rnorm(100)
:
http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/formfill/ff.html
or http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/formfill/ff.rd
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
juli g. pausas wrote:
Dear all,
I'd like to subset a df within a function, and use select for choosing
the variable. Something like (simplified example):
mydf - data.frame(a= 0:9, b= 10:19)
ttt - function(vv) {
tmpdf - subset(mydf, select= vv)
mean(tmpdf$vv)
}
ttt(mydf$b)
But this is not
)
}))
print(all(round(100*rslpy)==round(100*rData)))
@
output-start
[1] 1.49 0.00 1.49 0.00 0.00
[1] 0.92 0.00 0.92 0.00 0.00
[1] TRUE
output-end
Peter Wolf
Uwe Ligges wrote:
Maurice McHugh wrote:
Hello everyone-
I have a 3-d array with the 1st dimension being monthly mean data that
I would like
Perez Martin, Agustin wrote:
DeaR useRs:
I would like to assign a values in an object using a loop 'for'.
This is a reduce example of my problem, my real problem is a few
complicated:
for (j in 1:10) {
x.j-rnorm(100)
}
I want to create 10 objects as x.1, x.2, ... , x.9, x.10 with values
, not very nice
Peter Wolf
Gabor Grothendieck wrote:
Based on an off list email conversation, I had I am concerned that
my original email was not sufficiently clear.
Recall that I wanted to use a for loop to iterate over the rows of
a dataframe without using indices. Its easy to do this over
-cbind(as.vector(cl),as.vector(t(cl)))
res-apply(cl,1,function(xx)fun(x[,xx[1]],x[,xx[2]]))
matrix(res,ncol(x),ncol(x))
}
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-bielefeld.de/~wolf/software/R-wtools/faces/faces.pdf
Some random faces:
http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/faces/p20618291De3NA.jpg
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
y - c( OLDa, ALL, OLDc, OLDa, OLDb, NEW, OLDb,
OLDa, ALL,...)
el - c(OLDa, OLDb, OLDc, NEW, ALL)
match(y,el)
[1] 1 5 3 1 2 4 2 1 5 NA
Peter Wolf
---
Peter Dalgaard wrote:
Muhammad Subianto [EMAIL PROTECTED] writes:
Dear R-helper,
I have a data set like
(window and linux) from
http://www.wiwi.uni-bielefeld.de/~wolf/software/revweb/rtrevive.exe
after installation the package, you have to type:
library(rtrevive)
rwined()
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman
Michele Grassi wrote:
Hi.
1)I have two variables: call a-c(e.g.0,3,6,7...)
b-c(e.g.6,8,3,4...)
I want to create a third vector z wich contain the
pairs values z-c(0,6,3,8,6,3,7,4and so on for each
pairs (a,b)).
There is a specific function?
How can i write my own
one is given by my R function ff.
ff allows you to substitute expressions by evaluated results in a raw
report.
See:
http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/formfill/ff.html
or http://www.wiwi.uni-bielefeld.de/~wolf/software/R-wtools/formfill/ff.rd
Peter Wolf
=as.character(a))
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-help
Try:
x-matrix(1:16,4,4)
x[col(x)=row(x)]-NA
x[,! apply(x,2,function(x) all(is.na(x))) ]
[,1] [,2] [,3]
[1,] NA NA NA
[2,]2 NA NA
[3,]37 NA
[4,]48 12
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https
.
Peter Wolf
Department of economics
University of Bielefeld
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-bielefeld.de/~wolf/software/R-wtools/decodeencode.rev
Peter Wolf
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
,2) #
# style: = UREDA= UREDA like stem ( m = 2, 5 ) #
##
#Author: #
# Peter Wolf 05/2003
Some days ago I wrote a function for rotating
a cloud of points. To control the rotation a simple
Tcl/Tk-widget is used. Here you can find the
R code:
http://www.wiwi.uni-bielefeld.de/~wolf/software/spin3R/spin3R.sch
Peter Wolf, [EMAIL PROTECTED]
Richard A. O'Keefe wrote:
I have found
---
Peter Wolf, Statistik/Informatik, Fak.f.Wiwi, Uni Bielefeld
[EMAIL PROTECTED], http://www.wiwi.uni-bielefeld.de/~wolf/wolf.html
---
[[alternate HTML version
F4
[5,] A D F5
[6,] A D F6
merge(t1,t2,1:2)
V1 V2 V3.x V3.y
1 A C E1 F1
2 A C E1 F2
3 A D E2 F5
4 A D E2 F6
5 B C E3 F3
6 B C E3 F4
--- Peter Wolf
__
[EMAIL PROTECTED] mailing list
https
4 10045 1005
# pw 02/2003
if(is.logical(pos.insert)){
pos.insert - pos.insert[pos.insert]/length(pos.insert) +
cumsum(!pos.insert)[pos.insert]
}
x-c(x,x.insert)[order(c(seq(x),pos.insert))]
return(x)
}
Peter Wolf
--
Dr. Agustin Lobo wrote
66 matches
Mail list logo