Re: [R] roxygen2 v6.0.0

2017-02-06 Thread Bert Gunter
Marc:

You miss Yihui's point I think: roxygen2 will generate the (Namespace
and other) files for you. See its documentation for how (the
directives to put in your comments).

-- Bert


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 Mon, Feb 6, 2017 at 9:38 AM, Marc Girondot via R-help
 wrote:
> Le 06/02/2017 à 17:14, Yihui Xie a écrit :
>>
>> If your package source is version controlled (meaning you are free to
>> regret any time), I'd recommend you to delete the three files
>> NAMESPACE, chr.Rd, and essai-package.Rd. Then try to roxygenize again.
>> Basically the warnings you saw indicates that roxygen2 failed to find
>> the line
>>
>> % Generated by roxygen2: do not edit by hand
>>
>> in your NAMESPACE and .Rd files, so it thinks these files were
>> probably not previously generated by roxygen2. I think the cause is
>> package.skeleton(), which generated the Rd files. Seriously, friends
>> don't let friends use package.skeleton()... (it is 2017 now)
>
> Thanks ! It works perfectly after removing the /man/ folder and the
> NAMESPACE file.
> I didn't know that package.skeleton() was out-of-age !
> That's true that it is easy to generate the skeleton manually.
>
> Marc
>>
>>
>> Regards,
>> Yihui
>> --
>> Yihui Xie 
>> Web: http://yihui.name
>>
>>
>> On Mon, Feb 6, 2017 at 9:46 AM, Marc Girondot via R-help
>>  wrote:
>>>
>>> Hi,
>>>
>>> I used roxygen2 v5.0.1 to document my package, and all was ok. I have
>>> just
>>> updated to roxygen2 v6.0.0 and my script is broken and I can't find why.
>>>
>>> I have done a simple version of a package folder as a test with 3 files:
>>> chr.R, essai-package.R and DESCRIPTION.
>>>
>>> Previously, I did:
>>>
>>> package.skeleton("essai",code_files=c('chr.R',"essai-package.R"))
>>> roxygenize("essai")
>>> system(paste0("R CMD build '", getwd(), "/essai'"))
>>> install.packages(file.path(getwd(), "essai_1.0.tar.gz"), repos = NULL,
>>> type="source")
>>>
>>> And it worked well.
>>>
>>> Now I get an error at the second line: roxygenize("essai")
>>>
 roxygenize("essai")
>>>
>>> First time using roxygen2. Upgrading automatically...
>>> Updating roxygen version in
>>>
>>> /Users/marcgirondot/Documents/Espace_de_travail_R/Package_Essai/essai/DESCRIPTION
>>> Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and
>>> will not be overwritten.
>>> Warning: The existing 'chr.Rd' file was not generated by roxygen2, and
>>> will
>>> not be overwritten.
>>> Warning: The existing 'essai-package.Rd' file was not generated by
>>> roxygen2,
>>> and will not be overwritten.
>>>
>>> And of course it fails after.
>>>
>>> Are you aware of this situation ? And do you have a solution ?
>>>
>>> Thanks a lot
>>>
>>> Marc
>>>
>>>
>>> A file DESCRIPTION:
>>>
>>> Package: essai
>>> Type: Package
>>> Title: Package Used For Try
>>> Version: 1.0
>>> Date: 2017-02-06
>>> Author: Marc Girondot 
>>> Maintainer: Marc Girondot 
>>> Description: Trying package.
>>> Depends: R (>= 2.14.2)
>>> License: GPL-2
>>> LazyData: yes
>>> LazyLoad: yes
>>> Encoding: UTF-8
>>> RoxygenNote: 6.0.0
>>>
>>> A file essai-package.R (essai=try in French):
>>>
>>> #' Trying package
>>> #'
>>> #' \tabular{ll}{
>>> #'  Package: \tab essai\cr
>>> #'  Type: \tab Package\cr
>>> #'  Version: \tab 1.0 - build 1\cr
>>> #'  Date: \tab 2017-02-06\cr
>>> #'  License: \tab GPL (>= 2)\cr
>>> #'  LazyLoad: \tab yes\cr
>>> #'  }
>>> #' @title The package essai
>>> #' @author Marc Girondot \email{marc.girondot@@u-psud.fr}
>>> #' @docType package
>>> #' @name essai-package
>>>
>>> NULL
>>>
>>> A file chr.R:
>>>
>>> #' chr returns the characters defined by the codes
>>> #' @title Return the characters defined by the codes
>>> #' @author Based on this blog:
>>> http://datadebrief.blogspot.com/2011/03/ascii-code-table-in-r.html
>>> #' @return A string with characters defined by the codes
>>> #' @param n The vector with codes
>>> #' @description Return a string with characters defined by the codes.
>>> J'essaye avec un code utf-8: ê.
>>> #' @examples
>>> #' chr(65:75)
>>> #' chr(unlist(tapply(144:175, 144:175, function(x) {c(208, x)})))
>>> #' @encoding UTF-8
>>> #' @export
>>>
>>>
>>> chr <- function(n) {
>>>  rawToChar(as.raw(n))
>>>  }
>>>
>>> __
>>> 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] diff doesnot work

2017-02-06 Thread William Dunlap via R-help
diff() does not work on data.frames so you need to give it a column
from the data.frame, as a vector.
  diff(data.frame(P=c(1,2,3,5,7,11,13,17))$P)
  [1] 1 1 2 2 4 2 4

You get different errors for multi- and single-column data.frames
  > diff(data.frame(P=c(1,2,3,5,7,11,13,17), F=c(1,1,2,3,5,8,13,21)))
  Error in r[i1] - r[-length(r):-(length(r) - lag + 1L)] :
