[R] how to generate this kind of graph

2020-07-22 Thread array chip via R-help


Hello everyone,

I saw this scatterplots from a paper and thought it looked very nice:

https://drive.google.com/file/d/1V7F1gq-J_GIFDOrJs00hwGyXUqCZ_xwa/view?usp=sharing

It was similar to stripchart() with 'jitter' method, but it has a special 
pattern of aligning points which made it look nicer than standard stripchart().

Does anyone know if there is a package in R that can do this kind of plots?

Thanks,

John

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] How to generate this type of scatter plots in R

2020-07-22 Thread Jim Lemon
Hi John,
Perhaps "dendroPlot" in the plotrix package?

JIm

On Thu, Jul 23, 2020 at 11:00 AM array chip via R-help
 wrote:
>
>
> Hello everyone,
>
> I saw this scatterplots from a paper and thought it looked very nice:
>
> https://drive.google.com/file/d/1V7F1gq-J_GIFDOrJs00hwGyXUqCZ_xwa/view?usp=sharing
>
> It was similar to stripchart() with 'jitter' method, but it has a special 
> pattern of aligning points which made it look nicer than standard 
> stripchart().
>
> Does anyone know if there is a package in R that can do this kind of plots?
>
> Thanks,
>
> John
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] how to view and edit this RData file

2020-07-22 Thread Richard O'Keefe
> load("WVS.RData", verbose=TRUE)
Loading objects:
  final.ord
> str(final.ord)
 num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...

When using load() with unfamiliar data,
verbose=TRUE is your friend.
Note that this is a numeric matrix, not a data frame.

I do hope you have been told what the column names
mean because the existing names suggest only that this
may be a selection from a larger collection.

On Wed, 22 Jul 2020 at 19:40, Jason Levy  wrote:

> Dear R Scholars
>
> Many R users have successfully loaded and used the attached WVS RDATA file
> into my R program. I would just would like help viewing, editing etc.
>
> I wanted to include the actual RData file (which was not attached
> previously)
>
> I can successfully load the RData file:
> load('WVS.RData')
>
>
> https://drive.google.com/drive/u/1/folders/15QhSBkwEfHLqgZznoaqodWglXuxV4f7P
>
>
> I would like help on how to view, edit and save this 2.461 MB RData file.
> I am at my wits end. I apologize for asking such a basic question. I
> appreciate your help in advance
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Reading help functions

2020-07-22 Thread Rasmus Liland
On 2020-07-22 19:42 -0400, Duncan Murdoch wrote:
> On 22/07/2020 1:20 p.m., Pedro páramo wrote:
> > Hi all,
> > 
> > I am trying all time to use ?? help 
> > function but most of the time it 
> > cost me a lot to understand what 
> > they are saying, explaining, there 
> > is some manual to step by step how 
> > to interpret help guides in R.
> > 
> > I hope you can understand me because 
> > of my english its not the best 
> > also.
> 
> The manuals that come with R give more 
> of an overview than the individual 
> help pages.  "An Introduction to R" is 
> the basic introduction.  You should 
> read that first, then go to the help 
> pages when you need detailed technical 
> information about a particular 
> function.
> 
> To see the manuals, run help.start() 
> and click on one of the links near the 
> top of the page.
> 
> If your problems are with help pages 
> from contributed packages, then you 
> should look for vignettes in the 
> package.  Not all packages have them, 
> but it's a sign of a lack of interest 
> in documentation if they don't: and 
> I'd recommend avoiding such packages.
> 
> To see the vignettes for 
> "somepackage", run 
> 
>  browseVignettes(package = "somepackage")

Dear Pedro,

I also use ?? alot.  Recently I found it 
really useful to list the functions of a 
recently installed package somepackage, 
using these to lines:

library(somepackage)
ls.str('package:somepackage')

I just put them in a script to run it 
quickly in the shell like this:

#!/usr/bin/env Rscript
pkg <- commandArgs(trailingOnly=TRUE)[1]

text <-
  paste0("library(",
 pkg,
 "); ls.str('package:",
 pkg,
 "')")
eval(parse(text=text))

Best,
Rasmus


signature.asc
Description: PGP signature
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] how to view and edit this RData file

2020-07-22 Thread Rasmus Liland
On 2020-07-22 16:38 -0700, David Winsemius wrote:
> On 7/22/20 12:35 AM, Jason Levy wrote:
> > Dear R Scholars
> > 
> > Many R users have successfully loaded and used the attached WVS RDATA file
> > into my R program. I would just would like help viewing, editing etc.
> > 
> > I wanted to include the actual RData file (which was not attached
> > previously)
> > 
> > I can successfully load the RData file:
> > load('WVS.RData')
> > 
> > https://drive.google.com/drive/u/1/folders/15QhSBkwEfHLqgZznoaqodWglXuxV4f7P
> 
> In a clean session I executed this:
> 
> load("/home/david/Downloads/WVS RData file/WVS.RData")
> ls()
> #[1] "final.ord"
> 
>  str(final.ord)
> # num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
> #- attr(*, "dimnames")=List of 2
> #..$ : NULL
> 
> # ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...
> 
> So it appears to be a matrix with 74 
> columns and 82,992 rows.
> 
> > I would like help on how to view, edit and save this 2.461 MB RData file.
> > I am at my wits end. I apologize for asking such a basic question. I
> > appreciate your help in advance
> > 
> > [[alternative HTML version deleted]]
> 
> You have repeatedly posted in HTML. 
> Gmail makes it easy to post in palin 
> text if you are using their client. 
> Please read the Posting Guide and I 
> would suggest also reading and working 
> through the examples in a good 
> introductory tutorial on Rhelp. The 
> "Introduction to R" that ships with 
> all copies of R should have 
> illustrated using both ls() and 
> str().

