Re: [R] ggplot inside of the function

2019-11-25 Thread Eric Berger
Hi Mayooran, If you define the following function f <- function(m,v) { sprintf("Norm(mu=%.1f, var=%.1f)",m,v) } Then you can modify the setting of Prob as follows Prob <- plyr::rename(Prob_df, c("p_1"=f(mu1,var1),"p_2"=f(mu2,var2),"p_3"=f(mu3,var3))) The lesson here is that wherever you set a

[R] [r] How to obtain the correlation coefficients between two variables in the R object

2019-11-25 Thread Subhamitra Patra
Dear R-users, I am estimating the DCC-model by using the following code and successfully making the individual plots indicating the dynamic correlation between the two variables stored in the R data frame (namely dcc.fit in my code). My code is Dat = Date2[,2:13, drop = FALSE] library(rmgarch) li

Re: [R] [r] How to obtain the correlation coefficients between two variables in the R object

2019-11-25 Thread Michael Dewey
To get multiple plots on the same physical page try ?layout ot look through the various option under ?par I do not know enough about DCC models to answer how you get correlations. Michael On 25/11/2019 10:34, Subhamitra Patra wrote: Dear R-users, I am estimating the DCC-model by using the fol

Re: [R] [r] How to obtain the correlation coefficients between two variables in the R object

2019-11-25 Thread Subhamitra Patra
Thank you for your suggestion. Actually, the correlation is coming in the DCC model through my above code which I am able to plot it. Is there any solution that I can extract data from a particular plot. Actually, I am able to obtain the correlation matrix, but I need the correlation coefficient se

[R] Why don't the comments appear in the function?

2019-11-25 Thread bickis
I have made a list in which each element is a function. If I print individual elements of the list, then the function code is shown along with embedded comments. However, if I print the list or sublist, then the function code is shown without comments. Why (and how) are the comments hidden? >

[R] NRC lexicon usage sentiment analysis

2019-11-25 Thread Mehdi Dadkhah
Dear Colleagues, I hope you are doing well! I did sentiment analysis on two datasets. As these datasets do not have same size, to compare emotions in two datasets, i calculated percentages. In my work, i calculated total occurrence for each emotion for two datasets separately. To calculate percent

Re: [R] [r] How to obtain the correlation coefficients between two variables in the R object

2019-11-25 Thread PIKAL Petr
Hi Without knowing much about functions you use, instead of plotting you could save results of rcor(dcc.fit, type="R") to something <- rcor(dcc.fit, type="R") and use str(something) to inspect the structure. Cheers Petr > -Original Message- > From: R-help On Behalf Of Subhamitra > Pa

Re: [R] Why don't the comments appear in the function?

2019-11-25 Thread Bert Gunter
I do not see this behavior. f <- function(x){ ## a comment 2 } g <- list(a =2, fun =f) > g $a [1] 2 $fun function(x){ ## a comment 2 } > g[[2]] function(x){ ## a comment 2 } > g[2] $fun function(x){ ## a comment 2 } Cheers, Bert Bert Gunter "The trouble with having a

Re: [R] Why don't the comments appear in the function?

2019-11-25 Thread Bert Gunter
Dunno. > R.Version() $platform [1] "x86_64-apple-darwin15.6.0" $arch [1] "x86_64" $os [1] "darwin15.6.0" $system [1] "x86_64, darwin15.6.0" $status [1] "" $major [1] "3" $minor [1] "6.1" $year [1] "2019" $month [1] "07" $day [1] "05" $`svn rev` [1] "76782" $language [1] "R" $version.st

Re: [R] giving priority to stats package

2019-11-25 Thread Greg Snow
You could use the `pos` arg to place the newly loaded package(s) on the search path after the stats package. That would give priority for any functions in the stats package over the newly loaded package (but also give priority for any other packages earlier on the search path). On Sat, Nov 23, 20

Re: [R] Why don't the comments appear in the function?

2019-11-25 Thread Duncan Murdoch
On 24/11/2019 6:06 p.m., bic...@math.usask.ca wrote: I have made a list in which each element is a function. If I print individual elements of the list, then the function code is shown along with embedded comments. However, if I print the list or sublist, then the function code is shown withou

Re: [R] Why don't the comments appear in the function?

2019-11-25 Thread Neal Fultz
Hi Mik, Echoing Bert and Duncan's suggestions, please see also ?srcref and ?getSrcref and consider upgrading to a currently supported version of R. I'd also call out the "keep.source" installation option as important if your functions are inside a package - there is some discussion around this at

Re: [R] Why don't the comments appear in the function?

2019-11-25 Thread bickis
Different version of R perhaps? Or is there something in my environment or "preferences" that is different? Here's what I get with your example. > f <- function(x){ + ## a comment + 2 + } > g <- list(a =2, fun =f) > g $a [1] 2 $fun function (x) { 2 } > g[[2]] function(x){ ##

Re: [R] Why don't the comments appear in the function?

2019-11-25 Thread Duncan Murdoch
On 25/11/2019 2:27 p.m., Neal Fultz wrote: Hi Mik, Echoing Bert and Duncan's suggestions, please see also ?srcref and ?getSrcref and consider upgrading to a currently supported version of R. I'd also call out the "keep.source" installation option as important if your functions are inside a pack

Re: [R] ggplot inside of the function

2019-11-25 Thread Thevaraja, Mayooran
Great it works. Thank you so much Eric. Cheers, Mayooran -Original Message- From: Eric Berger Sent: Monday, 25 November 2019 11:22 PM To: Thevaraja, Mayooran Cc: r-help Subject: Re: [R] ggplot inside of the function Hi Mayooran, If you define the following function f <- function(m,

Re: [R] giving priority to stats package

2019-11-25 Thread Gabor Grothendieck
Goold idea. This seems to work. library(dplyr, pos = grep("package:stats", search()) + 1) On Mon, Nov 25, 2019 at 1:27 PM Greg Snow <538...@gmail.com> wrote: > > You could use the `pos` arg to place the newly loaded package(s) on > the search path after the stats package. That would give prio