I use several different versions of R, including RGui on Windows and rstudio on
Linux. In all cases, I use graphical commands, such as image().
image() displays rectangles, but I want to be able to guarantee that the
heights of those rectangles will always equal the widths. Typically, the
r
Hi,
It's easy, just carry the arguments in '…' forward to where you expect to pass
them along.
mynumbs<-function(x,y,z=5,...){
numbs<-sort(sample(y,z, ...))
for (i in 1:(x-1))
numbs<-rbind(numbs,sort(sample(y,z, ...)))
print(numbs)
}
Cheers,
Ben
On Nov 18, 2013, at 8:52 PM, "Lopez, Dan
Thanks, that seems to work.
On Fri, Nov 15, 2013 at 10:26 PM, arun kirshna [via R] <
ml-node+s789695n4680556...@n4.nabble.com> wrote:
> Hi,
>
> Try:
> var1 <- load("reshape_data.frame.RData")
> ##It is better not to name the objects with function names.
> dat1 <- data
> reshape1 <- reshape
> na
I have information in a 3 dimensional list that I want to use to create
a table for a written report.
The 3d list was created by applying the epiR function " epitest " to a
list of 8 2x2 tables using lapply.
The resulting list gives the 12 statistics with CIs, that generated by
epitest,
numbs <- rbind(numbs, sort(sample(y, z, ... )))
See
?Reserved
which sends you to 'Introduction to R'
Rich
On Mon, Nov 18, 2013 at 8:52 PM, Lopez, Dan wrote:
> Hi R Experts,
>
> How do you get the ... to work in a user-defined function such as the one I
> have below?
> For example if I want to
Hi:
I want to calculate how much the values in a binary matrix varies, and
for that I apply the sd() method.
mat <- matrix(c(1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1), nrow=4, ncol=3)
stddev <- sd(dist(mat, method="binary"))
And i get the following answer:
stddev
[1] 0.3442652
Is this correct? Or
I have a data set in which I am trying to plot a convex hull in 3 dim. Below
is a subset of the points I would use. Columns 2,3,4 are my x,y,z
coordinates. I found some ways to plot 2D convext hulls or find a convex
hull for higher dimensions, but not how to plot the data.
I have have attached an
Thanks Ben.
I feel really dumb. I did enter '...' in my sample function in another version
of this function. But I just realized I had only done it for the second
occurrence of the sample function and not the first.
Dan
-Original Message-
From: Ben Tupper [mailto:btup...@bigelow.org]
Hello everyone,
I used a function called gamm in mgcv in R program to investigate seasonal
variation of wind speed based on 13 years of measurement dataset. I would
like to use this variation in my formula for my study but as I am new in R,
it's extremely hard to find values on y-axis.. too many s
Hi R Experts,
How do you get the ... to work in a user-defined function such as the one I
have below?
For example if I want to pass replace=TRUE to the sample function.
# This is a sample function that generates x rows of z numbers out of y.
Basically a lottery style data set.
mynumbs<-functio
I've spent some time trying to wrap my head around reading in large csv
files with the ff-package. I think I know how to do it, but am bumping
into some problems. I've tried to recreate the issues as best as I can
with a smaller example and maybe someone can help explain the problems.
The follow
On 11/19/2013 05:57 AM, David Arnold wrote:
Hi,
I have this code:
par(mfrow=c(3,1))
x1=rnorm(10,60,1)
x2=rnorm(10,65,1)
x3=rnorm(10,70,1)
boxplot(x1,x2,x3,horizontal=TRUE,main="Example 1")
x1=rnorm(10,60,4)
x2=rnorm(10,65,4)
x3=rnorm(10,70,4)
boxplot(x1,x2,x3,horizontal=TRUE,main="Example 2")
> How can I set the horizontal axis limits on all three images to be the same
> for sake of comparison?
Add ylim=c(dataMin, dataMax) to each call to boxplot(), where
you specify values for dataMin and dataMax so their range is
likely to cover all your data. ('ylim', not 'xlim' - the horizontal=TR
Hi,
I have this code:
par(mfrow=c(3,1))
x1=rnorm(10,60,1)
x2=rnorm(10,65,1)
x3=rnorm(10,70,1)
boxplot(x1,x2,x3,horizontal=TRUE,main="Example 1")
x1=rnorm(10,60,4)
x2=rnorm(10,65,4)
x3=rnorm(10,70,4)
boxplot(x1,x2,x3,horizontal=TRUE,main="Example 2")
x1=rnorm(10,60,9)
x2=rnorm(10,65,9)
x3=rnorm
No, sorry to flog a dead horse, but you do not appear to get it yet and you
really should understand this concept. The minimal reproducible example would
have been R code that we could run that generated an email that you think
should have the matrix in it, but does not. In practically all help
Anyone is working with the upgrade of any multilevel package for apply
sampling weights?
Thanks
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting gu
I know you have a solution, but I would have suggested using print() with
quote=FALSE as a better way to illuminate what is going on, as in this
example:
> foo <- 'bah"bah'
> foo
[1] "bah\"bah"
> print(foo)
[1] "bah\"bah"
> print(foo, quote=FALSE)
[1] bah"bah
As others said, the backslash isn't r
I understand what you are saying. I just didn't think that showing a sendmailR
with a matrix as the body of the message would have been very helpful since it
is the fact that the received email has no content that is the problem and that
would not have shown up in the R console output.
On Nov 1
You provided examples of what you wanted, but not examples where the same code
in a different context failed to provide the result you wanted. "Reproducible"
means "reproduces the problem".
---
Jeff Newmiller
See my answer at Stack Overflow -- repeated here for anyone else who wants a
trivial function.
# coordinate transform: cartesian plane rotation
xyrot<-function(pairs,ang){
# pairs must be Nx2 matrix w/ x in first column and y in second
xrot <- pairs[,1]*cos(ang) - pairs[,2]*sin(ang)
I thought that I had provided an example of what I wanted to do but in any
case, capture.output seems to work, as in
sendmailR(to,from, capture.output(matrix_to_send))
I'm sure that there are myriad other ways (I tried print, which is mentioned in
FAQ 7.16 but it doesn't work in this context)
OK, I'm pre-coffee, but what's wrong with using upper.tri to create a new
matrix and then multiplying that matrix by the original "dat" matrix (direct
multiplication, not matrix multiply) to get the desired answer?
Bert Gunter wrote
> I believe matrix indexing makes Arun's complex code wholly unn
You have not provided the minimal reproducible code that the footer of this
email asks for, so we are playing 20 questions.
Perhaps you should convert the matrix to a data frame? Or is this an example of
FAQ 7.16?
---
Jeff N
I think it'd be easier and safer to save the matrix, either as an .Rdata
binary or as a text file, zip that file, and use the sendmailR tools to
attach the file to your message.
Fuchs Ira-3 wrote
> I have a matrix which has colnames and I would like to send this matrix
> using sendmailR. How can
That's the ticket! So many functions…so little time. Thanks to everyone.
On Nov 18, 2013, at 9:47 AM, David Winsemius wrote:
>
> On Nov 18, 2013, at 8:30 AM, Ira Fuchs wrote:
>
>> Thanks for the suggestion. I just tried dput and it did not produce what
>> sendmailR requires for the body param
Hello all!
I have a problem with Anova in R and I don't know how to solve that. I want
to compute Anova for each experiment (exp). I use this code:
test<-lapply(split(eg,eg$Exp),function(x) aov(masa.uscat.tr ~ Clona,data =
x))
or
test<-by(eg,eg$Exp, function(x) aov(masa.uscat.tr~Clona,data=x))
I
On Nov 18, 2013, at 8:30 AM, Ira Fuchs wrote:
Thanks for the suggestion. I just tried dput and it did not produce
what sendmailR requires for the body parameter. Here is a simplified
version of what I need to do:
x=matrix(c(1,2,3),1,3)
x
[,1] [,2] [,3]
[1,]123
colnames(x
Hi,
I would also add an index to make it work for groups that doesn't have time=4.
df1 <- df[-12,]
fun1 <- function(dat,n) {
indx <- with(dat,tapply(time==n,group,FUN=any))
indx2 <- with(dat,ave(time==n,group,FUN=any))
dat[indx2,"new"] <- rep(dat$var[dat$time==n],rle(dat$group)$lengths[indx])
d
I understand how I may use message() to provide some output on which run I will
be looking at. However, I wish to automate it, and have it written out to a
tab-delimited file. Below is the command to output my coefficients:
write.table(zbetas, file = "z_coeffs.csv", sep="\t", append = TRUE)
I d
Hello,
and thanks for the answer.
1) I found a work-around - in the end it is easier than thought before.
The only thing you have to do is to have the same variable name with the
new values.
So if predict(coxph.penal.fit, newdata[subset,]) does not work inside a
function, the following works:
p
On Nov 18, 2013, at 7:27 AM, Tonio wrote:
Dear list,
Consider these two parallel segments in a plot.
plot(c(1, 6), c(2, 2), type="n", xlim=c(0, 7), ylim=c(-2, 6))
segments(1, 1, 6, 1)
segments(1, 3, 6, 3)
How can I rotate the two lines together by a defined angle?
Base graphics do not
So I've been working through the HW work here
http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html
and have started testing with some "live" customer data. I have a dataset that
looks like:
CustomerID | Sales
123456 $5,000
123456 $3,455
12
Hi everyone,
I am interested in doing a study to compare three analyzing methods namely,
ANOVA, GEE and multilevel approach for *categorical repeated measures data
using a simulation study in R*.
I am not an expert in R but I know some preliminaries in R. Therefore I am
desperately looking for some
Thanks for the suggestion. I just tried dput and it did not produce what
sendmailR requires for the body parameter. Here is a simplified version of what
I need to do:
> x=matrix(c(1,2,3),1,3)
> x
[,1] [,2] [,3]
[1,]123
> colnames(x)=c("a","b","c")
> x
a b c
[1,] 1 2 3
> dp
On 18 November 2013 05:37, Ira Fuchs wrote:
> I have a matrix which has colnames and I would like to send this matrix using
> sendmailR. How can I convert this simple matrix
My 1 cent; In case of large objects or full session, suitable for
attachment; RData might be more convenient, i.e., ?save
Dear Spencer,
In case you have similar questions you may want to ask them on
r-sig-teaching, which deals specifically with such topics.
Regards,
Liviu
On Sun, Nov 17, 2013 at 3:19 AM, Spencer Graves
wrote:
> Hello, All:
>
>
> Would anyone recommend R for an introductory statistics class fo
Hi
probably not most elegant and also not general but
rep(df$var[df$time==4],rle(df$group)$lengths)
or
rep(df$var[df$time==4], sapply(split(df$var,df$group), length))
shall give you desired vector.
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-hel
What about dput()?
On Mon, Nov 18, 2013 at 8:35 AM, Ira Fuchs wrote:
> I have a matrix which has colnames and I would like to send this matrix using
> sendmailR. How can I convert this simple matrix to a format which can be used
> as the body variable in sendmailR? I see how I can create a file
Have you tried dput(your.matrix)?
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel..
Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Zach Feinstein
> Sent: Wednesday, November 13, 2013 2:57 PM
> To: r-help@r-project.org
> Subject: [R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to
> Learn Few Ba
I have a matrix which has colnames and I would like to send this matrix using
sendmailR. How can I convert this simple matrix to a format which can be used
as the body variable in sendmailR? I see how I can create a file attachment
using mime_part but I would like to send the matrix in the body
Dear list,
Consider these two parallel segments in a plot.
plot(c(1, 6), c(2, 2), type="n", xlim=c(0, 7), ylim=c(-2, 6))
segments(1, 1, 6, 1)
segments(1, 3, 6, 3)
How can I rotate the two lines together by a defined angle?
Thank you all in advance.
Best,
Antonio
___
Dear Catalin,
Have a look at the plyr package.
library(plyr)
dlply(
eg,
.(Exp),
function(x) {
aov(masa.uscat.tr~Clona,data=x)
}
)
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Hello R-users,
I have a problem with Anova in R and I don't know how to solve that. I want
to compute Anova for each experiment (exp). I try this code:
test<-lapply(split(eg,eg$Exp),function(x) aov(masa.uscat.tr ~ Clona,data =
x))
or
test<-by(eg,eg$Exp, function(x) aov(masa.uscat.tr~Clona,data=x))
Brilliant - thanks for all the really useful suggestions, problem = solved.
Many thanks,
Ben Gillespie, Research Postgraduate
o---o
School of Geography, University of Leeds, Leeds, LS2 9JT
o---
Awesome, thanks!
-Chris
--
View this message in context:
http://r.789695.n4.nabble.com/Hide-return-values-tp4680611p4680666.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailm
46 matches
Mail list logo