On 2020-07-22 20:47 +1000, Jim Lemon wrote:
> Hi Jason,
> I assume that you actually have 
> "WVS.RData" in your working directory 
> when you try to load it. Otherwise you 
> will get an error message. If you 
> don't get an error message when you do 
> this:

Dear Jason,

Just re-iterating Jim and David's 
answers:

> objects()
character(0)
> load("WVS.RData")
> objects()
[1] "final.ord"
> str(final.ord)
 num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...
> typeof(final.ord)
[1] "double"
> dim(final.ord)
[1] 8299274
> options(width=40)
> table(final.ord)
final.ord
  1   2   3   4   5
2159651 1649054  727911  385054  232812
  6   7   8   9  10
 118567   99269   92795   60633  111955
 11
  36141
> final.ord.1 <- edit(final.ord)
> table(final.ord.1)
final.ord.1
  1   2   3   4   5
2159649 1649053  727911  385054  232812
  6   7   8   9  10
 118567   99269   92795   60633  111955
 11  42   1e+05
  36141   2   1
> save(final.ord.1, file="WVS.1.RData")

Best,
Rasmus


signature.asc
Description: PGP signature
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] How to generate this type of scatter plots in R

2020-07-22 Thread array chip via R-help


Hello everyone,

I saw this scatterplots from a paper and thought it looked very nice:

https://drive.google.com/file/d/1V7F1gq-J_GIFDOrJs00hwGyXUqCZ_xwa/view?usp=sharing

It was similar to stripchart() with 'jitter' method, but it has a special 
pattern of aligning points which made it look nicer than standard stripchart().

Does anyone know if there is a package in R that can do this kind of plots?

Thanks,

John

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Looping thorugh dataframe

2020-07-22 Thread William Dunlap via R-help
> library(dplyr, warn.conflicts=FALSE)
> d <- data.frame(Company=c("MATH","IFUL","SSI","MATH","MATH","SSI"), 
> Turnover=c(2,3,5,7,9,11))
> d %>% group_by(Company) %>% summarize(Count=n(), MeanTurnover=mean(Turnover), 
> TotalTurnover=sum(Turnover))
`summarise()` ungrouping output (override with `.groups` argument)
# A tibble: 3 x 4
  Company Count MeanTurnover TotalTurnover
  
1 IFUL13 3
2 MATH3618
3 SSI 2816

[The 'override with .groups' comment arose in a recent version of
dplyr.  It is a bit annoying.]

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Jul 22, 2020 at 4:36 PM e-mail ma015k3113 via R-help
 wrote:
