Re: [R] WG: Fw: Re: dplyr : row total for all groups in dplyr summarise

2016-07-06 Thread Jeff Newmiller
Cut and paste is not to blame... it is the use of word processing software rather than text editors for manipulating code that is the problem. Georg: note that plyr does not mix very well with dplyr... try to pick one and stick with it. -- Sent from my phone. Please excuse my brevity. On Jul

Re: [R] dplyr : row total for all groups in dplyr summarise

2016-07-06 Thread Jeff Newmiller
My point is that this is highly software-dependent. Certain email programs and editors are worse than others in inclusion of configuration settings that allow you to avoid this problem. In general you need to look for "plain text" options, and some software has "Auto-Correct" options turned on b

[R] Checking for modality (R - circular)

2016-07-06 Thread Jeff Reichman
R Users Is there a way to check for modality using the "circular" package in R or any other package ? Circular time data. Jeff [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIB

Re: [R] Bessel function dll file use in VBA

2016-07-07 Thread Jeff Newmiller
This is not a VBA support forum. You need to be studying VBA linkage requirements and gcc linkage conventions, and neither of these subject areas are on topic in R-help. -- Sent from my phone. Please excuse my brevity. On July 7, 2016 5:27:02 AM PDT, "Mehta, Gaurang" wrote: >Hi Team, >I am tr

Re: [R] netcdf data precision or least significant digit

2016-07-07 Thread Jeff Newmiller
Same as with any floating point numeric computation environment... you don't. There is always uncertainty in any floating point number... it is just larger in this data than you might be used to. Once you get to the stage where you want to output values, read up on ?round ?par (digits) and don

Re: [R] netcdf data precision or least significant digit

2016-07-07 Thread Jeff Newmiller
Correction: ?options (not par) -- Sent from my phone. Please excuse my brevity. On July 7, 2016 3:26:06 PM PDT, Jeff Newmiller wrote: >Same as with any floating point numeric computation environment... you >don't. There is always uncertainty in any floating point number... it >

Re: [R] WRS2 package problems with post hoc test lincon

2016-07-08 Thread Jeff Newmiller
1) HTML formatted email does not come through reliably. Please read the Posting Guide. 2) It is very nearly always necessary to provide a reproducible example when asking for help on this list to avoid complete failure to communicate. 3) Given the above limitations (meaning I may not be under

Re: [R] How to make the "apply" faster

2016-07-09 Thread Jeff Newmiller
function(y) {sum(y>=70)} -- Sent from my phone. Please excuse my brevity. On July 9, 2016 1:19:27 PM PDT, Debasish Pai Mazumder wrote: >I have 4-dimension array x(lat,lon,time,var) > >I am using "apply" to calculate over time > new = apply(x,c(1,2,4),FUN=function(y) {length(which(y>=70))}) > >Th

Re: [R] [FORGED] Regression with factors ?

2016-07-09 Thread Jeff Newmiller
I have seen less sensical questions. It would be nice if the example were a bit more complete (as in it should have excess degrees of freedom and an answer) and less like a homework problem (which are off topic here). It would of course also be helpful if the OP were to conform to the Posting G

Re: [R] Help- Converting the ODE equation to fuzzy logic in R

2016-07-10 Thread Jeff Newmiller
The only reason I can imagine for such a "need" is that you have been assigned homework and there is a no-homework policy on this list. That said, Google came up with at least one hit when I looked. You really ought to read the Posting Guide before posting again. -- Sent from my phone. Please

Re: [R] [FORGED] Regression with factors ?

2016-07-11 Thread Jeff Newmiller
values of the >factor-levels and numerical values for the multiplier (f) and the >offset (o), with p1 and p2 given as names (here: persons) and y given >as some level of achievement they reach by cooperating. > >y = f * ( o - ( p1 - p2 )^2 ) > >Is that what you meant by "answ

Re: [R] [FORGED] Regression with factors ?

2016-07-13 Thread Jeff Newmiller
s://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. --- Jeff Newmiller

Re: [R] Forking and adapting an R package

2016-07-14 Thread Jeff Newmiller
1) Although it can be as easy as this, when you are dealing with packages the complications of namespaces may prevent your modified version of the function now in the global namespace from being used by other functions in the package. That is, you may have to redefine all of the interrelated fun

