Re: [R] Does this exist: diff(range(VAR, na.rm=T))

2025-06-25 Thread Ebert,Timothy Aaron
I do not see the problem. In base R Min <- min(var, na.rm=T) Max <- max(var, na.rm=T) Span <- c(Min, Max) Is the same output as Span <- range(var, na.rm=T) diff(range(var, na.rm=T)) returns Max - Min range() returns a vector with two values, the minimum and the maximum. What should the function

Re: [R] Potential bug in readLines when reading empty lines

2025-06-25 Thread Ebert,Timothy Aaron
The end of file is a problem. In my case I have data files that can end in one of several ways. A line can end with \r or \n. 1) No line feed at the end of the last row of data. 2) One line feed at the end of the last row of data. 3) Multiple line feeds at the end of the last row of data. 4) All o

Re: [R] Help merging large datasets in R

2025-05-08 Thread Ebert,Timothy Aaron
more fun, log transform these variables before plotting so that parts of the variable names are also part of the valid code. For me, coding is hard enough without additional complexity. Tim -Original Message- From: Jeff Newmiller Sent: Wednesday, May 7, 2025 8:29 PM To: r-help@r-pr

Re: [R] Help merging large datasets in R

2025-05-07 Thread Ebert,Timothy Aaron
Some issues: 1) Variable names cannot have spaces. "merged 1" is not valid but "merged_1" is a valid alternative. 2) You need to tell R what to merge by. It looks like you may be using data tables rather than a data frame. merged <- dataset2[dataset1, on = "id", nomatch = NA] 3) Alternatively: j

Re: [R] OT: A philosophical question about statistics

2025-05-05 Thread Ebert,Timothy Aaron
(adding slightly to Gregg's answer) Why do professionals use both? Computer intensive methods (bootstrap, randomization, jackknife) are data hungry. They do not work well if I have a sample size of 4. One could argue that the traditional methods also have trouble, but one could also think of the

Re: [R] Drawing a sample based on certain condition

2025-04-15 Thread Ebert,Timothy Aaron
ifficulty in asking the right questions as complexity increases. Tim -Original Message- From: Jeff Newmiller Sent: Tuesday, April 15, 2025 3:16 AM To: r-help@r-project.org; Ebert,Timothy Aaron ; Bert Gunter ; Duncan Murdoch Cc: r-help@r-project.org Subject: Re: [R] Drawing a sample ba

Re: [R] Drawing a sample based on certain condition

2025-04-14 Thread Ebert,Timothy Aaron
1) select only denied individuals from the original data. This is S. 2) There is a fixed sample size of exactly t 3) There is a fixed target sum T such that sum(t values from S) = T You can reduce the problem. All large values where the max(S) + (t-1 smallest values) > T can be eliminated from S

Re: [R] Drawing a sample based on certain condition

2025-04-14 Thread Ebert,Timothy Aaron
1) extract relevant observations to a new data frame. Either of these two commands works. filter(df, age > 24) df[df$age > 24, ] 2) sample the new data frame df[sample(nrow(df), 10, replace = TRUE), ] change TRUE to FALSE if you do not want replacement. Tim -Original Message- From: R-hel

Re: [R] An opinion question, please