>
> Bert, thanks for responding to my email. I do realise that newbie's like my 
> can expect curt answers but not to worry. I am definitely learning 'R' and 
> what I posted are also statements from R. The statements run perfectly well 
> but don't do what I want them to do. My mistake I have posted sample data. 
> Here is the data:
>
> COMPANY_NUMBER  COMPANY_NAMEYEAR_END_DATE   Turnover
> 22705   AA  30/09/10420,000
> 22705   AA  30/09/09406,000
> 113560  BB  30/06/19474,000
> 192761  CC  31/01/19796,000
> 192761  CC  31/01/18909,000
> 192761  CC  31/01/17788,000
> 5625107 DD  30/06/193,254,002
> 5625107 DD  30/06/181,840,436
>
> All_companies$count <-0
> while All_companies$COMPANY_NAME == All_companies$COMPANY_NAME + 1
> + {All_companies$count=All_companies$count+1}
>
> I want to find out many times each company has appeared in the dataframe and 
> the average of the turnover for the years. Like company AA appears twice and 
> average turnover is 413,000.
>
> 'All_companies' is the name of the dataframe.
>
> In the end apologies for not being more clear the first time around and of 
> course many thanks for your help in advance.
>
> Kind regards
>
>
> Ahson
>
> On 21 July 2020 at 18:41 Bert Gunter  wrote:
>
> What language are you programming in? -- it certainly isn't R.
>
> I suggest that you stop what you're doing and go through an R tutorial or two 
> before proceeding. This list cannot serve as a substitute for doing such 
> homework (is this homework, btw? -- that's off topic here) nor can we provide 
> such tutorials.
>
> I'm pretty sure the answer is quite simple, though it's a bit unclear as you 
> did not provide a reprex (see the posting guide linked below for how to post 
> here). However, I see no purpose in my blurting it out when you do not seem 
> aware of even the most basic R constructs -- e.g. see ?while. Of course, 
> others may disagree and provide you what you seek.
>
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and 
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Error in Rose Method (class balancing)

2020-07-22 Thread Rasmus Liland
On 2020-07-22 16:08 -0700, David Winsemius wrote:
| On 7/22/20 3:43 PM, Neha gupta wrote:
| | Hello,
| | 
| | I get the following error when I use 
| | the ROSE class balancing method but 
| | when I use other methods like SMOTE, 
| | up, down, I do not get any error 
| | message.
| | 
| | Something is wrong; all the ROC 
| | metric values are missing:
| | 
| | ROC Sens Spec
| | Min. : NA Min. : NA Min. : NA
| | 1st Qu.: NA 1st Qu.: NA 1st Qu.: NA
| | Median : NA Median : NA Median : NA
| | Mean :NaN Mean :NaN Mean :NaN
| | 3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA
| | Max. : NA Max. : NA Max. : NA
| | 
| | library(DMwR)
| | d=readARFF("bughunter.arff")
| 
| After installing that package and 
| loading pkg:DMwR I get:
| 
|   Error in readARFF("bughunter.arff") : could not find function "readARFF"

*Psst* ... I think this is 
farff::readARFF ... Where is 
"bughunter.arff" from?

| | [[alternative HTML version deleted]]
| 
| Since you also posted in HTML, I 
| suggest you read the Posting Guide, 
| restart and R session and post a 
| reproducible example that loads all 
| needed packages and data.

Hear, hear

| | index <- createDataPartition(d$`Bug class`, p = .70,list = FALSE)

Maybe this is 
caret::createDataPartition?

| | tr <- d[index, ]
| | 
| | ts <- d[-index, ]
| | 
| | boot3 <- trainControl(method = "repeatedcv", number=10,
| | repeats=10,classProbs = TRUE,verboseIter = FALSE,

Also caret ... ?caret::trainControl

| | summaryFunction = twoClassSummary, sampling = "rose")

Missing “(” also perhaps other params 
have fallen off here ?  The C looks like 
a paranthesis because of camel-case 
maybe ... hmmm ...

| | set.seed(30218)
| | 
| | ct <- train(`Bug class` ~ ., data = tr,
| | method = "pls",
| | metric = "AUC",
| | preProc = c("center", "scale", "nzv"),
| | trControl = boot3)
| | 
| | getTrainPerf(ct)
| 

V

r


signature.asc
Description: PGP signature
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Looping thorugh dataframe

2020-07-22 Thread Sarah Goslee
Hi,

Your sample code suggests that you don't yet understand how R works,
and might benefit from a tutorial or two. However, your verbal
description of what you want is quite straightforward. Here's a
R-style way to count the number of times each company appears, and to
get the mean value of Turnover for each company:


All_companies <- read.table(text =
"COMPANY_NUMBER  COMPANY_NAMEYEAR_END_DATE   Turnover
22705   AA  30/09/1042
22705   AA  30/09/09406000
113560  BB  30/06/19474000
192761  CC  31/01/19796000
192761  CC  31/01/18909000
192761  CC  31/01/17788000
5625107 DD  30/06/193254002
5625107 DD  30/06/181840436", header=TRUE)

table(All_companies$COMPANY_NAME)

AA BB CC DD
 2  1  3  2

aggregate(Turnover ~ COMPANY_NAME, data = All_companies, FUN = mean)

  COMPANY_NAME Turnover
1   AA   413000
2   BB   474000
3   CC   831000
4   DD  2547219


On Wed, Jul 22, 2020 at 7:36 PM e-mail ma015k3113 via R-help
 wrote:
>
> Bert, thanks for responding to my email. I do realise that newbie's like my 
> can expect curt answers but not to worry. I am definitely learning 'R' and 
> what I posted are also statements from R. The statements run perfectly well 
> but don't do what I want them to do. My mistake I have posted sample data. 
> Here is the data:
>
> COMPANY_NUMBER  COMPANY_NAMEYEAR_END_DATE   Turnover
> 22705   AA  30/09/10420,000
> 22705   AA  30/09/09406,000
> 113560  BB  30/06/19474,000
> 192761  CC  31/01/19796,000
> 192761  CC  31/01/18909,000
> 192761  CC  31/01/17788,000
> 5625107 DD  30/06/193,254,002
> 5625107 DD  30/06/181,840,436
>
> All_companies$count <-0
> while All_companies$COMPANY_NAME == All_companies$COMPANY_NAME + 1
> + {All_companies$count=All_companies$count+1}
>
> I want to find out many times each company has appeared in the dataframe and 
> the average of the turnover for the years. Like company AA appears twice and 
> average turnover is 413,000.
>
> 'All_companies' is the name of the dataframe.
>
> In the end apologies for not being more clear the first time around and of 
> course many thanks for your help in advance.
>
> Kind regards
>
>
> Ahson
>
> On 21 July 2020 at 18:41 Bert Gunter  wrote:
>
> What language are you programming in? -- it certainly isn't R.
>
> I suggest that you stop what you're doing and go through an R tutorial or two 
> before proceeding. This list cannot serve as a substitute for doing such 
> homework (is this homework, btw? -- that's off topic here) nor can we provide 
> such tutorials.
>
> I'm pretty sure the answer is quite simple, though it's a bit unclear as you 
> did not provide a reprex (see the posting guide linked below for how to post 
> here). However, I see no purpose in my blurting it out when you do not seem 
> aware of even the most basic R constructs -- e.g. see ?while. Of course, 
> others may disagree and provide you what you seek.
>


-- 
Sarah Goslee (she/her)
http://www.numberwright.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Reading help functions

2020-07-22 Thread Duncan Murdoch

On 22/07/2020 1:20 p.m., Pedro páramo wrote:

Hi all,

I am trying all time to use ?? help function but most of the time it cost
me a lot to understand what they are saying, explaining, there is some
manual to step by step how to interpret help guides in R.

I hope you can understand me because of my english its not the best also.



The manuals that come with R give more of an overview than the 
individual help pages.  "An Introduction to R" is the basic 
introduction.  You should read that first, then go to the help pages 
when you need detailed technical information about a particular function.


To see the manuals, run help.start() and click on one of the links near 
the top of the page.


If your problems are with help pages from contributed packages, then you 
should look for vignettes in the package.  Not all packages have them, 
but it's a sign of a lack of interest in documentation if they don't: 
and I'd recommend avoiding such packages.


To see the vignettes for "somepackage", run

 browseVignettes(package = "somepackage")

Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] how to view and edit this RData file

2020-07-22 Thread David Winsemius



On 7/22/20 12:35 AM, Jason Levy wrote:

Dear R Scholars

Many R users have successfully loaded and used the attached WVS RDATA file
into my R program. I would just would like help viewing, editing etc.

I wanted to include the actual RData file (which was not attached
previously)

I can successfully load the RData file:
load('WVS.RData')

https://drive.google.com/drive/u/1/folders/15QhSBkwEfHLqgZznoaqodWglXuxV4f7P


In a clean session I executed this:


load("/home/david/Downloads/WVS RData file/WVS.RData")

ls()

#[1] "final.ord"


 str(final.ord)
# num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
#- attr(*, "dimnames")=List of 2
#..$ : NULL

# ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...


So it appears to be a matrix with 74 columns and 82,992 rows.



I would like help on how to view, edit and save this 2.461 MB RData file.
I am at my wits end. I apologize for asking such a basic question. I
appreciate your help in advance

[[alternative HTML version deleted]]



You have repeatedly posted in HTML. Gmail makes it easy to post in palin 
text if you are using their client. Please read the Posting Guide and I 
would suggest also reading and working through the examples in a good 
introductory tutorial on Rhelp. The "Introduction to R" that ships with 
all copies of R should have illustrated using both ls() and str().


--

David

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] viewing, editing and saving an RDATA file

2020-07-22 Thread Bert Gunter
Inline

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Jul 22, 2020 at 2:29 PM Robert Baer  wrote:

> You may misunderstand how RData files work.  Note that RData files are
> not necessarily JUST a single variable unless they were explicitly
> written to store a single variable only.
>
> If you save a single variable (a dataframe, for example) named 'mydata'
> with save(mydata, file = "saveddata.RData") and then load the variable
> back into a new R session with y  <- load("saveddata.RData"), your data
> will still be contained in a variable named 'mydata',  not renamed  y.
>

Yes indeedy. In fact, y will be:
Value

A character vector of the names of objects created, invisibly.

>
> Look at ?load and ?save
>

Which should have been the OP's first port of call

>
> On 7/22/2020 5:47 AM, Jim Lemon wrote:
> > Hi Jason,
> > I assume that you actually have "WVS.RData" in your working directory
> > when you try to load it. Otherwise you will get an error message. If
> > you don't get an error message when you do this:
> >
> > load("WVS.RData")
> >
> > there will be a new object in your workspace. So if you want to see
> > what the object is, try this:
> >
> > objects()
> > load("WVS.RData")
> > objects()
> >
> > Unless you have already run the "load" command, there will be a new
> > object in the list. That is what you're looking for. Say that object
> > is named "x". You can look at the first part of it with:
> >
> > head(x)
> >
> > and maybe do some basic editing with:
> >
> > edit(x)
> >
> > Good luck.
> >
> > Jim
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Compositional Data Analysis

2020-07-22 Thread Tim Locke
Hi All,

I am currently working on a project examining the health effects of physical
activity using a compositional data (CoDa) approach. I am using a
linear regression to measure the effect of physical activity. What I want to
do is predict an outcome, e.g. body mass index, based on the mean physical
activity composition. I then want to alter this composition by reallocating
time from one behavior (such as sedentary) to light intensity physical
activity, and see what effect this has on BMI. I have included the code
below. My problem is that I cannot seem to generate this new composition
correctly.



library(compositions)
attach(Data_Analysis)

#Replace zeros in raw data with 0.1
bedtimemins[bedtimemins==0] <- 0.1
sedwakingmins[sedwakingmins==0] <- 0.1
standingtimemins[standingtimemins==0] <- 0.1
LIPAmins[LIPAmins==0] <- 0.1
MVPAmins[MVPAmins==0] <- 0.1

# make the composition by   binding the components together
comp <- cbind(bedtimemins, sedwakingmins, standingtimemins, LIPAmins,
MVPAmins)
# tell R that comp is a compositional   variable
comp <- acomp(comp)

#Generate variation matrix
PAvar_matrix <- var.acomp(comp)

# make the ilr multiple linear regression model. BMI = body mass index. .
lm <- lm(bmi~ ilr(comp) + age)

#determine the mean composition, geometric mean of behaviors which sum to 1
comp.mean <- mean(comp)

# predict BMI for the mean composition from above, keeping age constant at
its mean.
mean.pred   <- predict(lm,  newdata=list(comp=comp.mean, age = mean(age)))

#generate new compostion of PA with 30 minutes of sleep reallocated to 30
mins of LIPA
new.comp<- acomp(comp.mean +c(-30/1440, 0/1440, 0/1440, 30/1440, 
0/1440))

#predict BMI based on new composition
pred<- predict(lm,  newdata=list(comp=new.comp, age=mean(age)))

#Estimated difference in BMI for the above reallocation
pred- mean.pred


When I run the command to generate the new composition, I receive the
message below

new.comp<- acomp(comp.mean +c(-30/1440, 0/1440, 0/1440, 30/1440, 
0/1440))
Warning messages:
1: In acomp(gsi.mul(x, y)) :
  Negative values in composition are used as detection limits
2: In acomp(comp.mean + c(-30/1440, 0/1440, 0/1440, 30/1440, 0/1440)) :
  Negative values in composition are used as detection limits

When I print comp.mean I get a result that seems to make sense:
comp.mean
 bedtimeminssedwakingmins standingtimemins LIPAmins   
MVPAmins

  0.36410089   0.32460230   0.222783240.06948202
 0.01903155


I can't say the same for the new composition:
new.comp
 bedtimeminssedwakingmins standingtimemins LIPAmins   
MVPAmins
   <5.240217  BDL  BDL 
1.00BDL

Any help or advice would be greatly appreciated!



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Looping thorugh dataframe

2020-07-22 Thread e-mail ma015k3113 via R-help
Bert, thanks for responding to my email. I do realise that newbie's like my can 
expect curt answers but not to worry. I am definitely learning 'R' and what I 
posted are also statements from R. The statements run perfectly well but don't 
do what I want them to do. My mistake I have posted sample data. Here is the 
data:

COMPANY_NUMBER  COMPANY_NAMEYEAR_END_DATE   Turnover
22705   AA  30/09/10420,000
22705   AA  30/09/09406,000
113560  BB  30/06/19474,000
192761  CC  31/01/19796,000
192761  CC  31/01/18909,000
192761  CC  31/01/17788,000
5625107 DD  30/06/193,254,002
5625107 DD  30/06/181,840,436

All_companies$count <-0
while All_companies$COMPANY_NAME == All_companies$COMPANY_NAME + 1
+ {All_companies$count=All_companies$count+1}

I want to find out many times each company has appeared in the dataframe and 
the average of the turnover for the years. Like company AA appears twice and 
average turnover is 413,000.

'All_companies' is the name of the dataframe.

In the end apologies for not being more clear the first time around and of 
course many thanks for your help in advance.

Kind regards


Ahson

On 21 July 2020 at 18:41 Bert Gunter  wrote:

What language are you programming in? -- it certainly isn't R.

I suggest that you stop what you're doing and go through an R tutorial or two 
before proceeding. This list cannot serve as a substitute for doing such 
homework (is this homework, btw? -- that's off topic here) nor can we provide 
such tutorials.

I'm pretty sure the answer is quite simple, though it's a bit unclear as you 
did not provide a reprex (see the posting guide linked below for how to post 
here). However, I see no purpose in my blurting it out when you do not seem 
aware of even the most basic R constructs -- e.g. see ?while. Of course, others 
may disagree and provide you what you seek.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and 
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Reading help functions

2020-07-22 Thread Pedro páramo
Hi all,

I am trying all time to use ?? help function but most of the time it cost
me a lot to understand what they are saying, explaining, there is some
manual to step by step how to interpret help guides in R.

I hope you can understand me because of my english its not the best also.

Many thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Logo or text in a plot

2020-07-22 Thread Pedro páramo
Hi all,

I want to add an image on my plot or a text if not possible

getSymbols("APPL", from="2020-01-01")
getSymbols("",from="2020-01-01")
library(grid)

ret <- na.omit(CalculateReturns(cbind(Cl(AAPL), Cl(  # same as
Cl(AAPL)/lag(Cl(AAPL)) - 1)*100
chart.CumReturns(ret,wealth.index = FALSE, main = "Buy & Hold
performance",legend.loc = "topright")


I have seen some options on plot but here I am using chart.CumReturns and I
am not able to insert one image or "free text"

Can anyone guide me

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Dataframe with different lengths

2020-07-22 Thread Pedro páramo
Hi all,

I am trying to draw a plot with cumsum values but each "line" has different
lengths

Ilibrary(dplyr)
library(tibble)
library(lubridate)
library(PerformanceAnalytics)
library(quantmod)
library(ggplot2)

getSymbols('TSLA')

I want to create the variables:

a<-cumsum(dailyReturn(TSLA, subset = c('2019')) )
b<-cumsum(dailyReturn(TSLA, subset = c('2020')) )
c<-cumsum(dailyReturn(TSLA, subset = c('2018')) )

Each value, on a,b,c has two columns date, and values.

The thing is I want to plot the three lines in one plot with the maximum
values of a,b,c in this case a has 252 values, and plot the other two lines
could be in the axis I should put (x <- 1:252) on the axis but I was not
able for the moment.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Error in Rose Method (class balancing)

2020-07-22 Thread David Winsemius



On 7/22/20 3:43 PM, Neha gupta wrote:

Hello,


I get the following error when I use the ROSE class balancing method but
when I use other methods like SMOTE, up, down, I do not get any error
message.


Something is wrong; all the ROC metric values are missing:

ROC Sens Spec

Min. : NA Min. : NA Min. : NA

1st Qu.: NA 1st Qu.: NA 1st Qu.: NA

Median : NA Median : NA Median : NA

Mean :NaN Mean :NaN Mean :NaN

3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA

Max. : NA Max. : NA Max. : NA



library(DMwR)

d=readARFF("bughunter.arff")


After installing that package and loading pkg:DMwR I get:


Error in readARFF("bughunter.arff") : could not find function "readARFF"


Since you also posted in HTML, I suggest you read the Posting Guide, 
restart and R session and post a reproducible example that loads all 
needed packages and data.


--

David.



index <- createDataPartition(d$`Bug class`, p = .70,list = FALSE)

tr <- d[index, ]

ts <- d[-index, ]

boot3 <- trainControl(method = "repeatedcv", number=10,
repeats=10,classProbs = TRUE,verboseIter = FALSE,

summaryFunction = twoClassSummary, sampling = "rose")

set.seed(30218)

ct <- train(`Bug class` ~ ., data = tr,

method = "pls",

metric = "AUC",

preProc = c("center", "scale", "nzv"),

trControl = boot3)

getTrainPerf(ct)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Error in Rose Method (class balancing)

2020-07-22 Thread Neha gupta
Hello,


I get the following error when I use the ROSE class balancing method but
when I use other methods like SMOTE, up, down, I do not get any error
message.


Something is wrong; all the ROC metric values are missing:

ROC Sens Spec

Min. : NA Min. : NA Min. : NA

1st Qu.: NA 1st Qu.: NA 1st Qu.: NA

Median : NA Median : NA Median : NA

Mean :NaN Mean :NaN Mean :NaN

3rd Qu.: NA 3rd Qu.: NA 3rd Qu.: NA

Max. : NA Max. : NA Max. : NA



library(DMwR)

d=readARFF("bughunter.arff")

index <- createDataPartition(d$`Bug class`, p = .70,list = FALSE)

tr <- d[index, ]

ts <- d[-index, ]

boot3 <- trainControl(method = "repeatedcv", number=10,
repeats=10,classProbs = TRUE,verboseIter = FALSE,

summaryFunction = twoClassSummary, sampling = "rose")

set.seed(30218)

ct <- train(`Bug class` ~ ., data = tr,

method = "pls",

metric = "AUC",

preProc = c("center", "scale", "nzv"),

trControl = boot3)

getTrainPerf(ct)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] viewing, editing and saving an RDATA file

2020-07-22 Thread Robert Baer
You may misunderstand how RData files work.  Note that RData files are 
not necessarily JUST a single variable unless they were explicitly 
written to store a single variable only.


If you save a single variable (a dataframe, for example) named 'mydata' 
with save(mydata, file = "saveddata.RData") and then load the variable 
back into a new R session with y  <- load("saveddata.RData"), your data 
will still be contained in a variable named 'mydata',  not renamed  y.


Look at ?load and ?save

On 7/22/2020 5:47 AM, Jim Lemon wrote:

Hi Jason,
I assume that you actually have "WVS.RData" in your working directory
when you try to load it. Otherwise you will get an error message. If
you don't get an error message when you do this:

load("WVS.RData")

there will be a new object in your workspace. So if you want to see
what the object is, try this:

objects()
load("WVS.RData")
objects()

Unless you have already run the "load" command, there will be a new
object in the list. That is what you're looking for. Say that object
is named "x". You can look at the first part of it with:

head(x)

and maybe do some basic editing with:

edit(x)

Good luck.

Jim

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] viewing, editing and saving an RDATA file

2020-07-22 Thread David Winsemius



On 7/21/20 9:11 PM, Jason Levy wrote:

Dear R Scholars
Many R users have successfully loaded and used the attached WVS RDATA file
into my R program.



You appear to have made a common mistake in assuming that attachments of 
any sort can be processed by the Rhelp mail-server. Only attachments of 
type postscript, PDF and plain-text can survive the scrubbing process. 
It is possible to make an attachment that will hold a faithful 
representation of R objects using dput or dump, but they must have 
extension .txt when attached by mail-clients.



--

David.


I would just would like help viewing, editing etc.
It is only one line of code to load in.
*load('WVS.RData')*

I would like help on how to view, edit and save this 2.461 MB RData file.
There have been so many questions and answers about this topic but I am at
my wits end. I apologize for asking such a basic question. I ave

I have tried this command and I cannot even view it, let alone edit the file
y <- load('WVS.RData')
head(y)

thank you for your guidance, Jack
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R-es] Actualizar la versión de glue

2020-07-22 Thread Jorge I Velez
Lissette,

La forma más fácil es verificar qué versión tienes es haciendo

R>  packageVersion("glue")
## [1] '1.4.1'

Para actualizarla a la _última_ versión, debes hacer

R> install.packages('glue')

De esta forma siempre vas a instalar la versión más reciente disponible en
https://cran.r-project.org/web/packages/glue/index.html

Saludos,
Jorge.-

On Tue, Jul 21, 2020 at 6:15 PM Lissette Fuentes Lorca <
lissette...@gmail.com> wrote:

> Hola! si, pensé que era algo referido a la versión de glue que tengo.
> Cómo puedo saber qué versión tengo instalada?
> cómo puedo actualizar la misma?
>
> Tal como señalan, al parecer tengo la  1.3.1 y necesito la 1.3.2 .
> Muchas gracias!
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] A Question about MLE in R

2020-07-22 Thread J C Nash
SANN is almost NEVER the tool to use.

I've given up trying to get it removed from optim(), and will soon give up
on telling folk not to use it.

JN

On 2020-07-22 3:06 a.m., Zixuan Qi wrote:
> Hi,
> 
> I encounter a problem. I use optim() function in R to estimate likelihood
> function and the method is SANN in the optim function.
> out <-
> optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=500))
> 
> However, I find that each time I run the program, I will get different
> values of parameters. My initial values are same, but the number of
> iterations has reached the maximum limit. I expanded the number of
> iterations to 5 million, but it��s still wrong.
> 
> I want to know what I should do. Is anyone willing to help me? Thanks so
> much!
> 
> Best,
> Cisy
> 
>   [[alternative HTML version deleted]]
> 
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] [FORGED] Testing wether my dataset follows a poisson distribution with R