non-numeric argument to binary operator
  > diff(data.frame(P=c(1,2,3,5,7,11,13,17)))
  data frame with 0 columns and 8 rows
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Feb 6, 2017 at 2:21 PM, george brida  wrote:
> Dear R users,
>
> I have a txt file entitled coc composed by one column of numeric values
> without header and having 50 rows. This file is under the following path:
>
> C:\\Users\\intel\\Documents\\TR
>
> I have written the following lines:
>
> xcx=read.table("C:\\Users\\intel\\Documents\\TR\\coc.txt",header=F)
> xc=log(xcx)
>
> I have obtained the series xc but when I wrote
> x=diff(xc)
>
> I obtained the following message:
>
> data frame with 0 columns and 50 rows
>
> I don't know where is the problem. Can you help me please
>
> [[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] diff doesnot work

2017-02-06 Thread george brida
Dear R users,

I have a txt file entitled coc composed by one column of numeric values
without header and having 50 rows. This file is under the following path:

C:\\Users\\intel\\Documents\\TR

I have written the following lines:

xcx=read.table("C:\\Users\\intel\\Documents\\TR\\coc.txt",header=F)
xc=log(xcx)

I have obtained the series xc but when I wrote
x=diff(xc)

I obtained the following message:

data frame with 0 columns and 50 rows

I don't know where is the problem. Can you help me please

[[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] Revolutions blog: January 2017 roundup

2017-02-06 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 missed them, here are some articles related to R from the month 
of January:

The Data Science Virtual Machine on Azure has been updated with the latest 
Microsoft R Server, and adds RStudio and
JuliaPro: 
http://blog.revolutionanalytics.com/2017/01/dsvm-updated-now-includes-rstudio.html

A crowdsourced list of local R user groups and community events, maintained by 
Colin Gillespie:
http://blog.revolutionanalytics.com/2017/01/list-of-r-conferences-and-user-groups.html

Resources for searching R packages, now that CRAN has more than 10,000 of them:
http://blog.revolutionanalytics.com/2017/01/cran-1.html

An analysis of 2 decades of Kung Fu movies (with R code) by Jim Vallandingham:
http://blog.revolutionanalytics.com/2017/01/kung-fu-r.html

New Zealand's Heartland Bank replaced SAS with Microsoft R Server:
http://blog.revolutionanalytics.com/2017/01/nz-bank-replaces-sas-with-r.html

A tutorial on creating a predictive model for the NYC Taxi dataset using the 
MicrosoftML package in Microsoft R Server:
http://blog.revolutionanalytics.com/2017/01/microsoftml-taxi-trips.html

A list of upcoming R conference and meetings: 
http://blog.revolutionanalytics.com/2017/01/upcoming-r-conferences.html

The new book "Text Mining with R" by Julia Silge and David Robinson, also 
available free online:
http://blog.revolutionanalytics.com/2017/01/free-guide-to-text-mining-with-r.html

A comprehensive guide to using Git and Github for R projects with RStudio, by 
Jenny Bryan:
http://blog.revolutionanalytics.com/2017/01/git-gud-with-git-and-r.html

Media reactions to the release of Microsoft R Server 9:
http://blog.revolutionanalytics.com/2017/01/microsoft-r-server-in-the-news.html

A survey by Forwards, the R Foundation taskforce, quantifies diversity in the R 
community:
http://blog.revolutionanalytics.com/2017/01/diversity-in-the-r-community.html

A new R package distributes data (and some R code) behind many data journalism 
features at fivethirtyeight.com:
http://blog.revolutionanalytics.com/2017/01/the-fivethirtyeight-r-package.html

A collection of Microsoft R Server tips from the customer support team:
http://blog.revolutionanalytics.com/2017/01/tiger-team-tips.html

R is being used to predict student performance in Australia and India:
http://blog.revolutionanalytics.com/2017/01/education-analytics.html

A case study in data visualization design: NOAA's flood prediction chart:
http://blog.revolutionanalytics.com/2017/01/the-anatomy-of-a-useful-chart.html

StackOverflow has released a dataset of question-and-answer data, which several 
people have analyzed using R:
http://blog.revolutionanalytics.com/2017/01/stackoverflow-insights.html

Several arguments for why R is the best data science language to learn today:
http://blog.revolutionanalytics.com/2017/01/three-reasons-to-learn-r-today.html

A tutorial on analyzing emotions in video, using R and the Microsoft Emotion 
API:
http://blog.revolutionanalytics.com/2017/01/analyzing-emotions-in-video-with-r.html

An introduction to the new remote R workspaces feature of Microsoft R Server 9:
http://blog.revolutionanalytics.com/2017/01/remote-and-local-r-workspaces.html

A roundup of the major news about R in 2016:
http://blog.revolutionanalytics.com/2017/01/the-biggest-r-stories-from-2016.html

General interest stories (not related to R) in the past month included: 
rearranged continents
(http://blog.revolutionanalytics.com/2017/01/because-its-friday-tangram-earth.html),
 a collapsing bridge
(http://blog.revolutionanalytics.com/2017/01/because-its-friday-infrastructure-collapses.html),
 satire for coders
(http://blog.revolutionanalytics.com/2017/01/because-its-friday-code-burn.html),
 and crafty photographer tricks
(http://blog.revolutionanalytics.com/2017/01/because-its-friday-photography-tricks.html).

If you're looking for more articles about R, you can find summaries from 
previous months at
http://blog.revolutionanalytics.com/roundups/. You can receive daily blog posts 
via email using services like
blogtrottr.com.

As always, thanks for the comments and please keep sending suggestions to me at 
david...@microsoft.com or via Twitter
(I'm @revodavid).

Cheers,
# David

-- 
David M Smith 
R Community Lead, Microsoft  
Tel: +1 (312) 9205766 (Chicago IL, USA)
Twitter: @revodavid | Blog:  http://blog.revolutionanalytics.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 interpret t.test output

2017-02-06 Thread Jim Lemon
Hi Somayya,
When you perform a t-test on two sets of numeric values, the answer
you get tells you how likely it is that those two sets of numbers came
from the same distribution. What most people are interested in is
whether the means of those two distributions are different. Let's see,
you seem to be with NHS in Scotland, so you are probably interested in
something like whether the mean reported severity of hangover is the
same for whisky as vodka in a sample of drinkers, controlling for
number of standard drinks of course. About all you can say from a
t-test is that those drinking one drink felt worse the next day _if_
the p value is small enough. Beware of doing lots of t-tests and
looking for <0.05.

Jim


On Tue, Feb 7, 2017 at 1:46 AM, Gardee, Somayya
 wrote:
> Hello for my project I am trying to write up my results from the paired 
> t-test I conducted.
> Please could someone help.
>
> Thank you,
> Somayya Gardee
> 
> NHSGG&C Disclaimer
>
> The information contained within this e-mail and in any attachment is
> confidential and may be privileged. If you are not the intended
> recipient, please destroy this message, delete any copies held on your
> systems and notify the sender immediately; you should not retain, copy
> or use this e-mail for any purpose, nor disclose all or any part of its
> content to any other person.
>
> All messages passing through this gateway are checked for viruses, but
> we strongly recommend that you check for viruses using your own virus
> scanner as NHS Greater Glasgow & Clyde will not take responsibility for
> any damage caused as a result of virus infection.
>
> **
> __
> 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] Beginner needs help with R

2017-02-06 Thread David Winsemius

> On Feb 6, 2017, at 9:08 AM, Jeff Newmiller  wrote:
> 
> I think it is important to point out that whenever R treats a number as a 
> numeric (integer or double) it loses any base 10 concept of "leading zero" in 
> that internal representation, so in this expression
> 
> seq2 <- paste0("DQ", sprintf("%06d", seq(060054, 060060)))

You can do it just with sprintf (and presumably with formatC as well) if you 
add a leading "DQ" to the format string.:

> sprintf( "DQ%06s", seq(060054, 060060))
[1] "DQ060054" "DQ060055" "DQ060056" "DQ060057" "DQ060058" "DQ060059" "DQ060060"

-- 
David.



> the arguments to seq have leading zeros that are ignored by R and have 
> nothing to do with getting the desired output. That is,  the same result can 
> be obtained using
> 
> seq2 <- paste0("DQ", sprintf("%06d", seq(60054, 60060)))
> 
> or
> 
> seq2 <- paste0("DQ", sprintf("%06d", seq(0060054, 00060060)))
> 
> since only the zero inside the format string is key to success. (If it makes 
> you more comfortable to put the zero there for readability that is your 
> choice, but R ignores therm.)
> 
> Also note that the paste0 function is not needed when you use sprintf:
> 
> seq2 <- sprintf("DQ%06d", seq(60054, 60060))
> 
> or
> 
> myprefix <- "DQ"
> seq2 <- sprintf("%s%06d", myprefix,seq(60054, 60060))
> 
> -- 
> Sent from my phone. Please excuse my brevity.
> 
> On February 6, 2017 5:45:43 AM PST, jim holtman  wrote:
>> You need the leading zeros, and 'numerics' just give the number without
>> leading zeros.  You can use 'sprintf' for create a character string
>> with
>> the leading zeros:
>> 
>>> # this is using 'numeric' and drops leading zeros
>>> 
>>> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>>> seq1
>> [1] "DQ60054" "DQ60055" "DQ60056" "DQ60057" "DQ60058" "DQ60059"
>> "DQ60060"
>>> 
>>> # use 'sprintf' to create leading zeros
>>> seq2 <- paste0("DQ", sprintf("%06d", seq(060054, 060060)))
>>> seq2
>> [1] "DQ060054" "DQ060055" "DQ060056" "DQ060057" "DQ060058" "DQ060059"
>> "DQ060060"
>>> 
>> 
>> 
>> Jim Holtman
>> Data Munger Guru
>> 
>> What is the problem that you are trying to solve?
>> Tell me what you want to do, not how you want to do it.
>> 
>> On Sun, Feb 5, 2017 at 8:50 PM, Nabila Arbi
>> 
>> wrote:
>> 
>>> Dear R-Help Team!
>>> 
>>> I have some trouble with R. It's probably nothing big, but I can't
>> find a
>>> solution.
>>> My problem is the following:
>>> I am trying to download some sequences from ncbi using the ape
>> package.
>>> 
>>> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>>> 
>>> sequences <- read.GenBank(seq1,
>>> seq.names = seq1,
>>> species.names = TRUE,
>>> gene.names = FALSE,
>>> as.character = TRUE)
>>> 
>>> write.dna(sequences, "mysequences.fas", format = "fasta")
>>> 
>>> My problem is, that R doesn't take the whole sequence number as
>> "060054"
>>> but it puts it as DQ60054 (missing the zero in the beginning, which
>> is
>>> essential).
>>> 
>>> Could please tell me, how I can get R to accepting the zero in the
>>> beginning of the accession number?
>>> 
>>> Thank you very much in advance and all the best!
>>> 
>>> Nabila
>>> 
>>>[[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.
> 
> __
> 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.

David Winsemius
Alameda, CA, USA

__
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] Marg.fct function

2017-02-06 Thread James Henson
Greetings Peter and Jeff,

Thanks for this information.  Will try these type of analyses in SAS.
Sure they are doable in R, but developing a procedure is difficult.
Alan Agresti gives a cookbook SAS method in An Introduction to
Categorical Analysis.

Thanks,
James

On Sun, Feb 5, 2017 at 3:47 PM, Jeff Newmiller  wrote:
> It is not part of "R". You can dig through all of the packages that the 
> author mentions,  or send an email to the author.
> --
> Sent from my phone. Please excuse my brevity.
>
> On February 5, 2017 11:44:40 AM PST, James Henson  wrote:
>>Greetings R Community,
>>
>>An attempt to reproduce the results from code in the source below
>>fails.  R cannot find the function ‘Marg.fct’. An Internet search for
>>the ‘Marg.fct’ function was not fruitful.  I appreciate your help.
>>Best regards, James F. Henson.
>>
>>R (and S-PLUS) Manual to Accompany Agresti’s Categorical Data Analysis
>>(2002) 2nd edition Laura A. Thompson, 2009©
>>
>>http://www.stat.ufl.edu/~aa/cda/Thompson_manual.pdf  page 181
>>
>>The code is:
>>
>># Code from Manual to Accompany Agresti’s Categorical Data Analysis
>>(2002) 2nd edition Laura A. Thompson, 2009
>>
>>y <- c(144, 33, 84, 126, 2, 4, 14, 29, 0, 2, 6, 25, 0, 0, 1, 5)
>>
>>ZF <- Z <- matrix(1,16,1)
>>
>>#
>>
>>M1 <- Marg.fct(1,rep(4,2)) # used to get m1+, etc
>>
>>Error: could not find function "Marg.fct"
>>
>>
>>
>>M2 <- Marg.fct(2,rep(4,2)) # used to get m+1, etc
>>
>>#
>>
>>C.matrix <- matrix(c(
>>
>>  1, 0, 0, 0, -1, 0, 0, 0, # y1+ = y+1
>>
>>  0, 1, 0, 0, 0, -1, 0, 0, # y2+ = y+2
>>
>>  0, 0, 1, 0, 0, 0, -1, 0), # y3+ = y+3
>>
>>  3,8,byrow=T)
>>
>>h.fct <- function(m) { # constraint function
>>
>> marg <- rbind(M1%*%m, M2%*%m) # y1+, y2+, y3+, y4+, y+1, y+2, y+3, y+4
>>
>>  C.matrix%*%marg # y1+ = y+1, y2+ = y+2, etc
>>
>>}
>>
>>#
>>
>>a <- mph.fit(y=y,Z=Z,ZF=ZF,h.fct=h.fct)
>>
>>mph.summary(a)
>>
>>__
>>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] regex [:digit:] gives diffrent result

2017-02-06 Thread William Dunlap via R-help
Shouldn't your "[:digit:]" be "[[:digit:]]"?
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Mon, Feb 6, 2017 at 10:36 AM, Tilmann Faul  wrote:
> Using R is a grate advantage, thanks for your work.
>
> Using regex under R 3.1.1, Debian 8.6 jessy works fine.
>
> str_detect("16-03-08", "[:digit:]{2}")
> [1] TRUE
> str_detect("16-03-08", "[0-9]{2}")
> [1] TRUE
>
> runing the same code under R 3.3.2 backport, Debian 8.6 jessy gives a
> different result. This is also a different computer.
>
> str_detect("16-03-08", "[:digit:]{2}")
> [1] FALSE
> str_detect("16-03-08", "[0-9]{2}")
> [1] TRUE
>
> Is this intended?
> My workaround is using [0-9] instead of [:digit:].
>
> Thanks
> Tilmann
>
> __
> 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] regex [:digit:] gives diffrent result

2017-02-06 Thread Tilmann Faul
Using R is a grate advantage, thanks for your work.

Using regex under R 3.1.1, Debian 8.6 jessy works fine.

str_detect("16-03-08", "[:digit:]{2}")
[1] TRUE
str_detect("16-03-08", "[0-9]{2}")
[1] TRUE

runing the same code under R 3.3.2 backport, Debian 8.6 jessy gives a
different result. This is also a different computer.

str_detect("16-03-08", "[:digit:]{2}")
[1] FALSE
str_detect("16-03-08", "[0-9]{2}")
[1] TRUE

Is this intended?
My workaround is using [0-9] instead of [:digit:].

Thanks
Tilmann

__
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] roxygen2 v6.0.0

2017-02-06 Thread Marc Girondot via R-help

Le 06/02/2017 à 17:14, Yihui Xie a écrit :

If your package source is version controlled (meaning you are free to
regret any time), I'd recommend you to delete the three files
NAMESPACE, chr.Rd, and essai-package.Rd. Then try to roxygenize again.
Basically the warnings you saw indicates that roxygen2 failed to find
the line

% Generated by roxygen2: do not edit by hand

in your NAMESPACE and .Rd files, so it thinks these files were
probably not previously generated by roxygen2. I think the cause is
package.skeleton(), which generated the Rd files. Seriously, friends
don't let friends use package.skeleton()... (it is 2017 now)
Thanks ! It works perfectly after removing the /man/ folder and the 
NAMESPACE file.

I didn't know that package.skeleton() was out-of-age !
That's true that it is easy to generate the skeleton manually.

Marc


Regards,
Yihui
--
Yihui Xie 
Web: http://yihui.name


On Mon, Feb 6, 2017 at 9:46 AM, Marc Girondot via R-help
 wrote:

Hi,

I used roxygen2 v5.0.1 to document my package, and all was ok. I have just
updated to roxygen2 v6.0.0 and my script is broken and I can't find why.

I have done a simple version of a package folder as a test with 3 files:
chr.R, essai-package.R and DESCRIPTION.

Previously, I did:

package.skeleton("essai",code_files=c('chr.R',"essai-package.R"))
roxygenize("essai")
system(paste0("R CMD build '", getwd(), "/essai'"))
install.packages(file.path(getwd(), "essai_1.0.tar.gz"), repos = NULL,
type="source")

And it worked well.

Now I get an error at the second line: roxygenize("essai")


roxygenize("essai")

First time using roxygen2. Upgrading automatically...
Updating roxygen version in
/Users/marcgirondot/Documents/Espace_de_travail_R/Package_Essai/essai/DESCRIPTION
Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and
will not be overwritten.
Warning: The existing 'chr.Rd' file was not generated by roxygen2, and will
not be overwritten.
Warning: The existing 'essai-package.Rd' file was not generated by roxygen2,
and will not be overwritten.

And of course it fails after.

Are you aware of this situation ? And do you have a solution ?

Thanks a lot

Marc


A file DESCRIPTION:

Package: essai
Type: Package
Title: Package Used For Try
Version: 1.0
Date: 2017-02-06
Author: Marc Girondot 
Maintainer: Marc Girondot 
Description: Trying package.
Depends: R (>= 2.14.2)
License: GPL-2
LazyData: yes
LazyLoad: yes
Encoding: UTF-8
RoxygenNote: 6.0.0

A file essai-package.R (essai=try in French):

#' Trying package
#'
#' \tabular{ll}{
#'  Package: \tab essai\cr
#'  Type: \tab Package\cr
#'  Version: \tab 1.0 - build 1\cr
#'  Date: \tab 2017-02-06\cr
#'  License: \tab GPL (>= 2)\cr
#'  LazyLoad: \tab yes\cr
#'  }
#' @title The package essai
#' @author Marc Girondot \email{marc.girondot@@u-psud.fr}
#' @docType package
#' @name essai-package

NULL

A file chr.R:

#' chr returns the characters defined by the codes
#' @title Return the characters defined by the codes
#' @author Based on this blog:
http://datadebrief.blogspot.com/2011/03/ascii-code-table-in-r.html
#' @return A string with characters defined by the codes
#' @param n The vector with codes
#' @description Return a string with characters defined by the codes.
J'essaye avec un code utf-8: ê.
#' @examples
#' chr(65:75)
#' chr(unlist(tapply(144:175, 144:175, function(x) {c(208, x)})))
#' @encoding UTF-8
#' @export


chr <- function(n) {
 rawToChar(as.raw(n))
 }

__
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 interpret t.test output

2017-02-06 Thread Jeff Newmiller
Perhaps someone could, but:

1) It is normal on public Internet mailing lists and forums to simply ask the 
actual question and let people respond if they know the answer, rather than 
asking for permission to ask.

2) You should read the Posting Guide for this mailing list... your question 
does not appear to fit the subject area for this mailing list, as it is about 
interpreting statistical computation results (statistics) rather than using R 
to obtain them (R). Perhaps try stats.stackexchange.com?
-- 
Sent from my phone. Please excuse my brevity.

On February 6, 2017 6:46:54 AM PST, "Gardee, Somayya" 
 wrote:
>Hello for my project I am trying to write up my results from the paired
>t-test I conducted.
>Please could someone help.
>
>Thank you,
>Somayya Gardee
>
>NHSGG&C Disclaimer
>
>The information contained within this e-mail and in any attachment is
>confidential and may be privileged. If you are not the intended
>recipient, please destroy this message, delete any copies held on your
>systems and notify the sender immediately; you should not retain, copy
>or use this e-mail for any purpose, nor disclose all or any part of its
>content to any other person.
>
>All messages passing through this gateway are checked for viruses, but
>we strongly recommend that you check for viruses using your own virus
>scanner as NHS Greater Glasgow & Clyde will not take responsibility for
>any damage caused as a result of virus infection.
>
>**
>__
>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] Beginner needs help with R

2017-02-06 Thread Jeff Newmiller
I think it is important to point out that whenever R treats a number as a 
numeric (integer or double) it loses any base 10 concept of "leading zero" in 
that internal representation, so in this expression

seq2 <- paste0("DQ", sprintf("%06d", seq(060054, 060060)))

the arguments to seq have leading zeros that are ignored by R and have nothing 
to do with getting the desired output. That is,  the same result can be 
obtained using

seq2 <- paste0("DQ", sprintf("%06d", seq(60054, 60060)))

or

seq2 <- paste0("DQ", sprintf("%06d", seq(0060054, 00060060)))

since only the zero inside the format string is key to success. (If it makes 
you more comfortable to put the zero there for readability that is your choice, 
but R ignores therm.)

Also note that the paste0 function is not needed when you use sprintf:

seq2 <- sprintf("DQ%06d", seq(60054, 60060))

or

myprefix <- "DQ"
seq2 <- sprintf("%s%06d", myprefix,seq(60054, 60060))

-- 
Sent from my phone. Please excuse my brevity.

On February 6, 2017 5:45:43 AM PST, jim holtman  wrote:
>You need the leading zeros, and 'numerics' just give the number without
>leading zeros.  You can use 'sprintf' for create a character string
>with
>the leading zeros:
>
>> # this is using 'numeric' and drops leading zeros
>>
>> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>> seq1
>[1] "DQ60054" "DQ60055" "DQ60056" "DQ60057" "DQ60058" "DQ60059"
>"DQ60060"
>>
>> # use 'sprintf' to create leading zeros
>> seq2 <- paste0("DQ", sprintf("%06d", seq(060054, 060060)))
>> seq2
>[1] "DQ060054" "DQ060055" "DQ060056" "DQ060057" "DQ060058" "DQ060059"
>"DQ060060"
>>
>
>
>Jim Holtman
>Data Munger Guru
>
>What is the problem that you are trying to solve?
>Tell me what you want to do, not how you want to do it.
>
>On Sun, Feb 5, 2017 at 8:50 PM, Nabila Arbi
>
>wrote:
>
>> Dear R-Help Team!
>>
>> I have some trouble with R. It's probably nothing big, but I can't
>find a
>> solution.
>> My problem is the following:
>> I am trying to download some sequences from ncbi using the ape
>package.
>>
>> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>>
>> sequences <- read.GenBank(seq1,
>> seq.names = seq1,
>> species.names = TRUE,
>> gene.names = FALSE,
>> as.character = TRUE)
>>
>> write.dna(sequences, "mysequences.fas", format = "fasta")
>>
>> My problem is, that R doesn't take the whole sequence number as
>"060054"
>> but it puts it as DQ60054 (missing the zero in the beginning, which
>is
>> essential).
>>
>> Could please tell me, how I can get R to accepting the zero in the
>> beginning of the accession number?
>>
>> Thank you very much in advance and all the best!
>>
>> Nabila
>>
>> [[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.

__
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] roxygen2 v6.0.0

2017-02-06 Thread Yihui Xie
If your package source is version controlled (meaning you are free to
regret any time), I'd recommend you to delete the three files
NAMESPACE, chr.Rd, and essai-package.Rd. Then try to roxygenize again.
Basically the warnings you saw indicates that roxygen2 failed to find
the line

% Generated by roxygen2: do not edit by hand

in your NAMESPACE and .Rd files, so it thinks these files were
probably not previously generated by roxygen2. I think the cause is
package.skeleton(), which generated the Rd files. Seriously, friends
don't let friends use package.skeleton()... (it is 2017 now)

Regards,
Yihui
--
Yihui Xie 
Web: http://yihui.name


On Mon, Feb 6, 2017 at 9:46 AM, Marc Girondot via R-help
 wrote:
> Hi,
>
> I used roxygen2 v5.0.1 to document my package, and all was ok. I have just
> updated to roxygen2 v6.0.0 and my script is broken and I can't find why.
>
> I have done a simple version of a package folder as a test with 3 files:
> chr.R, essai-package.R and DESCRIPTION.
>
> Previously, I did:
>
> package.skeleton("essai",code_files=c('chr.R',"essai-package.R"))
> roxygenize("essai")
> system(paste0("R CMD build '", getwd(), "/essai'"))
> install.packages(file.path(getwd(), "essai_1.0.tar.gz"), repos = NULL,
> type="source")
>
> And it worked well.
>
> Now I get an error at the second line: roxygenize("essai")
>
>> roxygenize("essai")
> First time using roxygen2. Upgrading automatically...
> Updating roxygen version in
> /Users/marcgirondot/Documents/Espace_de_travail_R/Package_Essai/essai/DESCRIPTION
> Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and
> will not be overwritten.
> Warning: The existing 'chr.Rd' file was not generated by roxygen2, and will
> not be overwritten.
> Warning: The existing 'essai-package.Rd' file was not generated by roxygen2,
> and will not be overwritten.
>
> And of course it fails after.
>
> Are you aware of this situation ? And do you have a solution ?
>
> Thanks a lot
>
> Marc
>
>
> A file DESCRIPTION:
>
> Package: essai
> Type: Package
> Title: Package Used For Try
> Version: 1.0
> Date: 2017-02-06
> Author: Marc Girondot 
> Maintainer: Marc Girondot 
> Description: Trying package.
> Depends: R (>= 2.14.2)
> License: GPL-2
> LazyData: yes
> LazyLoad: yes
> Encoding: UTF-8
> RoxygenNote: 6.0.0
>
> A file essai-package.R (essai=try in French):
>
> #' Trying package
> #'
> #' \tabular{ll}{
> #'  Package: \tab essai\cr
> #'  Type: \tab Package\cr
> #'  Version: \tab 1.0 - build 1\cr
> #'  Date: \tab 2017-02-06\cr
> #'  License: \tab GPL (>= 2)\cr
> #'  LazyLoad: \tab yes\cr
> #'  }
> #' @title The package essai
> #' @author Marc Girondot \email{marc.girondot@@u-psud.fr}
> #' @docType package
> #' @name essai-package
>
> NULL
>
> A file chr.R:
>
> #' chr returns the characters defined by the codes
> #' @title Return the characters defined by the codes
> #' @author Based on this blog:
> http://datadebrief.blogspot.com/2011/03/ascii-code-table-in-r.html
> #' @return A string with characters defined by the codes
> #' @param n The vector with codes
> #' @description Return a string with characters defined by the codes.
> J'essaye avec un code utf-8: ê.
> #' @examples
> #' chr(65:75)
> #' chr(unlist(tapply(144:175, 144:175, function(x) {c(208, x)})))
> #' @encoding UTF-8
> #' @export
>
>
> chr <- function(n) {
> rawToChar(as.raw(n))
> }
>
> __
> 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] roxygen2 v6.0.0

2017-02-06 Thread Marc Girondot via R-help

Hi,

I used roxygen2 v5.0.1 to document my package, and all was ok. I have 
just updated to roxygen2 v6.0.0 and my script is broken and I can't find 
why.


I have done a simple version of a package folder as a test with 3 files: 
chr.R, essai-package.R and DESCRIPTION.


Previously, I did:

package.skeleton("essai",code_files=c('chr.R',"essai-package.R"))
roxygenize("essai")
system(paste0("R CMD build '", getwd(), "/essai'"))
install.packages(file.path(getwd(), "essai_1.0.tar.gz"), repos = NULL, 
type="source")


And it worked well.

Now I get an error at the second line: roxygenize("essai")

> roxygenize("essai")
First time using roxygen2. Upgrading automatically...
Updating roxygen version in 
/Users/marcgirondot/Documents/Espace_de_travail_R/Package_Essai/essai/DESCRIPTION
Warning: The existing 'NAMESPACE' file was not generated by roxygen2, 
and will not be overwritten.
Warning: The existing 'chr.Rd' file was not generated by roxygen2, and 
will not be overwritten.
Warning: The existing 'essai-package.Rd' file was not generated by 
roxygen2, and will not be overwritten.


And of course it fails after.

Are you aware of this situation ? And do you have a solution ?

Thanks a lot

Marc


A file DESCRIPTION:

Package: essai
Type: Package
Title: Package Used For Try
Version: 1.0
Date: 2017-02-06
Author: Marc Girondot 
Maintainer: Marc Girondot 
Description: Trying package.
Depends: R (>= 2.14.2)
License: GPL-2
LazyData: yes
LazyLoad: yes
Encoding: UTF-8
RoxygenNote: 6.0.0

A file essai-package.R (essai=try in French):

#' Trying package
#'
#' \tabular{ll}{
#'  Package: \tab essai\cr
#'  Type: \tab Package\cr
#'  Version: \tab 1.0 - build 1\cr
#'  Date: \tab 2017-02-06\cr
#'  License: \tab GPL (>= 2)\cr
#'  LazyLoad: \tab yes\cr
#'  }
#' @title The package essai
#' @author Marc Girondot \email{marc.girondot@@u-psud.fr}
#' @docType package
#' @name essai-package

NULL

A file chr.R:

#' chr returns the characters defined by the codes
#' @title Return the characters defined by the codes
#' @author Based on this blog: 
http://datadebrief.blogspot.com/2011/03/ascii-code-table-in-r.html

#' @return A string with characters defined by the codes
#' @param n The vector with codes
#' @description Return a string with characters defined by the codes. 
J'essaye avec un code utf-8: ê.

#' @examples
#' chr(65:75)
#' chr(unlist(tapply(144:175, 144:175, function(x) {c(208, x)})))
#' @encoding UTF-8
#' @export


chr <- function(n) {
rawToChar(as.raw(n))
}

__
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 interpret t.test output

2017-02-06 Thread Gardee, Somayya
Hello for my project I am trying to write up my results from the paired t-test 
I conducted.
Please could someone help.

Thank you,
Somayya Gardee

NHSGG&C Disclaimer

The information contained within this e-mail and in any attachment is
confidential and may be privileged. If you are not the intended
recipient, please destroy this message, delete any copies held on your
systems and notify the sender immediately; you should not retain, copy
or use this e-mail for any purpose, nor disclose all or any part of its
content to any other person.

All messages passing through this gateway are checked for viruses, but
we strongly recommend that you check for viruses using your own virus
scanner as NHS Greater Glasgow & Clyde will not take responsibility for
any damage caused as a result of virus infection.

**
__
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] Beginner needs help with R