2025-04-08 Thread Ebert,Timothy Aaron
I would use the approach that is most commonly used by my potential user base unless I can define a clear set of reasons why I should do it differently. If users will be unable to see the difference, then the decision is entirely up to me based on ease of programming at all phases (writing, debu

Re: [R] Can't join/merge two tibbles with lots of variables the way I want

2025-04-07 Thread Ebert,Timothy Aaron
The basic process is to make each tibble have one or more columns to merge by. Then merge the tibbles. Can you show us a couple of tries and describe why or how they failed? Note that you cannot merge using a row in one tibble and a column in the other tibble without first reshaping the first ti

Re: [R] how to create model matrix of second order terms

2025-04-05 Thread Ebert,Timothy Aaron
You could try writing code to write code. However, you need to tell the program which variables are factor and which are continuous. If you are lucky and all integer data are factor and all non-integers are continuous, then you can sort for that. However, in a broad data perspective this is a ba

Re: [R] join/merge two data frames

2025-04-04 Thread Ebert,Timothy Aaron
Your result data frame example makes no sense to me. The price and executed_qty are the same for all symbols? To get it all into one data frame you need a common variable that is used to join the data frames. My guess is that all_trade_sample$symbol has equivalents to the variables in token_clo

Re: [R] [External] Creating model formulas programmatically

2025-03-30 Thread Ebert,Timothy Aaron
variables. Rejoin the dependent variable to the data frame. Pass that to reformulate. Tim -----Original Message- From: Rui Barradas Sent: Sunday, March 30, 2025 4:05 AM To: Ebert,Timothy Aaron ; Bert Gunter ; Richard M. Heiberger ; R-help Subject: Re: [R] [External] Creating model formulas progr

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Ebert,Timothy Aaron
I am confused. Richard's answer that Bert did not like did not use parse explicitly. Richard pasted together a string that a function like lm() will have to parse to run the analysis. However, the answers so far do not use parse(). In the reply to Richard, Bert indicated we cannot use strings. E

Re: [R] [External] Creating model formulas programmatically

2025-03-29 Thread Ebert,Timothy Aaron
The general formula is y ~ a + b + c + ... There is this approach: formula <- reformulate(independent_vars, response = "y") model <- lm(formula, data = mydata) summary(model) It does not generate a string object, but the formula is still a string even if it is of class formula. Also, in this app

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Ebert,Timothy Aaron
The computer intensive approaches (randomization, permutation, bootstrap, jackknife) are awesome when you have enough data. In this age we are all about huge data sets. Yet basic agricultural research often does not come close. I have three to ten replicates per treatment. -Original Message

Re: [R] Setting up hypothesis tests with the infer library?

2025-03-29 Thread Ebert,Timothy Aaron
How about calculating a 95% confidence interval about the estimated proportion in favor. The PooledInfRate package will do this for you. If confidence intervals overlap then there is no significant difference. -Original Message- From: R-help On Behalf Of Kevin Zembower via R-help Sent:

Re: [R] What don't I understand about sample()?

2025-03-15 Thread Ebert,Timothy Aaron
Brian Manly wrote a nice book about computer intensive methods in data analysis: https://www.amazon.com/Randomization-Bootstrap-Methods-Biology-Statistical/dp/1584885416. Therein there is a distinction between permutation tests and randomization tests. A permutation test uses every permutation

Re: [R] What don't I understand about sample()?

2025-03-13 Thread Ebert,Timothy Aaron
This is fun. In a stats class you are trying to deal with data. There is the underlying distribution. This is the random number generator. I have a population that is following the underlying distribution. In this case my population is 10,000 individuals with a true population mean of 40 and a s

Re: [R] Number changed weirdly when converting to numeric

2025-03-09 Thread Ebert,Timothy Aaron
This is a general problem across all software. A computer has finite memory but a floating-point value can have an infinite number of digits. Consider trying to store the exact value of pi. All computer software has a limit to available precision, and that value is specific to each piece of soft

Re: [R] Citation for stock price data from Quantmod

2024-12-31 Thread Ebert,Timothy Aaron
peers and professionalism should guide your choices. -Original Message- From: Jeff Newmiller Sent: Monday, December 30, 2024 11:23 PM To: Ebert,Timothy Aaron ; r-help@r-project.org; Erin Hodgess Subject: RE: [R] Citation for stock price data from Quantmod [External Email] The _point_ is

Re: [R] Citation for stock price data from Quantmod

2024-12-30 Thread Ebert,Timothy Aaron
range or field of possible/probable results. -Original Message- From: Jeff Newmiller Sent: Monday, December 30, 2024 7:52 PM To: r-help@r-project.org; Ebert,Timothy Aaron ; Erin Hodgess ; r-help@r-project.org Subject: Re: [R] Citation for stock price data from Quantmod [External Email

Re: [R] Citation for stock price data from Quantmod

2024-12-30 Thread Ebert,Timothy Aaron
Yes, you need to cite the source of data and the method for retrieval. You also need to cite programs used in manipulating the data, cleaning the data, and analyzing the data. I should be able to read what you wrote, and using those methods recover the data independently from you and finish all

Re: [R] [off-topic] crossword

2024-12-13 Thread Ebert,Timothy Aaron
POLWART Sent: Friday, December 13, 2024 3:03 AM To: Ebert,Timothy Aaron Cc: Erin Hodgess ; Bill Dunlap ; r-help@R-project.org Subject: Re: [R] [off-topic] crossword [External Email] Well to complicate things, I don't think RULES is the answer. This is a cryptic crossword clue. They usually co

Re: [R] [off-topic] crossword

2024-12-12 Thread Ebert,Timothy Aaron
I do not understand the question and I do not understand the answer. Possibly one confounds the other. -Original Message- From: R-help On Behalf Of Erin Hodgess Sent: Thursday, December 12, 2024 11:56 AM To: Bill Dunlap Cc: r-help@R-project.org Subject: Re: [R] [off-topic] crossword [E

Re: [R] Heat maps containing two types of variables

2024-12-10 Thread Ebert,Timothy Aaron
quot;, y = "") + scale_fill_gradient2(low = "#E94A26", mid = "white", high = "#A1D385", midpoint = 0.5) + scale_x_continuous( breaks = seq.Date(as.Date("2024-01-01"), as.Date("2024-06-01"), by = "month"), labels =

Re: [R] Heat maps containing two types of variables

2024-12-09 Thread Ebert,Timothy Aaron
What happens if you switch the colors in this line: scale_fill_gradient2(low = "#E94A26", mid = "white", high = "#A1D385", midpoint = 0.5) + to be the following scale_fill_gradient2(low = "# A1D385", mid = "white", high = "# E94A26", midpoint = 0.5) + That said, a red-green heat map may be

Re: [R] R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments

2024-11-27 Thread Ebert,Timothy Aaron
Here is another version using for loops. newdata3 <- olddata |> dplyr::arrange(ID, date) newdata3$firstday <- NA for (i in 1:nrow(newdata3)) { if (i == 1) { dayz <- newdata3$date[i] } else { if (newdata3$ID[i] != newdata3$ID[i - 1]) { dayz <- newdata3$date[i] } } newdat

Re: [R] R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments

2024-11-27 Thread Ebert,Timothy Aaron
Very similar to what Oliver posted: library(dplyr) newdata <- olddata |> group_by(ID) |> mutate(firstdate = first(date)) newdata 1) I attached dplyr to the entire program. Oliver used dplyr::group_by() and dplyr::mutate() to do the same thing. 2) I used the base R |> pipe while Oliver used

Re: [R] Extracting wind direction and wind speed from wind rose plot

2024-10-30 Thread Ebert,Timothy Aaron
1) If you already have two data frames, one as shown, the other with Wind_Speed and Wind_Dir, then you can use cbind() to join them if they have the same number of rows. If not, then you will have to edit one of the data frames (to get the same number of rows) or add column(s) so that both data

Re: [R] readLines() and unz() and non-empty final line

2024-10-24 Thread Ebert,Timothy Aaron
I had something like this problem where the program read files but some files would be missing the last line of data. My solution was to write another program that looked at the files and if a file did not end in a line feed to add one. Possibly a bit primitive, but it worked. Regards, Tim

Re: [R] JASP vs R

2024-10-17 Thread Ebert,Timothy Aaron
I might start by trying to figure out what they are trying to accomplish. Is R a requirement for a GUI that requires no R coding? Would something like PAST work? https://www.nhm.uio.no/english/research/resources/past/ Tim -Original Message- From: R-help On Behalf Of tgs77m--- via R-hel

Re: [R] apply

2024-10-04 Thread Ebert,Timothy Aaron
Why must the answer use apply? It feels like there are elements of the problem that are not explained. -Original Message- From: R-help On Behalf Of Ben Bolker Sent: Friday, October 4, 2024 8:45 AM To: r-help@r-project.org Subject: Re: [R] apply [External Email] It's still hard to fi

Re: [R] Loading multiple packages with install.packages()...

2024-09-23 Thread Ebert,Timothy Aaron
If you can get a vector with all the package names (I do not know how to do this) then you could do something like this; # Function to check and install missing packages install_if_missing <- function(pkg) { if (!require(pkg, character.only = TRUE)) { install.packages(pkg, dependencies = TRU

Re: [R] Reading a txt file from internet

2024-09-08 Thread Ebert,Timothy Aaron
Say that you have several files from different places or times and you wanted to run your program on all of them without reprogramming. You could start with the readr package and use guess_encoding. j <- 1 for (i in file_paths){ file_encoding[j] <- as.character(readr::guess_encoding(i)$encoding

Re: [R] Fill NA values in columns with values of another column

2024-08-28 Thread Ebert,Timothy Aaron
Why not use na.omit() and then go from there? Unless one handles NA differently in different groups there is no point in processing the data by groups to remove NA even if later analysis steps do require group information. Tim -Original Message- From: R-help On Behalf Of Rui Barradas S

Re: [R] Manually calculating values from aov() result

2024-08-07 Thread Ebert,Timothy Aaron
In proc glm, SAS will give both type I and type III sums of squares. You can get type II if you ask. Other procedures in SAS have different output as defaults. Introductory textbooks may only cover type I SS. It is easy to calculate and gets the idea across. In application one of the problems i

Re: [R] OFF TOPIC: Nature article on File Drawer Problem in Reserach

2024-07-24 Thread Ebert,Timothy Aaron
Here is one response: https://doi.org/10.1093/jisesa/iew092 Or paraphrased: yes. Regards, Tim -Original Message- From: R-help On Behalf Of Bert Gunter Sent: Wednesday, July 24, 2024 10:44 AM To: R-help Subject: [R] OFF TOPIC: Nature article on File Drawer Problem in Reserach [External

Re: [R] Extract

2024-07-19 Thread Ebert,Timothy Aaron
The desired result is odd. 1) It looks like the string is duplicated in the desired result. The first line of data has "15, xc, Ab", and the desired result has "15, xc, Ab, 15, xc, Ab" 2) The example has S1 through S5, but the desired result has data for eight variables in the first line (not fi

Re: [R] Interpreting p values of gls in nlme

2024-07-16 Thread Ebert,Timothy Aaron
In a lm() model a significant intercept means that the line passes above or below the intercept (x=0, y=0). A significant predictor means that the slope is not zero. More generally the significant predictor means that the predictor has some influence on the predicted. With nlme() the relationsh

Re: [R] Create matrix with variable number of columns AND CREATE NAMES FOR THE COLUMNS

2024-07-01 Thread Ebert,Timothy Aaron
NSims <- 4 Grps <- 5 DiffMeans <- matrix(nrow=NSims,ncol=1+Grps) DiffMeans #I have a problem when I try to name the columns of the matrix. I want the first column to be NSims, #and the other columns to be something like Value1, Value2, . . . Valuen where N=Grps Colnames <- as.vector("NSims") num

Re: [R] code for year month day hr format

2024-06-15 Thread Ebert,Timothy Aaron
library(lubridate) library(dplyr) df1 <- read.table(text = "YEAR DOY HR IMF SW SSNDst f10.7 2012 214 0 3.4 403. 132-9 154.6 2012 214 1 3.7 388. 132 -10 154.6 2012 214 2 3.7 383. 132 -10 154.6 2012 214 3 3.7 391. 132-9 154.6 2012 215 4 5.1 371. 143-4 138.

Re: [R] Create a numeric series in an efficient way

2024-06-13 Thread Ebert,Timothy Aaron
Bert Gunter Sent: Thursday, June 13, 2024 9:13 PM To: Ebert,Timothy Aaron Cc: Francesca PANCOTTO ; r-help@r-project.org Subject: Re: [R] Create a numeric series in an efficient way [External Email] Nope. She would have wanted the 'each' argument = 84. See ?rep. -- Bert On Thu, Jun 13,

Re: [R] Create a numeric series in an efficient way

2024-06-13 Thread Ebert,Timothy Aaron
Maybe this was your solution? blocC <- c(rep(x=c(1:13), times=84)) blocC <- arrange(.data = data.frame(blocC), blocC) The second line sorts, but that may not be needed depending on application. The object class is also different in the sorted solution. Tim -Original Message- From: R-hel

Re: [R] my R code worked well when running the first 1000 lines of R code

2024-06-12 Thread Ebert,Timothy Aaron
Hi Yuan, When you load some packages do you get messages saying that some function is being masked? What can happen is that one package has a function with the same name as another package. The conflict is resolved by having one package mask the other. However, this can cause conflicts if you

Re: [R] Can't compute row means of two columns of a dataframe.

2024-06-08 Thread Ebert,Timothy Aaron
Would this work? xxxz$Average20 <- (xxxz$Low20 + xxxz$High20)/2 I tried this earlier but it does not appear to have gone through. Tim -Original Message- From: R-help On Behalf Of avi.e.gr...@gmail.com Sent: Saturday, June 8, 2024 2:16 PM To: 'Sorkin, John' ; r-help@r-project.org Subjec

Re: [R] Can't compute row means of two columns of a dataframe.

2024-06-08 Thread Ebert,Timothy Aaron
Can this problem be made more direct? xxxz$Average.20 <- (xxxz$Low20 + xxxz$High20)/2 That is literally the mean of two columns. Functions can be useful if there will be more columns, but with just two this seems easier. I will point out that the average daily temperature based on the midpoint

Re: [R] R code for overlapping variables -- count

2024-06-03 Thread Ebert,Timothy Aaron
One could make dummy variables if the existing variables are otherwise. If Female is a variable that includes other options (no-response, non-binary, ...) then recode it using dummy.female and the others would be similarly named. -Original Message- From: R-help On Behalf Of peter dalgaa

Re: [R] Least error-prone reading of Excel files?

2024-05-16 Thread Ebert,Timothy Aaron
https://www.r-bloggers.com/2021/06/reading-data-from-excel-files-xlsxlsxcsv-into-r-quick-guide/ Excel can hold a great quantity of data. However, I find that it is slow and often crashes when I try to use Excel at large scale. It also grinds my entire system to a halt. At the kb and mb scales I

Re: [R] x[0]: Can '0' be made an allowed index in R?

2024-04-22 Thread Ebert,Timothy Aaron
You could have negative indices. There are two ways to do this. 1) provide a large offset. Offset <- 30 for (i in -29 to 120) { print(df[i+Offset])} 2) use absolute values if all indices are negative. for (i in -200 to -1) {print(df[abs(i)])} Tim -Original Message- From: R-help On Be

Re: [R] seeking help with splicing in R

2024-04-11 Thread Ebert,Timothy Aaron
Whatever you had as HTML was deleted. If that was data we did not get it. 1) manipulate wpi_def_nic2004 and wpi_def_nic2008 first so that the data are compatible, then join them. 2) The full_join statement should explicitly state the columns to join by. Using by=NULL joins by all the columns with