Re: [R] Selecting 1st and last dates from a set of dates

2016-07-14 Thread Jeff Newmiller
I suspect the answer to your question (is there a function...) is almost certainly yes, but your question is too vague to be sure. 1) Data frames and matrices are different in important ways... it is highly unlikely that matrices would be appropriate for date data. 2) Do you mean "select recor

Re: [R] Geom_smooth

2016-07-20 Thread Jeff Newmiller
No, it refers to confidence level. Refer to your training in statistics for that definition. -- Sent from my phone. Please excuse my brevity. On July 20, 2016 10:01:44 AM PDT, Tom Subia wrote: >Default level = 0.95. >Does this mean +/- 0.025 from estimate? > > [[alternative HTML version d

Re: [R] how to expand the dataframe

2016-07-20 Thread Jeff Newmiller
Look at the zoo or data.table packages. -- Sent from my phone. Please excuse my brevity. On July 20, 2016 1:31:26 PM PDT, lily li wrote: >Hi R users, > >I have a dataframe, where there is a column 'time' represents time >series >but is not complete. How to expand the dataframe so this column wi

Re: [R] PDF extraction with tm package

2016-07-22 Thread Jeff Newmiller
This is neither the Xpdf support forum nor the Windows Setup Program Reinvention support group... and you really need to read and follow the Posting Guide for the R mailing lists. FWIW I would guess that you need to learn about environment variables and in particular about the PATH variable. Th

Re: [R] Using C library in R

2016-07-22 Thread Jeff Newmiller
Read the Posting Guide. This will tell you at least two important things: 1) Post using plain text. HTML mangles code. 2) Interfacing R with other languages is off-topic on this list. There are other lists where such issues are on-topic. Your post is a bit like walking into a bowling alley and

Re: [R] Using C library in R

2016-07-22 Thread Jeff Newmiller
You are entitled to your opinion, but apparently you have not read the Posting Guide either. -- Sent from my phone. Please excuse my brevity. On July 22, 2016 6:00:19 PM PDT, Dirk Eddelbuettel wrote: >Jeff Newmiller dcn.davis.ca.us> writes: >> 2) Interfacing R with other lang

Re: [R] Improving performance by rewriting for loops into apply functions

2016-07-22 Thread Jeff Newmiller
If you complain to the doctor that it hurts when you ram your head into the wall, (s)he is going to tell you to not so that. What do you expect us to say? You seem full of misinformation. The apply family functions do not necessarily speed anything up... they are just more compact than for loop

Re: [R] knitr package error.

