[R] Recall: transforming dates

2019-11-02 Thread reichmanj
reichm...@sbcglobal.net would like to recall the message, "transforming dates". __ 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

[R] transforming dates

2019-11-02 Thread reichmanj
R-Help Forum I have a data set that contains a date field but the dates are in two formats 11/7/2016dd/mm/ 14-07-16 dd-mm-yy How would I go about correcting this problem. Should I separate the dates, format them , and then recombine? Sincerely

Re: [R] Bar Charts

2019-10-16 Thread reichmanj
Jim That’s certainly much more straight forward. Jeff -Original Message- From: Jim Lemon Sent: Tuesday, October 15, 2019 8:51 PM To: Jeff Reichman Cc: r-help mailing list Subject: Re: [R] Bar Charts Hi Jeff, Let's say you have the following data: set.seed(12345)

[R] Bar Charts

2019-10-15 Thread reichmanj
r-help forum I have a database that I have performed a "group_by" of a variable called CONTBR_OCCUPATION. I then simply want to plot out just the top 15 results as a bar plot. How do I plot only the top 15 groups on the x -axis. Should I just extract the top 15 records and plot them or is the

Re: [R] separate and gather functions

2019-08-14 Thread reichmanj
That's even easier -Original Message- From: Ista Zahn Sent: Tuesday, August 13, 2019 8:22 AM To: reichm...@sbcglobal.net Cc: William Dunlap ; r-help@r-project.org Subject: Re: [R] separate and gather functions How about > library(tidyr) > separate_rows(d, Col2) Col1 Col2 1

Re: [R] separate and gather functions

2019-08-12 Thread reichmanj
William Yes that works a little better as I don’t have to create notional variables. Thank you Jeff From: William Dunlap Sent: Monday, August 12, 2019 6:46 PM To: Jeff Reichman Cc: r-help@r-project.org Subject: Re: [R] separate and gather functions This one uses only core R

[R] separate and gather functions

2019-08-12 Thread reichmanj
R-Help Forum I have a data set from which I have extracted two columns Column 1 is a listing of Federal agencies and Column 2 lists functions like this Col1 Col2 Agency A Function1, Function2, Function3, Function4 Agency B Function2,

[R] Plotting hclust() results

2019-08-05 Thread reichmanj
R Help Forum I have output from hierarchal clustering and want to plot the results using the ggplot2 function. Where I have a scatter plot with 5 lines representing the 5 clusters. I assuming I need to transform the data into three columns (like) cluster, variable, and value. Not an issue but was

[R] tidyr gather(function)

2019-07-15 Thread reichmanj
r-help Needing to transform some data for a time series (1930 - 2018). > tempDat # A tibble: 89 x 13 Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1 1930 5260.3 60.6 72.2 71.7 86.8 91.3 89.7 82.3 70.4 60.2 52.2 2 1931

[R] Separating Date and Time

2019-06-19 Thread reichmanj
R-Help I'm using the following code to deparate the date and time components from a date_time varaible as follows: dt1$date <- format(as.POSIXct(dt1$date_time, format = "%m/%d/%Y %H:%M"), "%Y-%m-%d") dt1$time <- format(as.POSIXct(dt1$date_time, format = "%m/%d/%Y %H:%M"), "%H:%M:%S")

Re: [R] gganimate: A Grammar of Animated Graphics

2019-06-08 Thread reichmanj
Roy Thank you , yes last night as I was reading through the library functions I saw the animate() function, for example animate(map, fps = 2), where map is a ggplot object Jeff -Original Message- From: Roy Mendelssohn - NOAA Federal Sent: Friday, June 7, 2019 10:11 PM To: Cc:

[R] gganimate: A Grammar of Animated Graphics

2019-06-07 Thread reichmanj
R-Help Forum I've been exploring the gganimate package and am wondering how one might adjust the animation speed? Jeff Reichman [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

Re: [R] cspade {arulesSequences} error

2019-05-28 Thread reichmanj
Abby My code runs just fine at home but when I transfer it to work and rerun it error out at the line shown. Even errors out when I try the example sin the package documentation. So I’m pretty sure is isn’t my code but rather how our IT folks have configured our work systems. Peter Dalgaard

[R] cspade {arulesSequences} error