Re: [R] split a factor into single elements

2024-04-02 Thread Ebert,Timothy Aaron
g_data) values<-as.integer(levels(mydf$string_data)) for (i in 1:length(values)) { assign(paste("VAR_", i, sep=""), values[i]) } --- snip --- Best, Kimmo to, 2024-03-28 kello 14:17 +, Ebert,Timothy Aaron kirjoitti: > Here are some pieces of working code. I ass

Re: [R] split a factor into single elements

2024-03-28 Thread Ebert,Timothy Aaron
Here are some pieces of working code. I assume you want the second one or the third one that is functionally the same but all in one statement. I do not understand why it is a factor, but I will assume that there is a current and future reason for that. This means I cannot alter the string_data

Re: [R] Initializing vector and matrices

2024-02-29 Thread Ebert,Timothy Aaron
You could declare a matrix much larger than you intend to use. This works with a few megabytes of data. It is not very efficient, so scaling up may become a problem. m22 <- matrix(NA, 1:60, ncol=6) It does not work to add a new column to the matrix, as in you get an error if you try m22[ ,

Re: [R] Trouble reading a UTF-16LE file

2024-02-28 Thread Ebert,Timothy Aaron
Yea, that worked. Thank you. :) From: jim holtman Sent: Wednesday, February 28, 2024 12:52 PM To: Ebert,Timothy Aaron Cc: r-help@r-project.org Subject: Re: [R] Trouble reading a UTF-16LE file [External Email] Try this: > x <- file("C:\\Users\\Jim\\Downloads\\PV2-ch2 -

[R] Trouble reading a UTF-16LE file

2024-02-28 Thread Ebert,Timothy Aaron
The earlier post had an attached text file that did not go through. I hope this link works. I tested it with a coworker, but that is no guarantee. https://uflorida-my.sharepoint.com/:u:/g/personal/tebert_ufl_edu/EXf5u_CtTwJCrhdfTBIPr7wBefZHx4P_suj4wAWb8i8HFA?e=iQawhh Regards, Tim __

[R] Trouble reading a UTF-16LE file

2024-02-28 Thread Ebert,Timothy Aaron
Dear R-help, I am having trouble reading a UTF-16LE formatted file. The issue appears to be a byte order mark at the beginning of the file. I have tried readLines(file, encoding='utf-16LE') but that got me [1]"\xff\xfe1" "" "" "" "" "" This is a tab delimited text fil

[R] Trouble reading a UTF-16LE file

2024-02-28 Thread Ebert,Timothy Aaron
Dear R-help, I am having trouble reading a UTF-16LE formatted file. The issue appears to be a byte order mark at the beginning of the file. I have tried readLines(file, encoding='utf-16LE') but got me [1]"\xff\xfe1" "" "" "" "" "" Regards, Tim ___

Re: [R] help - Package: stats - function ar.ols

2024-02-23 Thread Ebert,Timothy Aaron
The data came through fine, the program was a miss. Can you paste the program into a ".txt" document like a notepad file and send that? You could also paste it into your email IF your email is configured to send text and NOT html. TIm -Original Message- From: R-help On Behalf Of Pedro

Re: [R] ggarrange & legend

2024-02-05 Thread Ebert,Timothy Aaron
Would something like this help? library(ggplot2) # Create a plot p <- ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point() + labs(title = "Scatter Plot", x = "Weight", y = "Miles Per Gallon") # Add text at a specific location p + annotate("text", x = min(mtcars$wt) + 23, y = max(mtcars$mpg) -

Re: [R] Truncated plots

2024-01-09 Thread Ebert,Timothy Aaron
It would help to have reproducible code. Use dummy data for confidentiality (if you care about that). My guess is that you set margins somewhere and never returned them to a default value. The first thing I would try is to open a new window in RStudio, copy the smallest piece of code that will g

Re: [R] Advice on starting to analyze smokestack emissions?

2023-12-12 Thread Ebert,Timothy Aaron
That depends on how exactly everything must match your primary question. The ecology group might be helpful for how biodiversity changes with proximity to a smokestack. They might have a better idea if the smokestack was from a coal fired powerplant or oil refinery. The modeling process would be

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-12 Thread Ebert,Timothy Aaron
Change year to a factor. Doing it in ggplot will not change the original data. ggplot(df, aes(x = as.factor(year), y = score)) + geom_point() + geom_smooth(method = "lm", formula = y ~ x) + labs(title = "Standard linear regression for France", x = "Year", y = "PISA score in mathematics") + scal

Re: [R] Convert character date time to R date-time variable.

2023-12-07 Thread Ebert,Timothy Aaron
Look at the lubridate package in R. Regards, Tim -Original Message- From: R-help On Behalf Of Sorkin, John Sent: Thursday, December 7, 2023 11:22 AM To: r-help@r-project.org (r-help@r-project.org) Subject: [R] Convert character date time to R date-time variable. [External Email] Collea

Re: [R] adding "Page X of XX" to PDFs

2023-12-02 Thread Ebert,Timothy Aaron
Would this work in general? Say I have a document with figures, special equations, text, and tables. The text and tables are relatively easy. The figures would need a conversion from pixels to lines, and the equations maybe printed out, counted as a figure, and then added to the line count. It w

Re: [R] t.test with Welch correction is ambiguous

2023-11-27 Thread Ebert,Timothy Aaron
Your solution was educational. Thank you. I have two comments. 1) If you do not provide both options then you are forcing people to conform to your approach. In general I disapprove, but for specific cases I can see advantages. 2) Without reading the relevant papers (and possibly understanding th

Re: [R] Bug in print for data frames?

2023-10-26 Thread Ebert,Timothy Aaron
The "problem" goes away if you use x$C <- y[1,] If you have another row in your x, say: x <- data.frame(A=c(1,4), B=c(2,5), C=c(3,6)) then your code x$C <- y[1] returns an error. If y has the same number of rows as x$C then R has the same outcome as in your example. It looks like your code te

Re: [R] Problem with compatible library versions

2023-10-11 Thread Ebert,Timothy Aaron
Is that a method where a program that I write today would still run without changes in 10 years? Tim -Original Message- From: R-help On Behalf Of Richard O'Keefe Sent: Wednesday, October 11, 2023 8:08 AM To: Uwe Ligges Cc: r-help@r-project.org Subject: Re: [R] Problem with compatible li

Re: [R] Question about R software and output

2023-10-03 Thread Ebert,Timothy Aaron
I would answer "local files only," but with sufficient motive it is possible for some people to abuse a system. Base R does not download any of your data. The packages that I know about do not download data. You can add a layer of protection by only downloading directly from the source rather th

Re: [R] Grouping by Date and showing count of failures by date

2023-09-30 Thread Ebert,Timothy Aaron
In this sort of post it would help if we knew the package that was being used for the example. I found one option. https://cran.r-project.org/web/packages/pivottabler/vignettes/v00-vignettes.html There may be a way to create a custom data type that would be a date but restricted to a -mm for

Re: [R] replace character by numeric value

2023-09-29 Thread Ebert,Timothy Aaron
NA)) or c(1,-1)[match(side, c("BUY", "SELL"))] or vals <- c(BUY=1, SELL = -1) vals[side] On 2023-09-29 9:21 a.m., Ebert,Timothy Aaron wrote: > Does this work? > mynewdf$side <- as.numeric(mynewdf$side) > > This code would be the next line after your muta