2020-07-22 Thread Rolf Turner



On 22/07/20 2:26 pm, Paul Bernal wrote:


Dear friends,

I have a sample dataset, which is basically the number of transits through
a particular waterway, and is on a daily basis.

MyDat <- dataset$DailyTransits

What I´d like to do is to test whether MyDat follows a poisson distribution
or not. What R function could accomplish this?

Any help and/or guidance will be greatly appreciated,


I presume (your question is a bit vague) that you want to do a goodness 
of fit test of the Poisson distribution to your data.  Doing such a test 
would, I think, involve the assumption that your observations are 
independent and identically distributed (i.i.d.).  Since you appear to 
have a time series of daily counts, this assumption is unlikely to be valid.


Modelling such a time series and investigating whether the underlying 
marginal distributions are Poisson is likely to be a fairly subtle 
problem.  Others may be able to offer more insight here.  However such a 
discussion would be about statistical theory and methodology and  hence 
inappropriate for this list.


If you make the (likely to be untenable) assumption that your data are 
i.i.d. then such a g.o.f. test is probably most appropriately done using 
a chi-squared goodness of fit test.


The function chisq.test() would  help you.  Getting the details right 
may prove a bit tricky, but if you can't handle that, then you should 
probably seek "local" statistical advice.


In fact, you should (in view of the likely lack of independence of your 
data) seek local statistical advice in any case.


