Can anyone please tell whether there is any R function to act as "VEC" and "VECH" operator on Matrix? Yes of course, I can write a user-defined-function for that or else, I can put dim(mat) <- NULL. However I am looking for some R function. Your help will be highly appreciated. Regards, -- View this message in context: http://www.nabble.com/VEC-Operator-in-R-tp20136201p20136201.html Sent from the R help mailing list archive at Nabble.com.
And what is this "operator" supposed to do? Maybe you just want as.vector, but it is hard to say from this. Gabor On Thu, Oct 23, 2008 at 7:47 PM, megh <megh700004 at yahoo.com> wrote:> > Can anyone please tell whether there is any R function to act as "VEC" and > "VECH" operator on Matrix? Yes of course, I can write a > user-defined-function for that or else, I can put dim(mat) <- NULL. However > I am looking for some R function. > > Your help will be highly appreciated. > > Regards, > -- > View this message in context: http://www.nabble.com/VEC-Operator-in-R-tp20136201p20136201.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
I think you can use as.vector On Thu, Oct 23, 2008 at 3:47 PM, megh <megh700004@yahoo.com> wrote:> > Can anyone please tell whether there is any R function to act as "VEC" and > "VECH" operator on Matrix? Yes of course, I can write a > user-defined-function for that or else, I can put dim(mat) <- NULL. However > I am looking for some R function. > > Your help will be highly appreciated. > > Regards, > -- > View this message in context: > http://www.nabble.com/VEC-Operator-in-R-tp20136201p20136201.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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
It might help if you told us what you expected VEC and VECH to do. On Thu, Oct 23, 2008 at 1:47 PM, megh <megh700004 at yahoo.com> wrote:> > Can anyone please tell whether there is any R function to act as "VEC" and > "VECH" operator on Matrix? Yes of course, I can write a > user-defined-function for that or else, I can put dim(mat) <- NULL. However > I am looking for some R function. > > Your help will be highly appreciated. > > Regards, > ---- Sarah Goslee http://www.functionaldiversity.org
For 'VEC' you may not need to do anything -- in a lot of circumstances it will just work. For 'VECH' you can write a function using the 'lower.tri' function. But it seems to me that the assumption behind your question is that a simple function that someone else has written is going to be better than a simple function that you write. Not true (barring bugs). R is egalitarian -- your functions have the same standing as "official" functions. A lot of times it is faster to write a function of your own rather than search out someone else's even if you know such functions exist. Patrick Burns patrick at burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") megh wrote:> Can anyone please tell whether there is any R function to act as "VEC" and > "VECH" operator on Matrix? Yes of course, I can write a > user-defined-function for that or else, I can put dim(mat) <- NULL. However > I am looking for some R function. > > Your help will be highly appreciated. > > Regards, >
RSiteSearch('vec vech', restrict = 'fun') turns up several packages with vec and vech functions. E.g., matrixcalc, fUtilities, ks, ... hth, Kingsford Jones On Thu, Oct 23, 2008 at 11:47 AM, megh <megh700004 at yahoo.com> wrote:> > Can anyone please tell whether there is any R function to act as "VEC" and > "VECH" operator on Matrix? Yes of course, I can write a > user-defined-function for that or else, I can put dim(mat) <- NULL. However > I am looking for some R function. > > Your help will be highly appreciated. > > Regards, > -- > View this message in context: http://www.nabble.com/VEC-Operator-in-R-tp20136201p20136201.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
Sender: r-help-bounces at r-project.org On-Behalf-Of: wwwhsd at gmail.com Subject: Re: [R] VEC Operator in R Message-Id: <da79af330810231104n77d3569fie323f044e9877361 at mail.gmail.com> Recipient: nalbicelli at tricadiacdpcmanagement.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Henrique Dallazuanna <wwwhsd at gmail.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 16:04:38 -0200 Size: 6042 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/4e77964e/attachment-0004.mht>
Sender: r-help-bounces at r-project.org On-Behalf-Of: wwwhsd at gmail.com Subject: Re: [R] VEC Operator in R Message-Id: <da79af330810231104n77d3569fie323f044e9877361 at mail.gmail.com> Recipient: ngottlieb at marinercapital.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Henrique Dallazuanna <wwwhsd at gmail.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 16:04:38 -0200 Size: 5994 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/ea92a30a/attachment-0002.mht>
Try: RsiteSearch("vech") On Thu, Oct 23, 2008 at 1:47 PM, megh <megh700004 at yahoo.com> wrote:> > Can anyone please tell whether there is any R function to act as "VEC" and > "VECH" operator on Matrix? Yes of course, I can write a > user-defined-function for that or else, I can put dim(mat) <- NULL. However > I am looking for some R function. > > Your help will be highly appreciated. > > Regards, > -- > View this message in context: http://www.nabble.com/VEC-Operator-in-R-tp20136201p20136201.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
Sender: r-help-bounces at r-project.org On-Behalf-Of: ggrothendieck at gmail.com Subject: Re: [R] VEC Operator in R Message-Id: <971536df0810231134l7e1a7871g8791a001f6d7c4b at mail.gmail.com> Recipient: nalbicelli at tricadiacdpcmanagement.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Gabor Grothendieck <ggrothendieck at gmail.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 14:34:39 -0400 Size: 5534 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/0350595c/attachment-0004.mht>
Sender: r-help-bounces at r-project.org On-Behalf-Of: ggrothendieck at gmail.com Subject: Re: [R] VEC Operator in R Message-Id: <971536df0810231134l7e1a7871g8791a001f6d7c4b at mail.gmail.com> Recipient: ngottlieb at marinercapital.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Gabor Grothendieck <ggrothendieck at gmail.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 14:34:39 -0400 Size: 5581 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/27b91f20/attachment-0004.mht>
Sender: r-help-bounces at r-project.org On-Behalf-Of: pburns at pburns.seanet.com Subject: Re: [R] VEC Operator in R Message-Id: <4900C171.1090103 at pburns.seanet.com> Recipient: nalbicelli at tricadiacdpcmanagement.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Patrick Burns <pburns at pburns.seanet.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 19:24:49 +0100 Size: 5489 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/9c63c71a/attachment-0003.mht>
Sender: r-help-bounces at r-project.org On-Behalf-Of: pburns at pburns.seanet.com Subject: Re: [R] VEC Operator in R Message-Id: <4900C171.1090103 at pburns.seanet.com> Recipient: ngottlieb at marinercapital.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Patrick Burns <pburns at pburns.seanet.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 19:24:49 +0100 Size: 5444 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/1ad43ffa/attachment-0003.mht>
Sender: r-help-bounces at r-project.org On-Behalf-Of: kingsfordjones at gmail.com Subject: Re: [R] VEC Operator in R Message-Id: <2ad0cc110810231126g2ccc9729xf28b444241542002 at mail.gmail.com> Recipient: nalbicelli at tricadiacdpcmanagement.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Kingsford Jones <kingsfordjones at gmail.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 12:26:30 -0600 Size: 5664 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/61f28907/attachment-0003.mht>
Sender: r-help-bounces at r-project.org On-Behalf-Of: kingsfordjones at gmail.com Subject: Re: [R] VEC Operator in R Message-Id: <2ad0cc110810231126g2ccc9729xf28b444241542002 at mail.gmail.com> Recipient: ngottlieb at marinercapital.com -------------------------------------------------------- This information is being sent at the recipient's request or with their specific understanding. The recipient acknowledges that by sending this information via electronic means, there is no absolute assurance that the information will be free from third party access, use, or further dissemination. This e-mail contains information that is privileged and/or confidential and may be subject to legal restrictions and penalties regarding its unauthorized disclosure or other use. You are prohibited from copying, distributing or otherwise using this information if you are not the intended recipient. Past performance is not necessarily indicative of future results. This is not an offer of or the solicitation for any security which will be made only by private placement memorandum that may be obtained from the applicable hedge fund. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system. Thank You. -------------- next part -------------- An embedded message was scrubbed... From: Kingsford Jones <kingsfordjones at gmail.com> Subject: Re: [R] VEC Operator in R Date: Thu, 23 Oct 2008 12:26:30 -0600 Size: 5715 URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081023/58c08104/attachment-0003.mht>
Fernando Marmolejo Ramos
2008-Oct-23 23:55 UTC
[R] A line for SD, colouring simplevioplots, limiting Y axis in barplots, axis in vioplot
Dear R people I have 4 questions about graphics. -------- QUESTION 1 & 2 ------- I have the following data, which is also set as a dataframe. Then I plot it using a violin plot 1. How can a draw a line representing 2 SD for each group? 2. How can I colour the simple violin plots in different colours (e.g., Group A white, Group B grey)? set.seed(1) a = rnorm(25, 100, 50) b = rnorm(25, 300, 50) # --- dataframing the vectors... adf <- data.frame(Group = " Group A ", Measure = a) bdf <- data.frame(Group = " Group B ", Measure = b) ## Combine into a dataframe using rbind abtruncdata <- rbind(adf, bdf) attach(abtruncdata) require(UsingR) with(abtruncdata, simple.violinplot(Measure~Group)) with(abtruncdata, plotmeans(Measure ~ Group, pch=16, mean.labels=TRUE, colc("blue", "red"), digits=2, add=T, p=0.95, barcol=c("blue", "red"), use.t=T, n.label=F, connect=F, ci.label=F)) -------- QUESTION 3 ------- I have the following bar plot for the same data 3. how can I set the ?ylim?, lets say from 50 to 350 in steps of 25? tmp = split(Measure, Group) means = sapply(tmp, mean) stdev = sapply(tmp, sd) require(gplots) plotCI(barcol="blue", pch=16, col="blue", barplot(means, col=c("white", "gray90"), ylim=c(0,max(means + stdev)), xlab = "Error bars: ?1SD", ylab="Measure"), means, stdev, add=TRUE) -------- QUESTION 4 ------- The same data frame now as violin plot 4. How can I keep a violinplot frame a la simple.violinplot? ## set up frame, without axes plot(1,1,xlim=c(0.5,2.5),ylim=range(c(a,b)),type="n", xlab=" ",ylab="Median measure",axes=FALSE) ## bottom axis, with user-specified labels axis(side=1,at=1:2,labels=c("Group A","Group B")) axis(side=2) # but as soon as I call the first violinplot, the upper and right axes appear again! In advance, thank you for your answers! Cheers, Fer