Re: [R] replace character by numeric value

2023-09-29 Thread Ebert,Timothy Aaron
Does this work? mynewdf$side <- as.numeric(mynewdf$side) This code would be the next line after your mutate. TIm -Original Message- From: R-help On Behalf Of Enrico Schumann Sent: Thursday, September 28, 2023 3:13 AM To: arnaud gaboury Cc: r-help Subject: Re: [R] replace character by

Re: [R] How to fix this problem

2023-09-25 Thread Ebert,Timothy Aaron
An update please: Collectively we have suggested removing commas from the "E..coli" column, checking for different forms of "NA", and looking outside the dataset for e-trash (spaces, text, or other content). For removing commas, I would use global replace to ensure that all commas were removed f

Re: [R] Odd result

2023-09-24 Thread Ebert,Timothy Aaron
I tend to keep data in Excel. The reason is that I can keep data and analysis output in one file. A part of this is that I tend to use SAS where I get abundant output. One way that this type of result happens is with junk in the file. Someone might put a space in a cell or a period. Such charact

Re: [R] graph in R with grouping letters from the turkey test with agricolae package

2023-09-14 Thread Ebert,Timothy Aaron
Why insist on agricolae? Here is an example using multcompiew https://r-graph-gallery.com/84-tukey-test.html You have the same question posted to stackoverflow. https://stackoverflow.com/questions/77090467/graph-in-r-with-grouping-letters-from-the-tukey-lsd-duncan-test-with-agricolae I searched i

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
t the date (say Day). Group_by the day and apply a max function to the grouped data. Then plot the result. Tim -Original Message- From: Kevin Zembower Sent: Wednesday, September 13, 2023 3:26 PM To: Ebert,Timothy Aaron ; Richard O'Keefe Cc: r-help@r-project.org Subject: Re: [R] Hel

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
larger cities (Duluth, International Falls, Thunder Bay) and take a metal average. There is a lake effect for two of these more than the other. All good? Tim -Original Message- From: Kevin Zembower Sent: Wednesday, September 13, 2023 2:05 PM To: Ebert,Timothy Aaron

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
: Wednesday, September 13, 2023 1:22 PM To: Richard O'Keefe ; Ebert,Timothy Aaron Cc: r-help@r-project.org Subject: Re: [R] Help with plotting and date-times for climate data [External Email] Tim, Richard, y'all are reading too much into this. I believe that TMAX is the high temperature