cheers,

Rolf Turner

P.S. Please note that it's "whether" not "wether".  (A wether is a 
castrated ram.)  Also "Poisson" should be capitalised.  (It's a bloke's 
name.)


R. T.

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] viewing, editing and saving an RDATA file

2020-07-22 Thread Jim Lemon
Hi Jason,
I assume that you actually have "WVS.RData" in your working directory
when you try to load it. Otherwise you will get an error message. If
you don't get an error message when you do this:

load("WVS.RData")

there will be a new object in your workspace. So if you want to see
what the object is, try this:

objects()
load("WVS.RData")
objects()

Unless you have already run the "load" command, there will be a new
object in the list. That is what you're looking for. Say that object
is named "x". You can look at the first part of it with:

head(x)

and maybe do some basic editing with:

edit(x)

Good luck.

Jim

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] how to view and edit this RData file

2020-07-22 Thread Martin Maechler
> Ivan Krylov n Wed, 22 Jul 2020 12:42:48 +0300 writes:

   > On Tue, 21 Jul 2020 21:35:49 -1000 Jason Levy  wrote:

>> I would like help on how to view, edit and save this
>> 2.461 MB RData file.

> Check out the envir= argument to load() and save() if you
> want to isolate the loaded data from the rest of the
> session.

> For an example:

