[R] understanding with

2016-09-08 Thread Carl Sutton via R-help
 Hi I have been doing theR-exercises to improve my R programming capabilities.   Data.frame exercise4 showed me that I have a languageproblem.  Yes, I am frustrated, but please don’t take this as acriticism of the R language.  Theroutines I have managed to write do marvelous things in a short per

Re: [R] element wise pattern recognition and string substitution

2016-09-08 Thread Jun Shen
Hi Ista, Imagine we have a data set called "all.exposure" with variables "TX","WTCUT" for a function. The concatenated strings are generated by some procedure within the function (the dot is used as separator, I can't change that). Now I want to parse the strings back to the original values as in

Re: [R] Have help list filters changed recently

2016-09-08 Thread Marc Schwartz
> On Sep 8, 2016, at 7:35 PM, Bert Gunter wrote: > > To all: > > r-help has been holding up a lot of my recent messages: Have there > been any changes to help list filters that caused this? Is there > something I'm doing wrong? -- I have made no changes that I am aware > of. Here's what I get:

[R] Have help list filters changed recently

2016-09-08 Thread Bert Gunter
To all: r-help has been holding up a lot of my recent messages: Have there been any changes to help list filters that caused this? Is there something I'm doing wrong? -- I have made no changes that I am aware of. Here's what I get: Your mail to 'R-help' with the subject Re: [R] with and eva

Re: [R] with and evaluation

2016-09-08 Thread Jim Lemon
Hi Carl, order vs sort The order function just returns the indices necessary to put the object into the sorted order, while the sort function returns the sorted object. If you want to use the order function: newdf2<-df2[(order(df2[,1]),] Yes, "with" can be a bit challenging. Think of it as: with

Re: [R] New installation

2016-09-08 Thread jax200
Following up on this thread, I went with ubuntu. All is good Many thanks for your responses, Jack On Fri, Jun 10, 2016 at 9:54 AM, Leonardo Fontenelle < leonar...@leonardof.med.br> wrote: > Em Sex 10 jun. 2016, às 03:58, Rainer M Krug escreveu: > > Clint Bowman writes: > > > > I am reall

Re: [R] with and evaluation

2016-09-08 Thread Bert Gunter
I echo Duncan's plea. But I can easily resolve one question: "What's with "with? It is one function I do not use because I find it incomprehensible. " Consider: ## first, clear the workspace, also known as the Global environment > rm(list=ls()) ## now create a data frame (or list or environme

Re: [R] with and evaluation

2016-09-08 Thread Jeff Newmiller
You don't say where any of this code you are looking at came from, but I suspect [1]. If you feel the author of that site is failing to explain their answers sufficiently, please communicate that to them, not us. I agree that the documentation file for with() is rather opaque to a beginner and

Re: [R] with and evaluation

2016-09-08 Thread Duncan Murdoch
On 08/09/2016 6:57 PM, Carl Sutton via R-help wrote: Hi I have doing the R-exercises to improve my R programming capabilities. Data.frame exercise 4 showed me that I have a language problem. Here's the problem and my "solution". # Exercise 4# Create a simple data frame from 3 vectors. Orde

[R] with and evaluation

2016-09-08 Thread Carl Sutton via R-help
Hi I have doing the R-exercises to improve my R programming capabilities.   Data.frame exercise 4 showed me that I have  a language problem.  Here's the problem and my "solution". #  Exercise 4#  Create a simple data frame from 3 vectors. Order the entire data frame by the#  first column.df2 <- d

[R] Revolutions blog: August 2016 roundup

2016-09-08 Thread David Smith via R-help
Since 2008, Microsoft (formerly Revolution Analytics) staff and guests have written about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. And in case you

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-08 Thread Stefan Evert
> On 8 Sep 2016, at 16:25, David L Carlson wrote: > > Sampling without replacement treats the sample as the population for the > purposes of estimating the outcomes at smaller sample sizes. Sampling with > replacement (the same as bootstrapping) treats the sample as one possible > outcome of

[R] [R-pkgs] diffobj released to CRAN

2016-09-08 Thread brodie gaslam via R-packages
diffobj provides tools to compare the visual representation of R objects using the Myer's diff algorithm: ## Example: > mx1 <- matrix(1:9, 3) > mx2 <- mx1[-2,] > diffPrint(mx1, mx2, format="raw") < mx1 > mx2 @@ 1,4 @@ @@ 1,3 @@ . [,1] [,2] [,3] [,1] [,2

Re: [R] How to interpret lm's coefficients?

2016-09-08 Thread Bert Gunter
Petr Pikal said: "The explanation is not for few lines of plain text short mail. But maybe others will disagree." Not I -- you should consult your teachers or texts (as Petr said) for basic statistical questions. I'll add a nugget to Petr's reply, however: it is very often the case (for correla

[R] The R Journal, Volume 8, Issue 1

2016-09-08 Thread Michael Lawrence
Dear all, The latest issue of The R Journal is now available at http://journal.r-project.org/archive/2016-1/ Many thanks to all contributors. Michael Lawrence ___ r-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-08 Thread David L Carlson
One way around this would be to use multinomial sampling, but as Stefan indicated, the maximum number of species at any size will, of course be 40 (in your example): > set.seed(42) > # Generate one sample > census <- round(rlnorm(40)) > sum(census) # Sample size [1] 76 > sum(as.logical(census))

[R] Fwd: hello i have a question on music analysis and mathematical synthesis related to r code

2016-09-08 Thread Bert Gunter
Darth: Please always cc the list if it is not a strictly personal communication. The information you provide may be relevant and allow others to help you. Note also: Jim's suggestion of tuneR was a top hit from the google search I suggested. -- Bert Bert Gunter "The trouble with having an ope

Re: [R] How to interpret lm's coefficients?

2016-09-08 Thread PIKAL Petr
Hi see in line > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Matti > Viljamaa > Sent: Thursday, September 8, 2016 2:44 PM > To: r-help@R-project.org > Subject: [R] How to interpret lm's coefficients? > > I’m trying to understand how to interpret th

Re: [R] R-specific Software Requirement Specification

2016-09-08 Thread Duncan Murdoch
On 08/09/2016 10:15 AM, Michael Friendly wrote: devtools::document() is meant to be used within an R **package**, not for a standalone file. Try devtools::create() first. But at any rate, roxygen format seems to answer your question about how to describe the specifications for a collection of

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-08 Thread David L Carlson
Sampling without replacement will never find more species than there are in your original sample either! Sampling without replacement treats the sample as the population for the purposes of estimating the outcomes at smaller sample sizes. Sampling with replacement (the same as bootstrapping) t

Re: [R] R-specific Software Requirement Specification

2016-09-08 Thread Michael Friendly
devtools::document() is meant to be used within an R **package**, not for a standalone file. Try devtools::create() first. But at any rate, roxygen format seems to answer your question about how to describe the specifications for a collection of functions written by different people. Translati

Re: [R] CopyDetect Packgace

2016-09-08 Thread Jeff Newmiller
Read the Posting Guide mentioned at the bottom of this message. Learn how to pose a question online. [1] Post using plain text format so your code doesn't get damaged by the HTML formatting. [1] http://adv-r.had.co.nz/Reproducibility.html -- Sent from my phone. Please excuse my brevity. On

Re: [R] R-specific Software Requirement Specification

2016-09-08 Thread Doran, Harold
I'm trying the example on Hadley's page. I save the following into a file called "test.R" #' Add together two numbers. #' #' @param x A number. #' @param y A number. #' @return The sum of \code{x} and \code{y}. #' @examples #' add(1, 1) #' add(10, 1) add <- function(x, y) { x + y } Then from

Re: [R] get start and end date of ISO weeks giving a date as input

2016-09-08 Thread Enrico Schumann
Hi Veronica, please see inline. On Thu, 08 Sep 2016, Veronica Andreo writes: > Hello Luisfo and Enrico, > > Thanks for your help! I've been testing both > solutions... results differ for the same date (I > changed both functions to use ISO8601). And I added > contiguous dates, to see how they h

Re: [R] R-specific Software Requirement Specification

2016-09-08 Thread Michael Friendly
You might also or instead look at the roxygen way of doing things, which maps to Rd files, but are much easier to write. In R Studio, Code -> Insert Roxygen skeleton does this for you from an existing function. See: http://r-pkgs.had.co.nz/man.html #' title goes here #' #' description goes he

Re: [R] get start and end date of ISO weeks giving a date as input

2016-09-08 Thread Veronica Andreo
Hello Luisfo and Enrico, Thanks for your help! I've been testing both solutions... results differ for the same date (I changed both functions to use ISO8601). And I added contiguous dates, to see how they handle the start-end of the week. So, here the results: ### one example d <- c("2010-08-21"

[R] CopyDetect Packgace

2016-09-08 Thread Ahmad Nursalim
Dear All x <- CopyDetect2 (data = data.abcd, item.par = slopintrc, pair = c (pairs [i, 1], pairs [i, 2]), options = c ("A", "B", "C", "D", "E")) What is the mean pair = c (pairs [i, 1], pairs [i, 2]), Pleas Help Me

Re: [R] Is there t.test with null hypothesis?

2016-09-08 Thread Michael Dewey
Dear Matti On 08/09/2016 13:06, Matti Viljamaa wrote: I’m trying to do a t-test, where the null hypothesis for the two data sets has to be: “the means are the same”/“difference in means is equal to one” That is two statements not one. Do you mean that your null is that the difference is 1?

Re: [R] Is there t.test with null hypothesis?

2016-09-08 Thread Matti Viljamaa
> On 08 Sep 2016, at 15:48, Michael Dewey wrote: > > Dear Matti > > On 08/09/2016 13:06, Matti Viljamaa wrote: >> I’m trying to do a t-test, where the null hypothesis for the two data sets >> has to be: >> >> “the means are the same”/“difference in means is equal to one” >> > > That is two

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-08 Thread Stefan Evert
> On 7 Sep 2016, at 00:07, Nick Pardikes wrote: > > Is there any way to use rarecurve to resample a community (row) with > replacement the same number of times for all 50 communities? With > replacement is important because the communities differ greatly in their > size (number of species). Are

[R] How to interpret lm's coefficients?

2016-09-08 Thread Matti Viljamaa
I’m trying to understand how to interpret the return values, specifically “Coefficients:”, of R’s lm function. I’m using it with a dichotomic predictor (mom_hs). lm(data$kid_score ~ data$mom_hs) returns Coefficients: # (Intercept) data$mom_hs # 77.5511.77 I read that the (Interce

Re: [R] Is there t.test with null hypothesis?

2016-09-08 Thread Rick Bilonick
You need to include the argument "mu=1" (without parentheses). For example: > t.test(group1,group2, mu=1) for a two-sample independent groups t-test. If you type: > ?t.test you can see the help information for the t.test function. RIck On 09/08/2016 08:06 AM, Matti Viljamaa wrote: I’m tryin

Re: [R] Fitting Mixture distributions

2016-09-08 Thread Martin Maechler
> Bert Gunter > on Wed, 7 Sep 2016 23:47:40 -0700 writes: > "please suggest what can I do to resolve this > issue." > Fitting normal mixtures can be difficult, and sometime the > optimization algorithm (EM) will get stuck with very slow convergence. > Presumably t

[R] Is there t.test with null hypothesis?

2016-09-08 Thread Matti Viljamaa
I’m trying to do a t-test, where the null hypothesis for the two data sets has to be: “the means are the same”/“difference in means is equal to one” Using the t.test function in R I’m able to see that it uses the following “alternative hypothesis”: alternative hypothesis: true difference in me

Re: [R] get start and end date of ISO weeks giving a date as input

2016-09-08 Thread Luisfo via R-help
Dear Veronica, Here there's a way of doing what you requested. library("lubridate") # your date '2010-08-21' as Date object dd <- as.Date(strptime("2010-08-21", format="%Y-%m-%d", tz="GMT")) # take the first day of the year as Date object, i.e. 2010-01-01 in our example ref.date <- as.Date(strpt

Re: [R] Resample with replacement to produce many rarefaction curves with same number of samples

2016-09-08 Thread Luisfo via R-help
Hi Nick, Yes, you are right. There's one small bug on my code. The 'if' within the for-loop is wrong. Try it now with the code below. rrarefy.custom <- function (x, sample, rep.param=F) { if (!identical(all.equal(x, round(x)), TRUE)) stop("function is meaningful only for integers (counts)

Re: [R] get start and end date of ISO weeks giving a date as input

2016-09-08 Thread Enrico Schumann
On Thu, 08 Sep 2016, Veronica Andreo writes: > Hello list, > > Is there a quick way to get start and end date (%Y-%m-%d) from ISO > weeks if I only have dates? > > For example, I have this date in which some event happened: > "2010-08-21". Not only I want the ISO week, which I can obtain either >

[R] get start and end date of ISO weeks giving a date as input

2016-09-08 Thread Veronica Andreo
Hello list, Is there a quick way to get start and end date (%Y-%m-%d) from ISO weeks if I only have dates? For example, I have this date in which some event happened: "2010-08-21". Not only I want the ISO week, which I can obtain either with isoweek (lubridate) or ISOweek (ISOweek), but I want th

Re: [R] building R from source on gnu version >=5.4

2016-09-08 Thread David Winsemius
> On Sep 7, 2016, at 1:17 AM, Chinmay Borwankar wrote: > > Hi, >I want to integrate R with ROOTv6.06, which requires that, >R be built with gcc compiler option "_GLIBCXX_USE_CXX11_ABI=0" . >I am hoping that if I build R from source then there will be a way to > do this. >Is there

Re: [R] hello i have a question on music analysis and mathematical synthesis related to r code

2016-09-08 Thread Bert Gunter
Search on the Internet! "Analyze music in R" had hits for several R packages that seemed like they might be relevant. Apologies if you've already done this and found mothing to meet your needs. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and

Re: [R] Fitting Mixture distributions

2016-09-08 Thread Bert Gunter
"please suggest what can I do to resolve this issue." Fitting normal mixtures can be difficult, and sometime the optimization algorithm (EM) will get stuck with very slow convergence. Presumably there are options in the package to either increase the max number of steps before giving up or make th

Re: [R] hello i have a question on music analysis and mathematical synthesis related to r code

2016-09-08 Thread Jim Lemon
Hi Darth, Have a look at the tuneR package. Jim On Thu, Sep 8, 2016 at 3:57 PM, darth brando wrote: > Apologies for the long title but it is semi specific a topic and yes I am a > noobs user to the system. I have read the guide and will attempt to adhere to > the guide in this process and I d