Re: [R] graph in R with grouping letters from the turkey test with agricolae package

2023-09-13 Thread Ebert,Timothy Aaron
+"turkey test +"mean comparison" 84 hits in google scholar. There is an aphid "Aphis gossypii." Some people have changed this to "Apis gossypii." "Apis" is a genus for bees, and there is no critter named "Apis gossypii." However there are 45 papers in google scholar suffering from this malady.

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
I had the same question. However, I can partly answer the off-topic question. Min and max can be important as lower and upper development thresholds. Below the min no growth or development occur because reaction rates are too slow to enable such. Above max, temperatures are too hot. Protein func

Re: [R] prop.trend.test

2023-09-08 Thread Ebert,Timothy Aaron
Say I have one machine that produces 15 million widgets per day. Every day a few widgets are defective. Is the proportion increasing? The data analyst needs to know what time span is of interest. I assume that there is some day-to-day variability. Is today's defect rate greater or less than yest

Re: [R] prop.trend.test

2023-09-07 Thread Ebert,Timothy Aaron
The example is the example in the documentation for the method. There were no details. https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/prop.trend.test More documentation would be useful. Answering questions like what are these numbers? As shown, I see a cluster of three valu

Re: [R] Finding combination of states

2023-09-07 Thread Ebert,Timothy Aaron
gt; g(4, LETTERS[1:5], "B", "E", repeats = FALSE) > > >> [1] "BCAE" "BDAE" "BEAE" "BABE" "BCBE" "BDBE" "BEBE" "BACE" > > >> [9] "BDCE" "BECE" "BADE"