> # create an environment to load the .rda into...
> dataenv <- new.env(parent = emptyenv())
> load('data.rda', envir = dataenv) # ...and load it there
> ls(dataenv) # see what was inside the .rda file

> dataenv$z <- volcano # edit the contents of the environment
> # save the contents of the environment to an .rda file
> save(list = ls(dataenv), file = 'data.rda', envir = dataenv)

> -- 
> Best regards,
> Ivan

Indeed.
An -- underused and not much known -- alternative is to use

  attach("data.rda")

in my view *the only*  "legitimate" use of attach() nowadays.

Martin Maechler
ETH Zurich  and   R Core team

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] A Question about MLE in R

2020-07-22 Thread peter dalgaard
Simulated annealing is a probabilistic method and will do things like that. You 
should probably read an introduction to the method, e.g. the Wikipedia page. 
Not too unlikely, you really want to use one of the other methods in optim() 
(or better still optimr from the optimx package). 

(I take it that logLik is really the _negative_ log-likelihood function, right? 
Otherwise, the problem could be that you are minimizing, not maximizing.)

-pd

> On 22 Jul 2020, at 09:06 , Zixuan Qi  wrote:
> 
> Hi,
> 
> I encounter a problem. I use optim() function in R to estimate likelihood
> function and the method is SANN in the optim function.
> out <-
> optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=500))
> 
> However, I find that each time I run the program, I will get different
> values of parameters. My initial values are same, but the number of
> iterations has reached the maximum limit. I expanded the number of
> iterations to 5 million, but it�s still wrong.
> 
> I want to know what I should do. Is anyone willing to help me? Thanks so
> much!
> 
> Best,
> Cisy
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] how to view and edit this RData file