2017-02-06 Thread Adrian Dușa
Two methods, among others:

seq1 <- paste("DQ", sprintf("%0*d", 6, seq(060054, 060060)), sep = "")

or

seq1 <- paste("DQ", formatC(seq(060054, 060060), dig = 5, flag = 0), sep =
"")

Hth,
Adrian


On Mon, Feb 6, 2017 at 3:50 AM, Nabila Arbi 
wrote:

> Dear R-Help Team!
>
> I have some trouble with R. It's probably nothing big, but I can't find a
> solution.
> My problem is the following:
> I am trying to download some sequences from ncbi using the ape package.
>
> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>
> sequences <- read.GenBank(seq1,
> seq.names = seq1,
> species.names = TRUE,
> gene.names = FALSE,
> as.character = TRUE)
>
> write.dna(sequences, "mysequences.fas", format = "fasta")
>
> My problem is, that R doesn't take the whole sequence number as "060054"
> but it puts it as DQ60054 (missing the zero in the beginning, which is
> essential).
>
> Could please tell me, how I can get R to accepting the zero in the
> beginning of the accession number?
>
> Thank you very much in advance and all the best!
>
> Nabila
>
> [[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.
>



-- 
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr. 90-92
050663 Bucharest sector 5
Romania

[[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] Beginner needs help with R

2017-02-06 Thread jim holtman
You need the leading zeros, and 'numerics' just give the number without
leading zeros.  You can use 'sprintf' for create a character string with
the leading zeros:

> # this is using 'numeric' and drops leading zeros
>
> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
> seq1
[1] "DQ60054" "DQ60055" "DQ60056" "DQ60057" "DQ60058" "DQ60059" "DQ60060"
>
> # use 'sprintf' to create leading zeros
> seq2 <- paste0("DQ", sprintf("%06d", seq(060054, 060060)))
> seq2
[1] "DQ060054" "DQ060055" "DQ060056" "DQ060057" "DQ060058" "DQ060059"
"DQ060060"
>


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Sun, Feb 5, 2017 at 8:50 PM, Nabila Arbi 
wrote:

> Dear R-Help Team!
>
> I have some trouble with R. It's probably nothing big, but I can't find a
> solution.
> My problem is the following:
> I am trying to download some sequences from ncbi using the ape package.
>
> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>
> sequences <- read.GenBank(seq1,
> seq.names = seq1,
> species.names = TRUE,
> gene.names = FALSE,
> as.character = TRUE)
>
> write.dna(sequences, "mysequences.fas", format = "fasta")
>
> My problem is, that R doesn't take the whole sequence number as "060054"
> but it puts it as DQ60054 (missing the zero in the beginning, which is
> essential).
>
> Could please tell me, how I can get R to accepting the zero in the
> beginning of the accession number?
>
> Thank you very much in advance and all the best!
>
> Nabila
>
> [[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] Beginner needs help with R

2017-02-06 Thread Ivan Calandra

Hi Nabila,

This is because you ask to create a sequence with seq(), which does not 
make much sense with non numeric data. That's why R trims the 0.


One alternative would be:
seq2 <- paste("DQ0", seq(60054, 60060), sep = "")

Would that work for you?

HTH,
Ivan

--
Ivan Calandra, PhD
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
calan...@rgzm.de
+49 (0) 2631 9772-243
https://www.researchgate.net/profile/Ivan_Calandra
https://rgzm.academia.edu/IvanCalandra
https://publons.com/author/705639/

On 06/02/2017 02:50, Nabila Arbi wrote:

Dear R-Help Team!

I have some trouble with R. It's probably nothing big, but I can't find a
solution.
My problem is the following:
I am trying to download some sequences from ncbi using the ape package.

seq1 <- paste("DQ", seq(060054, 060060), sep = "")

sequences <- read.GenBank(seq1,
seq.names = seq1,
species.names = TRUE,
gene.names = FALSE,
as.character = TRUE)

write.dna(sequences, "mysequences.fas", format = "fasta")

My problem is, that R doesn't take the whole sequence number as "060054"
but it puts it as DQ60054 (missing the zero in the beginning, which is
essential).

Could please tell me, how I can get R to accepting the zero in the
beginning of the accession number?

Thank you very much in advance and all the best!

Nabila

[[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] Beginner needs help with R

2017-02-06 Thread Adams, Jean
Try this:

seq1 <- paste("DQ0", seq(60054, 60060), sep = "")

Jean

On Sun, Feb 5, 2017 at 7:50 PM, Nabila Arbi 
wrote:

> Dear R-Help Team!
>
> I have some trouble with R. It's probably nothing big, but I can't find a
> solution.
> My problem is the following:
> I am trying to download some sequences from ncbi using the ape package.
>
> seq1 <- paste("DQ", seq(060054, 060060), sep = "")
>
> sequences <- read.GenBank(seq1,
> seq.names = seq1,
> species.names = TRUE,
> gene.names = FALSE,
> as.character = TRUE)
>
> write.dna(sequences, "mysequences.fas", format = "fasta")
>
> My problem is, that R doesn't take the whole sequence number as "060054"
> but it puts it as DQ60054 (missing the zero in the beginning, which is
> essential).
>
> Could please tell me, how I can get R to accepting the zero in the
> beginning of the accession number?
>
> Thank you very much in advance and all the best!
>
> Nabila
>
> [[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.


[R] What does ksmooth() do that NadarayaWatsonkernel() does not?

2017-02-06 Thread Jesper Hybel Pedersen


What does the function ksmooth() to correct bias? Reading articles gives me the 
formula:

\frac{$B-t(B^n_{i=1}K_h(x-x_i)y_i}{$B-t(B^n_{j=1}K_h(x-x_j)}

For the Nadaray-Watson estimator. The same formula is stated in the 
documentation for the function:

NadarayaWatsonkernel(x, y, h, gridpoint)

>From the bbemkr-package (see ?NadarayaWatsonkernel). However this is not what 
>the ksmooth()
function does as shown by the incompatibility of the followingly methods of 
calculation:


if (!require(bbemkr)) {install.packages("bbemkr")}

N = 100
x = rnorm(N)
y = 2 * x + rnorm(N)


# Manual implementation of Nadaray-Watson
y_fitted = rep(0,N)
w = y_fitted
lambda = 1
for (h in 1:N)
   {
  for (i in 1:N)

  {

 w[i] = dnorm((x[i]-x[h]),sd=lambda)
  y_fitted[h] = 
y_fitted[h] + y[i] * w[i]

  }
  y_fitted[h] = 
y_fitted[h]/sum(w)
   }

nw.bbemkr = NadarayaWatsonkernel(x, y, lambda, x)
ks.stats = ksmooth(x,y,kernel="normal",bandwidth=lambda,x.points=x)

plot( x, y)
points( x , y_fitted , col="blue")  # From the manual implementation
points( nw.bbemkr$gridpoint+rnorm(N,sd=0.02), nw.bbemkr$mh,col="green") # From 
package bbemkr
points( ks.stats$x,ks.stats$y ,col="red")


The manual implementation is the same as the bbemkr package function 
NadarayaWatsonkernel()
But these are not the same as ksmooth() $B!D(B but still ksmooth() seems to 
result in better fit so I would like
To know what it does to achieve this better fit?


Best regards
Jesper Hybel Pedersen

[[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] Beginner needs help with R

2017-02-06 Thread Nabila Arbi
Dear R-Help Team!

I have some trouble with R. It's probably nothing big, but I can't find a
solution.
My problem is the following:
I am trying to download some sequences from ncbi using the ape package.

seq1 <- paste("DQ", seq(060054, 060060), sep = "")

sequences <- read.GenBank(seq1,
seq.names = seq1,
species.names = TRUE,
gene.names = FALSE,
as.character = TRUE)

write.dna(sequences, "mysequences.fas", format = "fasta")

My problem is, that R doesn't take the whole sequence number as "060054"
but it puts it as DQ60054 (missing the zero in the beginning, which is
essential).

Could please tell me, how I can get R to accepting the zero in the
beginning of the accession number?

Thank you very much in advance and all the best!

Nabila

[[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] [R-pkgs] usmap v 0.1.0 released

2017-02-06 Thread Paolo Di Lorenzo
Hello useRs,

I am announcing the release of my first package, usmap (
http://cran.r-project.org/package=usmap).

"usmap" is a package to aid in the creation of US choropleths that include
Alaska and Hawaii. It is still in its early stages (v 0.1.0) but I hope to
improve it with added functionality over time.

Features can be seen in the vignettes here:
https://cran.r-project.org/web/packages/usmap/vignettes/introduction.html
https://cran.r-project.org/web/packages/usmap/vignettes/mapping.html

Feel free to contribute ideas and code: http://github.com/pdil/usmap

If you have any questions please email me at pa...@dilorenzo.pl or message
me on Twitter @dilorenzopl .

Thank you,

Paolo Di Lorenzo
http://dilorenzo.pl
pa...@dilorenzo.pl // dilorenz...@gmail.com

[[alternative HTML version deleted]]

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

__
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.