Re: [R] Finding combination of states

2023-09-04 Thread Ebert,Timothy Aaron
Does this work for you? t0<-t1<-t2<-LETTERS[1:5] al2<-expand.grid(t0, t1, t2) al3<-paste(al2$Var1, al2$Var2, al2$Var3) al4 <- gsub(" ", "", al3) head(al3) Tim -Original Message- From: R-help On Behalf Of Eric Berger Sent: Monday, September 4, 2023 10:17 AM To: Christofer Bogaso Cc: r-h

Re: [R] How to create an R input

2023-08-31 Thread Ebert,Timothy Aaron
Add a break. Something like: If (is.character(x)) break If you have nested loops then a similar statement is needed for each level. "break" only exits the innermost loop. Tim -Original Message- From: R-help On Behalf Of Jeff Reichman Sent: Wednesday, August 30, 2023 9:46 PM To: r-help@

Re: [R] Questions about R

2023-08-17 Thread Ebert,Timothy Aaron
When I installed R no personally identifiable information was given, none was requested. There is no login, so no password or user name. R resides on the host computer, so security is the responsibility of the owner(s) of that computer. There are packages and other third party programs, but thes

Re: [R] Puzzled by results from base::rank()

2023-08-11 Thread Ebert,Timothy Aaron
I have entered values into Excel, and sorted them. I am assuming you are asking why the value 3 in x2 is ranked 4.5 versus in x5 it has a rank of 5. X2 looks like this Value RankOrder 1 1.5 1 1 1.5 2 2 3 3 3 4.5 4 3 4.5 5 4 6 6