2020-07-22 Thread Ivan Krylov
On Tue, 21 Jul 2020 21:35:49 -1000
Jason Levy  wrote:

> I would like help on how to view, edit and save this 2.461 MB RData
> file.

Check out the envir= argument to load() and save() if you want to
isolate the loaded data from the rest of the session.

For an example:

# create an environment to load the .rda into...
dataenv <- new.env(parent = emptyenv())
load('data.rda', envir = dataenv) # ...and load it there
ls(dataenv) # see what was inside the .rda file
dataenv$z <- volcano # edit the contents of the environment
# save the contents of the environment to an .rda file
save(list = ls(dataenv), file = 'data.rda', envir = dataenv)

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] how to view and edit this RData file

2020-07-22 Thread Micha Silver



On 22/07/2020 10:35, Jason Levy wrote:

Dear R Scholars

Many R users have successfully loaded and used the attached WVS RDATA file
into my R program. I would just would like help viewing, editing etc.

I wanted to include the actual RData file (which was not attached
previously)

I can successfully load the RData file:
load('WVS.RData')

https://drive.google.com/drive/u/1/folders/15QhSBkwEfHLqgZznoaqodWglXuxV4f7P



This works:


load("~/Downloads/WVS.RData")
ls()
[1] "final.ord"
str(final.ord)
 num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...
head(final.ord)




I would like help on how to view, edit and save this 2.461 MB RData file.
I am at my wits end. I apologize for asking such a basic question. I
appreciate your help in advance

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
https://orcid.org/-0002-1128-1325

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] how to view and edit this RData file

2020-07-22 Thread Jason Levy
Dear R Scholars

Many R users have successfully loaded and used the attached WVS RDATA file
into my R program. I would just would like help viewing, editing etc.

I wanted to include the actual RData file (which was not attached
previously)

I can successfully load the RData file:
load('WVS.RData')