2016-07-26 Thread Jeff Newmiller
The mailing list allows very few types of attachments through to limit virus problems. You need to learn how to convey your problem as a reproducible sequence of R statements to get clear assistance here. [1] In this case, you may be confused between the interactive working environment (variab

Re: [R] Aggregate matrix in a 2 by 2 manor

2016-07-27 Thread Jeff Newmiller
An alternative (more compact, not necessarily faster, because apply is still a for loop inside): f <- function( m, nx, ny ) { # redefine the dimensions of my a <- array( m , dim = c( ny , nrow( m ) %/% ny , ncol( m ) %/% nx ) )

Re: [R] font size in graphs...can R read Windows settings?

2016-07-27 Thread Jeff Newmiller
What if it is being used on a platform other than Windows? This problem is more challenging than you seem to think it is. I would suggest including a kind of "par" argument to your function that lets the user change your defaults. -- Sent from my phone. Please excuse my brevity. On July 27, 2

Re: [R] Fuzzy variable universe

2016-07-28 Thread Jeff Newmiller
This appears to be a question about a contributed package, though you have not specified which one (so your example code is not reproducible). Be warned that I have never seen discussion of fuzzy logic on this list, so any help you get here is likely to be from someone reading the documentation

Re: [R] problems reading XML type file from ishares website

2016-07-28 Thread Jeff Newmiller
XLS has nothing to do with XML. The shift from XLS to XLSX/XLSM formats was where XML was introduced. You might occasionally find mislabelled files that seem to work anyway, but there is a significant difference inside true XLS files. Use a package designed to handle your data format. There ar

Re: [R] problems reading XML type file from ishares website

2016-07-28 Thread Jeff Newmiller
;- xmlTreeParse( "nobom.xml" ) -- Sent from my phone. Please excuse my brevity. On July 28, 2016 8:26:44 AM PDT, "Bos, Roger" wrote: >Jeff, > >Thanks for your suggestions. I mentioned XLS because that is the >extension the ishares website provides. I have tried

Re: [R] problems reading XML type file from ishares website

2016-07-28 Thread Jeff Newmiller
Er, I failed to include the step to write the repaired data to a file... fnamenobom <- "nobom.xml" cat( paste( txt, collapse="\n" ), file=fnamenobom ) xmlfile <- xmlTreeParse( fnamenobom ) -- Sent from my phone. Please excuse my brevity. On July 28, 2016 11:20

Re: [R] Subtraction with aggregate

2016-07-28 Thread Jeff Newmiller
What represents the difference when multiple values are present? sd? -- Sent from my phone. Please excuse my brevity. On July 28, 2016 1:40:16 PM PDT, Gang Chen wrote: >With the following data in data.frame: > >subject QMemotion yi > s1 75.1017 neutral -75.928276 > s2 -47.3512

Re: [R] How to pass na.rm=T to a user defined function

2016-07-28 Thread Jeff Newmiller
Why not remove it yourself before passing it to those functions? -- Sent from my phone. Please excuse my brevity. On July 28, 2016 5:51:47 PM PDT, Jun Shen wrote: >Dear list, > >I write a small function to calculate multiple stats on multiple >variables >and export in a format exactly the way I

Re: [R] EM algorithm for maximizing the likelihood of Multivariate Hawkes process

2016-07-28 Thread Jeff Newmiller
How did you try to find the answer before posting? Some possibilities might be go ogling [1] or perusing CRAN to find [2]... Note that HTML tends to mangle code... please follow the Posting Guide and send plain text email to this list. [1] http://bfy.tw/6y3o [2] https://cran.r-project.org/web/v

Re: [R] Reduce woes

2016-07-29 Thread Jeff Newmiller
Having experienced some frustration myself when I first started with R many years ago, I can relate to your apparent frustration. However, if you would like to succeed in using R I strongly recommend learning R and not trying to write Haskell or Erlang or C or Fortran or any other language when

Re: [R] %in% with matrix of lists

2016-07-30 Thread Jeff Newmiller
>> [1] TRUE FALSE TRUE FALSE ## NOT c(T,F,T,F) > >I'm not sure what you mean by NOT here. You get the same answer as I >do, as far as I can see. > # valid R T <- FALSE # invalid R TRUE <- FALSE It is much much safer and clearer to use TRUE/FALSE than T/F. So c( TRUE, FALSE, TRUE, FALSE ) ma

Re: [R] Aggregate matrix in a 2 by 2 manor

2016-07-30 Thread Jeff Newmiller
ncol(data)/nx) >+ } >> aggregate.nx.ny.expand.grid(tst.small) > [,1] [,2] [,3] [,4] >[1,] 3.5 11.5 19.5 27.5 >[2,] 5.5 13.5 21.5 29.5 >> >> aggregate.nx.ny.array.apply = function(data,nx=2,ny=2, FUN=mean,...) >{ >+ a <- array(data, dim = c(ny, nrow( d

Re: [R] Aggregate matrix in a 2 by 2 manor

2016-07-30 Thread Jeff Newmiller
3 3412.639 100 c # 9.191747 21.98528 10.30099 15.9169 158.687 100 a # 733.246331 936.73359 757.58383 844.2016 2824.557 100 b On Sat, 30 Jul 2016, Jeff Newmiller wrote: For the record, the array.apply code can be fixed as below, but then it is slower than the expand.grid version. a

Re: [R] Replace any values in a data frame based on another data frame

2016-07-30 Thread Jeff Newmiller
ve 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, se

Re: [R] Arcsine Tranformation.

2016-07-31 Thread Jeff Newmiller
o.nz/Reproducibility.html --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#.

Re: [R] Read output:

2016-08-02 Thread Jeff Newmiller
R could not find the specified file. Either it is not there or file system permissions (off topic here) prevented access to the file. -- Sent from my phone. Please excuse my brevity. On August 1, 2016 11:30:42 PM PDT, roslinazairimah zakaria wrote: >Dear r-usersl, > >I don't understand this c

Re: [R] What is "args" in this function?

2016-08-02 Thread Jeff Newmiller
Unfortunately for you, this email list is about R (not C), and while the Posting Guide indicates that questions discussing how to interface with C belong in R-devel, that is not a forum for learning C. On the plus side, the data types and macros you are asking questions about are highly specif

Re: [R] generate a vector of random numbers within confines of certain parameters

2016-08-02 Thread Jeff Newmiller
x <- rnorm( 2, 5, 2.5 ) The requirement for "random" is ill-specified because it omits mention of which random distribution you want (I assumed normal distribution above). The requirement for "decimal places" is ill-defined because floating point numbers are internally represented with mant

Re: [R] Plotting in LaTeX with ggplot2 in R and using tikzdevice

2016-08-03 Thread Jeff Newmiller
I would think knitr package would be useful in this endeavor. And possibly RStudio If that doesn't do it, someone here may have a better hint, but solving this kind of question can require studying both the input (R code) and output (tikz/LaTeX code). While the R code belongs here, details

Re: [R] R Server - Resource Manager

2016-08-09 Thread Jeff Newmiller
This service is normally implemented by the operating system against the logins, irrespective of the application those users choose to use. It is not part of R... so you should be looking for OS tools not R tools. -- Sent from my phone. Please excuse my brevity. On August 9, 2016 4:35:44 PM PD

Re: [R] R Package installation

2016-08-12 Thread Jeff Newmiller
Choose A Different Mirror -- Sent from my phone. Please excuse my brevity. On August 12, 2016 3:53:03 AM PDT, "Dayalan, Nithya" wrote: >Hi Team, > >We are receiving the below message while updating the package. Please >help. > >> install.packages("parallel", lib="D:/Program >Files/R/R-3.2.5/

Re: [R] R Package installation

2016-08-12 Thread Jeff Newmiller
This may not have anything to do with the OP's problem, but if permissions are an issue then it should be mentioned. One problem that some windows users encounter is thinking they should "Run As" administrator when installing or running R, rather than letting Windows UAE prompt them for privi

Re: [R] need some help with date

2016-08-14 Thread Jeff Newmiller
ot;, "NJ", "NY", "OH", "", "", "", "", "CA", "NY", "PA", "PA", "TN", "", "", "", "", "PA", "MD", &quo

Re: [R] Antwort: Accessing an object using a string (SOLVED)

2016-08-15 Thread Jeff Newmiller
Use of "get" usually means you are doing something wrong in setting up your approach to a problem. That is, if you design your interface to your functions to be overly general, it will become full of surprises later. If in fact the data you are interested in referring to is a column in a data

Re: [R] Antwort: Re: Accessing an object using a string

2016-08-16 Thread Jeff Newmiller
My example shows that using a dedicated environment allows you to segregate the items loaded from the save file from the objects you are working with. It has the advantage that any kind of object or collection of objects can be loaded that way. It has the disadvantage that you have to keep track

Re: [R] Error in riv package

2016-08-17 Thread Jeff Newmiller
Not our problem. Please correspond with the maintainer of that package. -- Sent from my phone. Please excuse my brevity. On August 17, 2016 3:23:33 AM PDT, Shivi Bhatia wrote: >Hi David, > >If this has loaded correctly then it still does not allow me to run >iv.multi command where a can add al

Re: [R] Creating dummy variable using ifelse statement while you also retain NA's

2016-08-17 Thread Jeff Newmiller
I cannot imagine why you would want ifelse to support an na.rm argument, and your phrase 'still retains the missing data denoted as "NA"' seems exactly how ifelse works anyway. You may need to study how NA values work... basic things like TRUE & NA ==NA and when you should use is.na(). The"Intr

Re: [R] R jobs on SLURM running on a single node only

2016-08-17 Thread Jeff Newmiller
Cross-posting [1] is not acceptable on R-help, particularly if you don't let reasonable time pass and inform us of the other posting. Topics not related to the R language are off-topic here (this is about slurm, not R). [1] http://stackoverflow.com/questions/38991287/r-jobs-on-slurm-running-on

Re: [R] enabling PAM in R for RODBC connections

2016-08-17 Thread Jeff Newmiller
There are at least four layers of software involved here: RODBC, ODBC, HS2 and PAM. If the question involved RODBC then R-sig-db would be a much better bet for relevant experience (see the Posting Guide). However, your question seems to be about getting ODBC to talk with HS2... a topic for whic

Re: [R] Problem detect cheating with CopyDetect Package

2016-08-17 Thread Jeff Newmiller
If we R users unfamiliar with the details of the CopyDetect package are to be able to help, we would need a reproducible example that includes data. See to http://www.catb.org/esr/faqs/smart-questions.html and http://adv-r.had.co.nz/Reproducibility.html for discussion on how to ask for help on

Re: [R] problem concernig Survsplit, package survival

2016-08-20 Thread Jeff Newmiller
Your link did not take me to the code you reference... Google does not make entire books available online which may have something to do with my difficulty. This is one reason the Posting Guide asks you to post a self-contained, reproducible example. Your use of HTML format in your posting to

Re: [R] autocorrelation function plot in lattice

2016-08-20 Thread Jeff Newmiller
Undoubtedly. Consider nlme::plot.ACF as one possibility. Roll your own is also feasible. -- Sent from my phone. Please excuse my brevity. On August 20, 2016 5:28:04 AM PDT, Naresh Gurbuxani wrote: >Using lattice package, is it possible to plot autocorrelation functions >similar to acf in sta

Re: [R] library Dplyr

2016-08-24 Thread Jeff Newmiller
This is not normal. I suggest making use of the maintainer() and sessionInfo() functions. -- Sent from my phone. Please excuse my brevity. On August 24, 2016 7:47:25 AM PDT, Partha Sinha wrote: >I am using windows 7 , R version 3.3.1 >whenever I am trying use >library(dplyr) >i am getting the

Re: [R] library Dplyr

2016-08-24 Thread Jeff Newmiller
: >[1] stats graphics grDevices utils datasets methods base > > >I tried to load ggplot2 and dplyr. >both giving me similar problems > >Parth > >On 24 August 2016 at 20:40, Jeff Newmiller >wrote: > >> This is not normal. I suggest making use of the

Re: [R] library Dplyr

2016-08-24 Thread Jeff Newmiller
rom my phone. Please excuse my brevity. On August 24, 2016 10:08:09 PM PDT, Partha Sinha wrote: >yes. I start a fresh session and start to load the library > > >On 25 August 2016 at 09:34, Jeff Newmiller >wrote: > >> And the only input you give to trigger this is >&g

Re: [R] Importint stata file and using value labels

2016-08-25 Thread Jeff Newmiller
You need to (re-)read the "Introduction to R" document that comes with R. R Is not Stata, and you should not expect R to look syntactically like Stata. Note that if you, against normal R convention, wish to manipulate the integers that a factor is implemented with, you can create such a variabl

Re: [R] parsing the file

2016-08-28 Thread Jeff Newmiller
Based on the discussion of ORing values with characters in [1] which may generate "unusual" characters I suspect a botched conversion from EBCDIC may have messed with some of the data. If there are signed data fields then OP may need to read the original file and treat it as if it were binary da

Re: [R] How to split a data.frame into its columns?

2016-08-28 Thread Jeff Newmiller
Need to re-read the "Introduction to R". Data frames ARE lists of columns. So to convert a matrix to a list of vectors use as.data.frame( m ) -- Sent from my phone. Please excuse my brevity. On August 28, 2016 11:14:20 PM PDT, Marius Hofert wrote: >Hi, > >I need a fast way to split a data.fra

Re: [R] loading .rda file

2016-08-30 Thread Jeff Newmiller
You cannot. However, you can load the file into a dedicated environment to keep those names separated from your global environment. e.g. [1] The saveRDS/loadRDS functions are an alternative handle one object at a time without dragging the object names into the picture (you have to name the re-l

Re: [R] loading .rda file

2016-08-30 Thread Jeff Newmiller
which requires keeping your search path in mind as you work to know when to use it). -- Sent from my phone. Please excuse my brevity. On August 30, 2016 10:12:32 AM PDT, Martin Maechler wrote: >>>>>> Jeff Newmiller >>>>>> on Tue, 30 Aug 2016 09:36:05 -

Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Jeff Newmiller
The "c" function creates vectors. Rows of data frames are data frames, not vectors. new_row <- data.frame( Prod_name = "Day_name", `Date 1`=1, `Date 2`=2,`Date 3`=3 ) data_may <- rbind( new_row, data_may ) Furthermore, data frames are NOT spreadsheets. "Day_num" looks suspiciously UNlike a

Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Jeff Newmiller
ll be able to show you how to do it correctly. [1] http://adv-r.had.co.nz/Reproducibility.html -- Sent from my phone. Please excuse my brevity. On September 4, 2016 8:28:39 AM PDT, Filippos Katsios wrote: >Dear Jeff, >I am sorry but I am not allowed to share the original data. You

Re: [R] Problem with adding a row in a data table

2016-09-04 Thread Jeff Newmiller
art ) %>% summarise( SumOfValues = sum( value ) ) ) # the group_by and summarise steps work together On Sun, 4 Sep 2016, Filippos Katsios wrote: Dear all, I believe that this will be a more helpful way to put the problem: structure(list(Prod_name = c("Banana", "Ap

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

2016-09-04 Thread Jeff Newmiller
Your opening assertion is false. Provide a reproducible example and someone will demonstrate. -- Sent from my phone. Please excuse my brevity. On September 4, 2016 9:06:59 PM PDT, Jun Shen wrote: >Dear list, > >I have a vector of strings that cannot be described by one pattern. So >let's say

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

2016-09-05 Thread Jeff Newmiller
n','mg.tx.cv') > >> sub("^.+?\\.(.+)\\.[^.]+$","\\1",z) >[1] "WT.CUT" "tx" > > >## seems to do what was requested. > >Jeff would have to amplify on his initial statement however: do you >mean that separate patterns can always be

Re: [R] Fwd: Splines

2016-09-05 Thread Jeff Newmiller
This is not the kind of thing people know off the top of their heads, and even if they do it is an ideal application of text search tools. Download the source and start looking. Don't neglect the licencing terms... your use of that code implies responsibilities on your part. -- Sent from my ph

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

2016-09-05 Thread Jeff Newmiller
I am not the one who proved this... I can only respond to your suggested counterexamples. -- Sent from my phone. Please excuse my brevity. On September 5, 2016 9:01:12 AM PDT, Bert Gunter wrote: >Jeff: > >It is not obvious to me that the ability to *match* an arbitrary >pattern (i

Re: [R] (no subject)

2016-09-06 Thread Jeff Newmiller
It is not the implementation of regex that requires double backslashes, but the R string parser. You can use cat to see what the pattern looks like to the parser. Try cat( "\\(.*?\\)" ) -- Sent from my phone. Please excuse my brevity. On September 6, 2016 6:33:15 AM PDT, Sarah Goslee wrote:

Re: [R] Factor analysis and time as an offset variable

2016-09-06 Thread Jeff Newmiller
That step is easy, but context is hard. You really need to provide a reproducible example. There are many models, many analysis tools, and many timescales to choose from. In fact, this could easily be mistaken for a question about statistics (not really on-topic here) since you have failed to

Re: [R] R-square prob is not calculated by randomization in lmPerm::lmp

2016-09-06 Thread Jeff Newmiller
That is contributed code. It could do anything the author felt like. I recommend reading the source code. -- Sent from my phone. Please excuse my brevity. On September 5, 2016 11:52:15 PM PDT, Agustin Lobo wrote: >Any reason why the R-square prob is not calculated by randomization in >lmPerm::

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

2016-09-06 Thread Jeff Newmiller
>> >>> replace this ** >>> > pat <- do.call(paste,c(as.list(pat), sep="|")) >>> >>> > sub(paste0("^[^b]*(",pat,").*$"),"\\1",z) >

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

2016-09-07 Thread Jeff Newmiller
way... please aim to make your examples reproducible. It would have been easy for you to define the necessary variables in example form rather than sending a non-reproducible example. On Tue, 6 Sep 2016, Jun Shen wrote: Hi Jeff, Thanks for the reply. I tried your suggestion and it doesn'

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

2016-09-07 Thread Jeff Newmiller
My error. However, Jun has been severely abusing them... such use is unusual, and the "(?:" non-capturing group marker was invented because the capture side effect is so central to the use of the regular parenthesis. On Tue, 6 Sep 2016, Bert Gunter wrote: Jeff: Not sure what yo

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

2016-09-07 Thread Jeff Newmiller
Many things are possible, especially if you read the Posting Guide which tells you you that questions involving compiling R belong on R-devel, not R-help. -- Sent from my phone. Please excuse my brevity. On September 7, 2016 1:17:10 AM PDT, Chinmay Borwankar wrote: >Hi, >I want to integrat

Re: [R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Jeff Newmiller
Should be working, so the devil is in the details you are not showing. Please provide a reproducible (self-contained) example [1] and post in plain text rather than HTML formatted email to avoid code corruption. [1] http://adv-r.had.co.nz/Reproducibility.html -- Sent from my phone. Please excu

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] 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] Apply a multi-variable function to a vector

2016-09-09 Thread Jeff Newmiller
Your architecture has a bad smell to me. For one thing you are mixing different units in the same vector but should be putting multiple instances of the same variable into one vector. Lists of vectors (data frames) are typically used when multiple variables need to be grouped. Another problem i

Re: [R] Apply a multi-variable function to a vector

2016-09-09 Thread Jeff Newmiller
es), 1, function(a) do.call(func2, as.list(a))) although this does work: do.call(func2, as.list(c(10, 121))) And, this also works: apply(expand.grid(temps,times), 1, function(a) do.call("+", as.list(a))) There is some subtlety here I don't understand. Thanks, Steve -Or

Re: [R] understanding with

2016-09-09 Thread Jeff Newmiller
_ 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, reproduci

Re: [R] Help with strftime error "character string is not in a standard unambiguous format"

2016-09-12 Thread Jeff Newmiller
Perhaps use the correct function. (Just one little letter off...) -- Sent from my phone. Please excuse my brevity. On September 11, 2016 10:57:39 PM PDT, Chris Evans wrote: >I am trying to read activity data created by Garmin. It outputs dates >like this: > >"Thu, 25 Aug 2016 6:34 PM" > >The pr

Re: [R] using a regular expression

2016-09-12 Thread Jeff Newmiller
If you think you might want to put this function into a package, it would be much better to use gsub instead of passing the job off to an external program, because non-POSIX operating systems (Windows) will be a headache to support. -- Sent from my phone. Please excuse my brevity. On September

Re: [R] Is this kind of removing of elements from data.frame (in)efficient?

2016-09-13 Thread Jeff Newmiller
Your example is not reproducible [1], so the apparent error in it is distracting... perhaps you meant kidmomhs <- kidmomhs[kidmomhs$kid_score != min(kidmomhs$kid_score),] yes, this creates a copy, and because the object name is re-used on the left side the original memory gets returned to the m

Re: [R] syntax to connect to linked SQL server using RODBC

2016-09-13 Thread Jeff Newmiller
This is not an R concept, and it may be highly specific to the SQL Server API rather than the ODBC API. You might try doing as the Posting Guide recommends and posting in the R-sig-db mailing list. I would also recommend that you figure out from Microsoft documentation what programming API your

Re: [R] Upgrade R 3.2 to 3.3 using tar.gz file on Ubuntu 16.04

2016-09-13 Thread Jeff Newmiller
For this query I would rather recommend [1] as reference, though Marc's suggestion to switch mailing lists is best. [1] https://cran.r-project.org/bin/linux/ubuntu/ -- Sent from my phone. Please excuse my brevity. On September 13, 2016 6:44:29 AM PDT, Loris Bennett wrote: >Luigi Marongiu wri

Re: [R] Upgrade R 3.2 to 3.3 using tar.gz file on Ubuntu 16.04

2016-09-14 Thread Jeff Newmiller
excuse my brevity. On September 13, 2016 10:57:52 PM PDT, Loris Bennett wrote: >Jeff Newmiller writes: > >> For this query I would rather recommend [1] as reference, though >> Marc's suggestion to switch mailing lists is best. >> >> [1] https://cran.r-project.o

Re: [R] gene name problem in Excel, and an R analogue

2016-09-14 Thread Jeff Newmiller
What, like the colClasses argument? Darn that ellipsis and its consequent deferred documentation... but it _is_ mentioned in passing in ?read.fwf. -- Sent from my phone. Please excuse my brevity. On September 13, 2016 10:54:44 PM PDT, Erich Neuwirth wrote: >Since many people commenting on the

Re: [R] Maximum # of DLLs reached, or, how to clean up after yourself?

2016-09-14 Thread Jeff Newmiller
I never detach packages. I rarely load more than 6 or 7 packages directly before restarting R. I frequently re-run my scripts in new R sessions to confirm reproducibility. -- Sent from my phone. Please excuse my brevity. On September 14, 2016 1:49:55 AM PDT, Alexander Shenkin wrote: >Hi Henr

Re: [R] dplyr or plyr or both?

2016-09-15 Thread Jeff Newmiller
The incorrect results are unfortunate and can trip up the inexperienced user, but this problem is straightforward to resolve if you explicitly specify which versions of the conflicting functions to use. The more interesting question I saw was whether the intent is to deprecate plyr, but so far t

Re: [R] dplyr or plyr or both?

2016-09-15 Thread Jeff Newmiller
not attach it, but use the plyr:: notation. >I agree that plyr is something else as dplyr, and unfortunately plyr >will be used for some time. > >Verzonden vanuit Mail voor Windows 10 > >Van: Jeff Newmiller __ R-help@r-project.org mail

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-15 Thread Jeff Newmiller
This question is missing pieces... the example is incomplete. -- Sent from my phone. Please excuse my brevity. On September 15, 2016 9:35:45 PM PDT, Manohar Reddy wrote: >Hi , > > > >I have data something looks like below (or PFA), but when I’m >extracting >month using *strftime* function th

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
SQLite only understands certain fundamental data types, and neither Date nor POSIXct types are among them. They get stored as their internal numeric representations. The internal numeric representations of Date and POSIXct are incompatible. You are sending Dates to SQLite and trying to then in

Re: [R] stfrtime function not returning proper results through sqldf package in R

2016-09-16 Thread Jeff Newmiller
has no date and time types. library(sqldf) DF <- data.frame(d = as.Date("2000-01-01")) sqldf("select d+1 as d from DF") # return next day d 1 2000-01-02 At the same time iif you really need to do serious date processing on the SQL side it's much easier wi

Re: [R] Accelerating binRead

2016-09-17 Thread Jeff Newmiller
Appending to lists is only very slightly more efficient than incremental rbinding. Ideally you can figure out an upper bound for number of records, preallocate a data frame of that size, modify each element as you go in-place, and shrink the data frame once at the end as needed. If you cannot do

Re: [R] Density plot error

2016-09-19 Thread Jeff Newmiller
You desperately need to read the Posting Guide mentioned at the bottom of every posting on this list. Avoid attachments (your code did not come through), keep sample data size minimal, don't reply to other topic messages (start a fresh email thread so your message doesn't get buried in other peo

Re: [R] Return the indices of rows of a data frame

2016-09-19 Thread Jeff Newmiller
What do you think? This is covered in the Introduction to R document that comes with R. -- Sent from my phone. Please excuse my brevity. On September 19, 2016 8:37:30 PM PDT, John wrote: >Hi, > > I have the following dataframe: > >> temp<-data.frame(a=c(1,1,2), b=2:4, c=1:3) >> row.names(temp)

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
I suppose you can do what works for your data, but I wouldn't recommend na.rm=TRUE because it hides problems rather than clarifying them. If in fact your data includes true NA values (the letters NA or simply nothing between the commas are typical ways this information may be indicated), then

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
dta$Discharge ) dta[ is.na( dta$DischargeNum ), "Discharge" ] -- Sent from my phone. Please excuse my brevity. On September 20, 2016 3:42:39 PM PDT, lily li wrote: >Thanks. Then what should I do to solve the problem? > >On Tue, Sep 20, 2016 at 4:30 PM, Jeff Newmiller > >wrot

Re: [R] about data problem

2016-09-20 Thread Jeff Newmiller
ting >numeric >>> to factor? Thanks a lot. >>> >>> >>> >>> On Tue, Sep 20, 2016 at 4:42 PM, lily li >wrote: >>> >>> > Thanks. Then what should I do to solve the problem? >>> > >>> > On Tue, Sep 20, 2016 at 4:3

<    2   3   4   5   6   7   8   9   10   11   >