Re: [R] Stacking matrix columns

2023-08-06 Thread Ebert,Timothy Aaron
You could use a for loop in a brute force approach. -Original Message- From: R-help On Behalf Of Rui Barradas Sent: Sunday, August 6, 2023 7:37 PM To: Iris Simmons ; Steven Yen Cc: R-help Mailing List Subject: Re: [R] Stacking matrix columns [External Email] Às 01:15 de 06/08/2023, Ir

Re: [R] Style guide when using "R" in a title

2023-07-27 Thread Ebert,Timothy Aaron
I did a google search for "R books" and looked at the R in the titles. There is no consistency except it is always an upper case letter. Serif, white R on red: "R for Data Science" and again "R Packages." Given a common author this is a Hadley Wickham style. Sans-serif, black R on cream and a sty

Re: [R] Off-topic: ChatGPT Code Interpreter

2023-07-18 Thread Ebert,Timothy Aaron
7;Jim Lemon' ; Ebert,Timothy Aaron Cc: 'R-help' Subject: RE: [R] Off-topic: ChatGPT Code Interpreter [External Email] Jim, I am not sure what your example means but text to image conversion can be done quite easily in many programming environments and does not need an AI unless

Re: [R] Off-topic: ChatGPT Code Interpreter

2023-07-17 Thread Ebert,Timothy Aaron
This seems spot on, given that Paul Bernal just posted a request to fit all possible models and compare them using r-squared. The all models approach does not promote understanding about what your model is saying about the data and how the system works. Nor does it facilitate fitting the methods

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Ebert,Timothy Aaron
At least on my system string has a single value of " xxx1 xxx2" not "xxx1" and "xxx2". The variable zzz has two values: "J K xxx1" and "J K xxx2" What you want is "J", "K", "xxx1", "xxx2" If I cheat everything works. So then the goal is to rewrite the program so cheating is not needed. # cr