2019-05-23 Thread reichmanj
R-Help When I run the cspade function from the arulesSequences package... s1 <- cspade(trans_matrix, parameter = list(support = 0.3), control = list(verbose = TRUE)) #s1 <- cspade(trans_matrix, parameter = list(support = 0.3), control = list(verbose = TRUE), tmpdir = "C:\\Temp") I

[R] Calculating date difference in days

2019-05-22 Thread reichmanj
R Help I have a function to calculate a date difference in days but my results come back in hours. I suspect I am using the as.POSIXlt function incorrectly . Suggestions? # Start time of data to be considered start_day <- "2016-04-30" # Make event and sequence IDs into factors elapsed_days

[R] Date Time Conversion

2019-05-08 Thread reichmanj
r-Help Community Never mine figured it out just use the "as.POSIXct" function Jeff I need to convert a date-time field (column) but I'm losing the time when I convert using .. tsData <- myData[,10, drop=FALSE] tsData$date_time <- as.Date(tsData$date_time, format="%m/%d/%y

[R] Date Time Conversion

2019-05-08 Thread reichmanj
r-Help Community I need to convert a date-time field (column) but I'm losing the time when I convert using .. tsData <- myData[,10, drop=FALSE] tsData$date_time <- as.Date(tsData$date_time, format="%m/%d/%y %H:%M") head(tsData) date_time 1 2013-06-20

[R] counting unique values (summary stats)

2019-03-21 Thread reichmanj
r-help I have the following little scrip to create a df of summary stats. I'm having problems obtaining the # of unique values unique=sapply(myData, function (x) length(unique(x), replace = TRUE)) Can I do that, or am I using the wrong R function? summary.stats <-

Re: [R] Zoom In/Out maps library

2019-03-06 Thread reichmanj
Roy Thank you - that's helpful. Going to have to read up on sf and mapview library. Those are new ones. Then to add a point feature layer (lat/long) where would I insert that? Library(maps) Library(sf) # simple features Library(mapview) world.map <- maps::map("world", plot = FALSE, fill =

[R] Zoom In/Out maps library

2019-03-06 Thread reichmanj
R Help Anyone know if I can add a zoom In/Out function to the maps available via the "maps" library? Or do I need to use a different mapping library? world.map <- map_data("world") ggplot(data = world.map) + geom_polygon(mapping = aes(x=long, y=lat, group=group)) Jeff

Re: [R] Calendar Heat Map

2019-02-06 Thread reichmanj
Jeff Thanks - that’s easy enough Jeff -Original Message- From: Jeff Newmiller Sent: Wednesday, February 6, 2019 7:09 AM To: r-help@r-project.org; reichm...@sbcglobal.net Subject: Re: [R] Calendar Heat Map ggplot automatically chooses continuous or discrete scales depending on the

[R] Calendar Heat Map

2019-02-05 Thread reichmanj
r-Help Form I'm working on a "Time-Series Calendar Heatmap" using the following code. ggplot(myData, aes(monthweek, weekdayf, fill = myData $adjusted)) + geom_tile(colour = "white") + facet_grid(year(myData $date)~monthf) + scale_fill_gradient(low="red", high="green") + xlab("Week of

[R] Tukey Test

2019-01-24 Thread reichmanj
R-Help There is an R library that will perform a Tukey test which prints out the Tukey groups (A, B, C, etc) and I don't recall the library. It was agriculture or something like that. And is there a library that will product the Tukey, Bonferonni, Scheffe, and Dunnett comparison tables?

Re: [R] Confusion Table

2019-01-16 Thread reichmanj
Ah yes - thank you -Original Message- From: Jeff Newmiller Sent: Wednesday, January 16, 2019 6:49 PM To: r-help@r-project.org; reichm...@sbcglobal.net Subject: Re: [R] Confusion Table If you turn your character variable into a factor and specify the levels argument, you can control

Re: [R] Confusion Table

2019-01-16 Thread reichmanj
That's easy enough Thanks -Original Message- From: Peter Langfelder Sent: Wednesday, January 16, 2019 6:48 PM To: reichm...@sbcglobal.net Cc: r-help Subject: Re: [R] Confusion Table The lazy way is to do tst_tab = tst_tab[c(2,1), c(2,1)] The less lazy way is something like

[R] Confusion Table

2019-01-16 Thread reichmanj
R-Help R-Help community is there an simple straight forward way of changing my confusion table output to list "Yes" before "No" rather than "No" before "Yes" - R default. # Making predictions on the test set. tst_pred <- ifelse(predict(model_glm, newdata = default_tst, type = "response")