As I said previously, I'm only concerned about what was published in the
archive of stat.ethz.ch.
I visited https://stat.ethz.ch/mailman/listinfo/r-help to find out where I had
to send my request to remove those messages and I read:
R-help list run by maechler at stat.math.ethz.ch, bates at
Dear All,
Can somebody explain me how to correctly set a new class-specific method
for generic functions (e.g. for plot, summary and print). I simply
programmed these functions with the class names and it works perfectly.
E.g.:
x-2
y-3
class(x)-newclass
class(y)-newclass
This message could be useful for people fairly new to S4 classes.
Therefore r-help and not r-devel.
One use for showMethods(), important to me,
is to find all methods that use a particular class in their signatures.
This works:
showMethods(class=Action, where=package:CTDesignExplorer)
Hi,
list1-as.list(c(hi I am here!,my name is bob!, I am mary!!, bob likes
mary!!))
list2- list1[grepl(bob,unlist(list1))]
list2
#[[1]]
#[1] my name is bob!
#
#[[2]]
#[1] bob likes mary!!
A.K.
Hm thanks :P
but i was actually trying to say is like...
if my list were more random like below
Colleagues,
I am in the process of learning R. I've been able to import my dataset (from
Stata) and do some simple coding. I have now come to coding situation that
requires some assistance. This is some code in SPSS that I would like to be
able to execute in R:
if (race eq 1 and usborn=0)
HI,
A modified code to avoid the ?sapply()
df1- structure(list(Dates = structure(c(13151, 13152, 13153, 13154,
13157, 13158, 13159, 13160, 13161, 13164), class = Date), P1 = c(10,
13, 16, 19, 22, 25, 28, 31, 34, 37), P2 = c(100, 102, 104, 106,
108, 110, 112, 114, 116, 118), P3 = c(90, 94, 98,
Hi,
Try:
set.seed(429)
dat1-
data.frame(race=sample(1:3,20,replace=TRUE),usborn=sample(0:2,20,replace=TRUE))
dat1$confused- 1*((dat1$race==1|dat1$race==2) dat1$usborn==0)
head(dat1)
# race usborn confused
#1 3 2 0
#2 1 0 1
#3 2 1 0
#4 3 2
Just a slight addition to Arun's answer: within() saves typing and
makes life a bit easier
#
set.seed(429)
dat1 - data.frame(
race=sample(1:3,20,replace=TRUE),
usborn=sample(0:2,20,replace=TRUE))
# within is a nice way to add variables
#
On 21.09.2013 22:40, John Gonzalez wrote:
As I said previously, I'm only concerned about what was published in the
archive of stat.ethz.ch.
And it is OK to habe your post on Nabble (and many others) after you
removed it from stat.ethz.ch? Are the swiss that bad?
I visited
On 13-09-21 3:30 PM, Mikhail Beketov wrote:
Dear All,
Can somebody explain me how to correctly set a new class-specific method
for generic functions (e.g. for plot, summary and print). I simply
programmed these functions with the class names and it works perfectly.
E.g.:
x-2
y-3
On Sat, Sep 21, 2013 at 10:25 AM, David Winsemius
dwinsem...@comcast.net wrote:
On Sep 21, 2013, at 3:13 AM, Prof Brian Ripley wrote:
On 21/09/2013 08:17, Gabor Grothendieck wrote:
On Fri, Sep 20, 2013 at 4:31 PM, carlisle thacker
carlisle.thac...@gmail.com wrote:
I was looking for
Thanks!
This worked wonderfully!
Very exciting!
-- Mosi
On Sep 22, 2013, at 3:20 AM, Joshua Wiley jwiley.ps...@gmail.com wrote:
Just a slight addition to Arun's answer: within() saves typing and
makes life a bit easier
#
set.seed(429)
dat1
Is this what you were after:
## A function to generate a RCB design
rcbd-function(b,g,rb,cb,r,c)
+ {
+# b =number of blocks
+# g = a vector of treatments
+# rb = number of rows per blocks
+# cb =number of columns per block
+# r = total rows
+# c = total columns
+
Ira,
No problem.
If you change the ?for() loop to ?lapply, there should be increase in speed
(Usually, it is not the case. Here it is does, but still not as good in terms
of speed as the method I showed).
df1- structure(list(Dates = structure(c(13151, 13152, 13153, 13154,
13157, 13158, 13159,
Hi,
see tutorial for Adegenet, http://adegenet.r-forge.r-project.org/ |
Documents | adegenet-basics.pdf | section 6. It should help You.
Vojtěch
-
Vojtěch Zeisek
Department of Botany, Faculty of Science, Charles Uni., Prague, CZ
Institute of Botany, Academy of Science, Czech Republic
Colleagues,
I have generated several dummy variables:
n$native0 - 1 * (n$re==white n$usborn==yes)
n$native1 - 1 * (n$re==afam n$usborn==yes)
n$native2 - 1 * (n$re==carib n$usborn==yes)
n$native3 - 1 * (n$re==carib n$usborn==no)
I would now like to combine these into a single categorical
Hi,
Try:
set.seed(385)
df- data.frame(re= sample(c(white,afam,carib),20,replace=TRUE), usborn=
sample(c(yes,no),20,replace=TRUE),stringsAsFactors=FALSE)
df1-within(df,{native3- 1*(re==carib usborn==no); native2-
1*(re==carib usborn==yes); native1- 1*(re==afam usborn==yes);
native0-
Hi,
Not sure this is what you wanted.
df2- melt(df1,id.vars=c(re,usborn))
df2New-df2[df2$value==1,-4]
df2New$variable-as.numeric(gsub([[:alpha:]],,df2New$variable))
colnames(df2New)[3]- native
row.names(df2New)- 1:nrow(df2New)
df2New
# re usborn native
#1 white yes 0
#2 white
Hi,
If you don't want to install any package:
colnames(df1)[grep(native,colnames(df1))]-
gsub(([[:alpha:]])(\\d+),\\1_\\2,colnames(df1)[grep(native,colnames(df1))])
df2-reshape(df1,direction=long,varying=3:ncol(df1),sep=_)[,-5]
df3-df2[as.logical(df2$native),-4]
colnames(df3)[3]- native
Thanks Jim,
What you have done is very good.
I was wondering if we could draw some horizontal and vertical lines to
separate the blocks. Is it possible using R?
Regards,
Laz
On 9/22/2013 11:10 AM, jim holtman wrote:
Is this what you were after:
## A function to generate a RCB design
just to clarify how I see the error, it was the mis-definition of the
penalty term in the function dv. The following code corrects this error.
What is actually being minimised at this step is the penalised deviance
conditional on the smoothing parameter. A second issue is that the optim
default
On 09/23/13 07:52, Laz wrote:
SNIP
I was wondering if we could draw some horizontal and vertical lines to
separate the blocks. Is it possible using R?
SNIP
See fortune(Yoda). :-)
cheers,
Rolf Turner
__
R-help@r-project.org mailing list
Is Yoda an R package? I tried:
install.packages(Yoda)
Warning in install.packages :
package 'Yoda' is not available (for R version 3.0.1)
Warning in install.packages :
package 'Yoda' is not available (for R version 3.0.1)
How do I proceed from here?
Regards,
Laz
On 9/22/2013 4:21 PM,
Hello,
No, 'Yoda' is not a package, the package is 'fortunes':
library(fortunes) # load it in the R session
fortune(Yoda)
Or, if you don't want to load the package,
fortunes::fortune(Yoda)
Rui Barradas
Em 22-09-2013 21:32, Laz escreveu:
Is Yoda an R package? I tried:
Hi,
fortune(Yoda) returns a quote of fortunes.
My problem was to draw horizontal and vertical lines to separate the
blocks in my design. Each block has 4 elements. The first and second
rows and columns are in block 1, 3rd and 4th rows and 1st and 2nd
columns are in 3 etc
[,1] [,2]
Hi Mosi,
The easiest approach would be be generate native from re and usborn
directly, rather than generating dummy codes as an intermediate step:
n$native - interaction(n[c(re, usborn)])
This has the advantage of preserving the meanings of the levels of
native in the resulting factor, so that
On 9/21/2013 11:12 PM, Kiyoshi Sasaki wrote:
I have been trying to produce a conditional plot using coplot function
(http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/coplot.html) for a binary response (Presence in
my case) variable and one continuous variable (Overstory) given a
I am tryin to perform an arcsine transformation on my data containig
percentages as the dep. variable. Does anyone have a code that I could use
to do that? I am relatively new to R. Thanks for your help!
--
View this message in context:
CHeck out the 'tables' package if you want to create pretty outputs of
your tables. Exactly where do you plan to use them? You can also use
Sweave/Latex to create such tables.
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how
Thank you! Your codes produced plots that was fairly close to what I wanted. I
am not familiar with ggplot2, so I need to study what exactly each code is
doing. Actually, I also want to plot the observed (raw) data points (not just
confidence intervals shown by ggplot, assuming that colored
peake peake.19 at osu.edu writes:
I am tryin to perform an arcsine transformation on my data containig
percentages as the dep. variable. Does anyone have a code that I could use
to do that? I am relatively new to R. Thanks for your help!
asin(x/100)
? or
asin(x/100)*2/pi if you want the
Tena koe
I think you'll find the arcsine transformation is asin(sqrt(x/100)) where × is
the percentage. However, it might be better to ask whether the data wouldn't
be better analysed using generalised models (e.g., glm).
HTH
Peter Alspach
-Original Message-
From:
On 13-09-22 09:25 PM, Peter Alspach wrote:
Tena koe
I think you'll find the arcsine transformation is asin(sqrt(x/100))
where × is the percentage. However, it might be better to ask
whether the data wouldn't be better analysed using generalised models
(e.g., glm).
HTH
Good
I am doing a self study, trying to understand PLS.
I have run across the following and hope that someone here can clarify as
to what is going on.
These are the data from Wold et al. (1984)
dat - structure(list(t = 1:15, y = c(4.39, 4.42, 5, 5.85, 4.35, 4.51,
6.33, 6.37, 4.68, 5.04, 7.1, 5.04, 6,
Thanks for the advice. Like I said, I am still pretty new to R, and stats
in general. I tried wading through the search results on google, but I
didn't really find anything that I could understand. I am working with
percentages as my dependent variable, and I am trying to get my
distribution as
Hi,
I want to compare to barplots with same horizontal axis limits.
x=c(55,56,57,58,59,60,60,60,61,62,63,64,65)
y=c(35,40,45,50,55,60,60,60,65,70,75,80,85)
par(mfrow=c(2,1))
barplot(table(x),xlim=c(35,85))
barplot(table(y),xlim=c(35,85))
par(mfrow=c(1,1))
But the bars disappear.
Hi,
You may try:
set.seed(49)
m1 = matrix(rnorm(30), nrow = 3)
m2 = matrix(rnorm(30), nrow = 3)
corsP-vector()
for(i in 1:3) corsP[i] = cor(m1[i,], m2[i,])
corsP
#[1] 0.58411274 -0.02382329 0.03760757
diag(cor(t(m1),t(m2)))
#[1] 0.58411274 -0.02382329 0.03760757
#or
mNew- rbind(m1,m2)
On 09/23/2013 12:55 PM, David Arnold wrote:
Hi,
I want to compare to barplots with same horizontal axis limits.
x=c(55,56,57,58,59,60,60,60,61,62,63,64,65)
y=c(35,40,45,50,55,60,60,60,65,70,75,80,85)
par(mfrow=c(2,1))
barplot(table(x),xlim=c(35,85))
barplot(table(y),xlim=c(35,85))
Hi there,
I plot a simple plot with the following code:
plot (rnorm(1:10), type = b)
legend(top, test, lty = 1, pch = 21)
The result is something wired for the line crosses the point in the
legend while the line does not cross the point in the main plot.
Is there possibility to draw the
You could try ggplot() as well.
library(ggplot2)
library(gridExtra)
library(plyr)
x1- count(x)
y1- count(y)
p1-ggplot(x1,aes(x=x,y=freq))+geom_bar(stat=identity,colour=gray,fill=red)+xlim(c(35,85))+
theme_bw()+ theme(axis.line=element_line(colour=black),
panel.grid.major=element_blank(),
On 09/23/2013 01:56 PM, arun wrote:
You could try ggplot() as well.
library(ggplot2)
library(gridExtra)
library(plyr)
x1- count(x)
y1- count(y)
p1-ggplot(x1,aes(x=x,y=freq))+geom_bar(stat=identity,colour=gray,fill=red)+xlim(c(35,85))+
theme_bw()+ theme(axis.line=element_line(colour=black),
Hi,
May be this helps.
set.seed(55)
x-rnorm(1:10)
plot(x,type=n,xaxt=n,yaxt=n)
legend1- legend(top,test,lty=1,pch=21)
range1- range(x)
range1[2]- 1.05* (range1[2]+ legend1$rect$h)
plot(x,ylim=range1,type=b)
legend1- legend(top,test,lty=1,pch=21)
A.K.
- Original Message -
From:
Hi,
Use `drop=FALSE`.
b- matrix(c(2,1,-1,-2),ncol=1)
b[1:3,1]
#[1] 2 1 -1
b[1:3,1,drop=FALSE]
#or
b[1:3,,drop=FALSE]
# [,1]
#[1,] 2
#[2,] 1
#[3,] -1
A.K.
hi all,
i got a small question tonight.
matrix(b,4)[]
[,1]
[1,] 2
[2,] 1
[3,] -1
[4,] -2
On Sep 22, 2013, at 10:54 PM, Jinsong Zhao wrote:
Hi there,
I plot a simple plot with the following code:
plot (rnorm(1:10), type = b)
legend(top, test, lty = 1, pch = 21)
?par
plot (rnorm(1:10), type = b)
legend(top, test, lty = 69, pch = 21)
The result is something wired for the line
44 matches
Mail list logo