Re: [R] Plotting factors in graph panel

2023-06-29 Thread Ebert,Timothy Aaron
Reposting the data did not help. We do not like to guess, and doing so takes a great deal of time that is likely wasted. Rows are observations. Columns are variables. In Excel, the first row will be variable names and all subsequent rows will be observations. Income is the first variable. It has

Re: [R] Help sourcing datasets (.csv)

2023-06-02 Thread Ebert,Timothy Aaron
Another suggestion: The statistics does not care where the numbers come from. The values 1, 2, 3 have a mean of 2 no matter if these are weights of a bird, plant heights, or concrete tensile strength. Your interpretation might change, but the mean is still 2. Try synthetic data. X<-rnorm(1

Re: [R] Question about implementing statistical test in R

2023-05-03 Thread Ebert,Timothy Aaron
Start with defining your dependent variable and independent variable(s). As an equation like y equals some function of x, the y is the dependent variable. It is often continuous, but does not have to be. If your continuous variable is the dependent variable and you have one categorical independ

Re: [R] Reg: Help regarding ggplot2

2023-05-02 Thread Ebert,Timothy Aaron
Reorganize the data so that you have three columns Something more like this: Date Country Value 2005-01-03 Crepub1.21 You ggplot statement has a mistake. The geom_line() should be outside the ggplot() call. You might then have a ggplot statement like g

Re: [R] Error on using Confint function to calculate 95% CI

2023-04-26 Thread Ebert,Timothy Aaron
Are the numbers you provided multiple estimates of one coefficient or are they one estimate each of over 20 coefficients? -Original Message- From: R-help On Behalf Of Michael Dewey Sent: Wednesday, April 26, 2023 5:14 AM To: bharat rawlley ; r-help@R-project.org Subject: Re: [R] Error on

Re: [R] diamonds data set from ggplot2

2023-04-25 Thread Ebert,Timothy Aaron
Thank you for sharing the paper. Tim -Original Message- From: R-help On Behalf Of Hadley Wickham Sent: Tuesday, April 25, 2023 9:44 AM To: Sigbert Klinke Cc: r-help@r-project.org Subject: Re: [R] diamonds data set from ggplot2 [External Email] On Tue, Apr 25, 2023 at 4:09 AM Sigbert Kl

Re: [R] Circular plot - polar plot code questions

2023-04-24 Thread Ebert,Timothy Aaron
1) If you do not need it do not plot it. However, also consider how others will use your content. Might it be a trivial piece of information for you, but a critical piece of information for someone trying to use your content. A meta analysis, or just wanting to try to relate your outcomes to the

Re: [R] detect and replace outliers by the average

2023-04-21 Thread Ebert,Timothy Aaron
Sometimes outliers happen. No matter the sample size there is always the possibility that one or more values are correct though highly improbable. -Original Message- From: R-help On Behalf Of Richard O'Keefe Sent: Friday, April 21, 2023 7:31 PM To: AbouEl-Makarim Aboueissa Cc: R mailing

  1   2   3   >