Re: [R] Please help: cannot import files from Windows into R

2016-07-14 Thread William Dunlap via R-help
The file may have been stored in the UTF-16 encoding (what Windows Notepad calls "Unicode"). If so, adding fileEncoding="UTF-16" to the read.table command might read it correctly. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Jul 14, 2016 at 3:49 PM, Christa Rose wrote: > Can someone pl

Re: [R] Please help: cannot import files from Windows into R

2016-07-14 Thread John Dougherty
Christa, As others are noting, the file is not a text file. Open the file in Notebook or Notepad. If the editor complains, then open it in Word. Save it as a "plain text" file. You will have to choose the file type in the "Save As" dialog. You may run into other issues such as the field separ

Re: [R] Please help: cannot import files from Windows into R

2016-07-14 Thread Duncan Murdoch
On 14/07/2016 6:49 PM, Christa Rose wrote: Can someone please help? The read.table command is not working for me I think because Windows has my account name stored as "Christa Rose" with a space in it. Is this a problem? I have tried many syntax iterations, and cannot get around this. I don't t

Re: [R] Please help: cannot import files from Windows into R

2016-07-14 Thread Jim Lemon
Hi Christa, The error messages tell you that the file contains NULL characters, which can cause problems with reading files. You can remove these characters with a "hex editor". I am not familiar with those used on Windows, but look at this Web page: http://alternativeto.net/software/okteta/?platf

[R] Please help: cannot import files from Windows into R

2016-07-14 Thread Christa Rose
Can someone please help? The read.table command is not working for me I think because Windows has my account name stored as "Christa Rose" with a space in it. Is this a problem? I have tried many syntax iterations, and cannot get around this. Here is an example of the syntax I've used: > RanMinePl

[R] How to generate “aggregated” time lags?

2016-07-14 Thread Faradj Koliev
Dear all, I hope you’re enjoying your summer! I've been asked to "aggregate" my time lags from simple 1 year time lag to 1-3 year time lag. This could be done --I've been told --by simply taking the sum or mean of time lag 1,2, and 3. I need your help here. How can I generate this "aggrega

Re: [R] How to group by and get distinct rows of of grouped rows based on certain criteria

2016-07-14 Thread William Dunlap via R-help
> txt <- "|ATP Group|Business Event|Category| |02 |A |AC | |02 |A |AD | |02 |A |EQ | |ZM |A |AU | |ZM |A |AV | |ZM |A |AW | |02 |B |AC | |

Re: [R] How to group by and get distinct rows of of grouped rows based on certain criteria

2016-07-14 Thread Sarah Goslee
I took a wild guess as to what your data looked like (please use dput() to provide data, and please do not post in HTML), and took your request literally. Here's one way to approach the problem: mydat <- structure(list(ATP.Group = c("02", "02", "02", "ZM", "ZM", "ZM", "02", "02", "02"), Business

[R] How to group by and get distinct rows of of grouped rows based on certain criteria

2016-07-14 Thread Satish Vadlamani
Hello All: I would like to get your help on the following problem. I have the following data and the first row is the header. Spaces are not important. I want to find out distinct combinations of ATP Group and Business Event (these are the field names that you can see in the data below) that have

Re: [R] scatter3D and colours