https://drive.google.com/drive/u/1/folders/15QhSBkwEfHLqgZznoaqodWglXuxV4f7P


I would like help on how to view, edit and save this 2.461 MB RData file.
I am at my wits end. I apologize for asking such a basic question. I
appreciate your help in advance

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] A Question about MLE in R

2020-07-22 Thread Zixuan Qi
Hi,

I encounter a problem. I use optim() function in R to estimate likelihood
function and the method is SANN in the optim function.
out <-
optim(parm,logLik,method='SANN',hessian=T,control=list(maxit=500))

However, I find that each time I run the program, I will get different
values of parameters. My initial values are same, but the number of
iterations has reached the maximum limit. I expanded the number of
iterations to 5 million, but it��s still wrong.

I want to know what I should do. Is anyone willing to help me? Thanks so
much!

Best,
Cisy

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] viewing, editing and saving an RDATA file

2020-07-22 Thread Jason Levy
Dear R Scholars
Many R users have successfully loaded and used the attached WVS RDATA file
into my R program. I would just would like help viewing, editing etc.
It is only one line of code to load in.
*load('WVS.RData')*

I would like help on how to view, edit and save this 2.461 MB RData file.
There have been so many questions and answers about this topic but I am at
my wits end. I apologize for asking such a basic question. I ave

I have tried this command and I cannot even view it, let alone edit the file
y <- load('WVS.RData')
head(y)

thank you for your guidance, Jack
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R-es] (Fwd) Re: Re: Evitar posibles conflictos entre librerí as

2020-07-22 Thread Guillermo.Vinue
Estimado Javier,

Gracias por la respuesta. Aunque he tratado de utilizar los imports y la carga 
de paquetes de diferentes formas, no he conseguido de momento evitar el error. 

Al final, para el objetivo de crear un login estoy utilizando el paquete 
shinyauthr, https://github.com/PaulC91/shinyauthr

No está tan desarrollado como el de shinymanager pero parece un poco más 
estable.

Saludos,

Guillermo

> Estimado Guillermo
> 
> El problema está en los tokens, esto es una cantidad de números y letras,
> lo que sea, mire un ejemplo en https://jwt.io/ , en otras palabras es lo
> que identifica cada una para con el servidor y que R no realice por ejemplo
> un promedio mezclando dados de usuarios. En un momento se debe requerir
> algo que al no tener el token no R no conoce donde buscar. Intente algun
> import o library()
> 
> Javier Rubén Marcuzzi
> 
> El lun., 20 jul. 2020 a las 5:38,  escribió:
> 
> > Buenos días,
> >
> > Tengo el siguiente problema que no consigo solucionar y quisiera preguntar
> > si alguien tiene alguna recomendación:
> >
> > Estoy desarollando una shiny app en la que utilizo el paquete shinymanager
> > para que el usuario acceda a ella mediante una contraseña.
> >
> > Esta app utiliza, entre otros, el paquete tidytext, que tiene en la lista
> > de Suggests el paquete quanteda.
> > https://cran.r-project.org/web/packages/tidytext/
> >
> > Cuando ejecuto esta app en mi ordenador local funciona bien, es decir,
> > puedo hacer el login sin problema. Sin embargo, cuando subo esta app a un
> > servidor personal, me da este error (tanto en local como en el servidor
> > tengo las mismas versiones de los paquetes):
> >
> > Error in unclass: cannot unclass an environment
> >   58: upgrade_tokens
> >   57: as.tokens.tokens
> >   55: docvars.tokens
> >   52: $.tokens
> >   50: secure_server
> >
> > secure_server es una función de shinymanager y he visto que upgrade_tokens
> > es una función de quanteda. He podido descubrir que shinymanager define una
> > clase interna que se llama .tokens <- R6::R6Class(...), mientras que
> > quanteda tiene una función que se llama tokens <- function(...)
> >
> > Entiendo que hay un conflicto entre shinymanager y quanteda (aunque
> > quanteda no es un paquete que se cargue con Imports), pero no he podido
> > lograr resolverlo. Tampoco he podido averiguar qué significa "cannot
> > unclass an environment".
> >
> > ¿Alguien conoce una posible solución?
> >
> > Gracias de antemano.
> >
> > Un saludo,
> >
> > Guillermo
> >
> > ___
> > R-help-es mailing list
> > R-help-es@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-help-es
> >
> 

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Question about citing R packages in an academic paper

2020-07-22 Thread Dr. Mehdi Dadkhah
Hi,
I hope you are doing well!

I have a question. I and my colleagues wrote a paper by using R language and 
its packages. We also used some tutorials. We have words count limitation for 
our paper. In early version of paper, I cited all packages in the reference 
list of paper (my paper will be published in an academic journal). After that, 
we had to keep references to tutorials in the reference list and remove 
reference to R and its packages (I strictly should fit paper to 2000 words). We 
created an online appendix and listed all packages which we used. Some packages 
are related to paper. For example, when i used command 'citation()'  in R 
console for package "tidytext", R informed me that i should cite such package 
as this:


Silge, J., & Robinson, D. (2016). tidytext: Text Mining and Analysis Using Tidy 
Data Principles in R. JOSS, 1(3). https://doi.org/10.21105/joss.00037

Now, all packages and their related papers are not in the reference list of 
paper, but they will be available in an online appendix in the journal website. 
Is such practice OK or should I cite all packages in the reference list?
I attached online appendix. We will submit our paper to a journal soon.
Should I cite papers which are related to packages in the reference list? if I 
do not cite, i will face with permission problem regard to usage of package?

Many thanks!
With best regards,


Dr. Mehdi Dadkhah


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.