2016-07-14 Thread Jorge I Velez
Thank you very much, Sarah, for your help. The colvar argument was certainly what I needed. I will follow your suggestion. Cheers, Jorge.- On Thu, Jul 14, 2016 at 1:29 PM, Sarah Goslee wrote: > I assume you want some variant of: > with(d0, scatter3D(X, Z, Y, bty = "b2", col = cols, colvar =

Re: [R] scatter3D and colours

2016-07-14 Thread Sarah Goslee
I assume you want some variant of: with(d0, scatter3D(X, Z, Y, bty = "b2", col = cols, colvar = c(1, 2, 3), pch = 20, cex = 4, ticktype = "detailed", colkey = FALSE, phi = 20, theta = -140, zlim = c(-14, 14), xlim = c(-14, 14), ylim = c(-14, 14), xlab = "X", ylab = "Z", zlab = "Y", CI =

[R] scatter3D and colours

2016-07-14 Thread Jorge I Velez
Dear R-help, I am using the plot3D package to produce 3D spheres along with 95% CIs distinguishing each sphere with a predefined colour (see the reproducible example at the end). I have been successful in producing a similar plot using a different data set (kindly see https://www.dropbox.com/s/sn

Re: [R] Dates in R (Year Month)

2016-07-14 Thread Mangalani Peter Makananisa
Thanks. -Original Message- From: David L Carlson [mailto:dcarl...@tamu.edu] Sent: 13 July 2016 05:05 PM To: Mangalani Peter Makananisa; r-help@r-project.org Subject: RE: Dates in R (Year Month) You need to look at the examples on the manual pages for ?yearmon and ?strptime: > Z <- as.ye

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

2016-07-14 Thread Nordlund, Dan (DSHS/RDA)
It would be possible to ease the task of returning full rows from the matching dates (min or max) by wrapping the aggregate function up in a utility function and just returning the dates. I also borrowed the use of format() from Bill Dunlap’s example so that loading the zoo package is not neces

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

2016-07-14 Thread William Dunlap via R-help
I did not use aggregate because it did not make it convenient to return the rest of the row with the min or max data in it. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Jul 14, 2016 at 9:22 AM, Nordlund, Dan (DSHS/RDA) < nord...@dshs.wa.gov> wrote: > Using William Dunlap's data, here is

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

2016-07-14 Thread Mehta, Gaurang
Thanks. That is a slick one. -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Nordlund, Dan (DSHS/RDA) Sent: 14 July 2016 17:22 To: R-help Mailing List Subject: Re: [R] Selecting 1st and last dates from a set of dates Using William Dunlap's data, here i

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

2016-07-14 Thread Nordlund, Dan (DSHS/RDA)
Using William Dunlap's data, here is another alternative: library(zoo) aggregate(d$Date,list(as.yearmon(d$Date)),min) aggregate(d$Date,list(as.yearmon(d$Date)),max) Hope this is helpful, Dan Daniel Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration W

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

2016-07-14 Thread Mehta, Gaurang
Thanks William. This works. Thanks again. From: William Dunlap [mailto:wdun...@tibco.com] Sent: 14 July 2016 16:42 To: Mehta, Gaurang Cc: Jeff Newmiller; R-help Mailing List Subject: Re: [R] Selecting 1st and last dates from a set of dates Does the following example help? isFirstInRun() and isLa

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

2016-07-14 Thread William Dunlap via R-help
Does the following example help? isFirstInRun() and isLastInRun() are handy utility functions. > d <- transform(data.frame(Date=as.Date(c("2016-01-05", "2016-03-04", "2016-03-30", "2015-12-02", "2016-03-04", "2015-12-21"))), DaysSince1970=as.integer(Date), I=seq_along(Date)) > d Date Days

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

2016-07-14 Thread Mehta, Gaurang
Hi Jeff, I would say my problem is what you described in 2 below. My data is as follows: DateUC11UC12UC13 02/01/1997 1 2 0 03/01/1997 5 6 3 06/01/1997 5 4 6 07/01/1997 6 4 3 08/01/1997 6 5 5 09/01/1997

Re: [R] failure with merge

2016-07-14 Thread William Dunlap via R-help
It looks like a common problem when using do.call("order", dataFrame). If dataFrame has a column whose name matches an argument to order you will get this problem. The solution is to use do.call("order", unname(dataFrame)). E.g., > do.call("order", tuneAcc) Error in match.arg(method) : 'arg' m

Re: [R] glmmLasso with interactions errors

2016-07-14 Thread Cade, Brian
It has never been obvious to me that the lasso approach can handle interactions among predictor variables well at all. I'ld be curious to see what others think and what you learn. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins

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

[R] failure with merge

2016-07-14 Thread Max Kuhn
I am merging two data frames: tuneAcc <- structure(list(select = c(FALSE, TRUE), method = structure(c(1L, 1L), .Label = "GCV.Cp", class = "factor"), RMSE = c(29.2102056093962, 28.9743318817886), Rsquared = c(0.0322612161559773, 0.0281713457306074), RMSESD = c(0.981573768028697, 0.791307778398384),

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

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

2016-07-14 Thread Mehta, Gaurang
Hi Team, I am struggling to select the first date and last date of the month where there is data in a dataframe/matrix. Is there any r function that can help to easily select data on the first and last day of the month from the given set of dates and values. Thanks for the help in advance. Regard

Re: [R] Reference for aov()

2016-07-14 Thread peter dalgaard
I am not aware of a detailed documentation of this beyond the actual source code. However, the principles are fairly straightforward, except that the rules for constructing the design matrix from the model formula can be a bit arcane at times. The two main tools are the design matrix construct

Re: [R] Forking and adapting an R package

2016-07-14 Thread BONACHE Adrien via R-help
Hi Timo, To perform the first point, you just have to write the function name in R without using parentheses and arguments after it. You will see the code of the function. Copy and Paste it on notepad, change the name of the function in the notepad, then change what you want to change in your fu