Re: [R] Need r help asap

2025-05-30 Thread Kimmo Elo
Hi, sorry to hear, but as Jeff pointed out, such problems are beyond the scope of this list. Anyway, if you have not yet closed the editor, hitting ctrl+z (i.e. undo) - once or several times - could be worth trying. Best, Kimmo pe, 2025-05-30 kello 00:48 -0700, Jeff Newmiller via R-help kirjo

Re: [R] Looking for simple line-splitting code

2025-02-05 Thread Kimmo Elo
Hi, using the library "stringi" allows this: > unlist(stringr::str_split(x, "\n")) [1] "abc" "def" """ghi" Best, Kimmo ke, 2025-02-05 kello 09:35 -0500, Duncan Murdoch kirjoitti: > Thanks to Rui, Peter and Tanvir! Peter's seems to be the fastest of > the > 3 suggestions so far on the littl

Re: [R] ggplot with major and MINOR tick marks on a log scale

2025-01-20 Thread Kimmo Elo
Hi, this code could/should work: --- snip --- PopByDayByAQIminus %>% ggplot(aes(x=AQI_Cat,y=TotalPop/100), group=Day,color=Day,shape=as_factor(Day), linetype = as_factor(Day)) + geom_point(size=4,alpha=0.7)+ geom_line(linewidth=1.5,alpha=0.3)+ theme(axis

Re: [R] Trying to get the prior value of a record from a data.frame . . . data.frame

2024-11-28 Thread Kimmo Elo
ivision of Gerontology and Paliative Care, > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > Cell phone 443-418-5382 > > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > ht

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

2024-10-25 Thread Kimmo Elo
Hi, you could use "scan" instead, it seems to work fine also when wrapped around "unz". Or, alternatively, you could use "unzip" instead of "unz". It works as expected, i.e. reads the last incomplete line and throws a warning about this. So it seems to me that "unz" creates a non-blocking con

Re: [R] Is there a sexy way ...?

2024-09-27 Thread Kimmo Elo
one. > > Can anyone point me in the right direction? Thanks. > > cheers, > > Rolf Turner > -- Kimmo Elo Senior Lecturer | Adjunct professor, Dr. University of Eastern Finland Department of Geographical and Hist

Re: [R] Question about Date Object and time zones

2024-09-25 Thread Kimmo Elo
Hi, I might have misunderstood your point, but why should a Date object store a timezone, since timezone is an attribute of time, not date? Your tz-examples force R to present a timezone, resulting - this is my assumption - to default (=UTC) as there is no other information available. Best, Ki

Re: [R] split a factor into single elements

2024-04-02 Thread Kimmo Elo
Hi, why would this simple procedure not work? --- snip --- mydf <- data.frame(id_station = 1234, string_data = c(2024, 12, 1, 0, 0), rainfall_value= 55) mydf$string_data <- as.factor(mydf$string_data) values<-as.integer(levels(mydf$string_data)) for (i in 1:length(values)) {  assign(pa

Re: [R] geom_edge & color

2024-03-22 Thread Kimmo Elo
lapsed$membership) > %>% > >   set_edge_attr(name = "color", > >   value = c(viridis::viridis(21)) > >   [match(E(.)$type, c(factor(V(.)$name)))]) %>% > >   set_vertex_attr(name = "trans_v_net", value = c(transitivity(.,

Re: [R] geom_edge & color

2024-03-21 Thread Kimmo Elo
Dear Sibylle, your example is not working! E.g. no data for "aes_collapsed". Best, Kimmo ke, 2024-03-20 kello 19:28 +0100, SIBYLLE STÖCKLI via R-help kirjoitti: > Dear community > > I am using ggraph to plot a network analysis. See part 2 in the working > example. > Besides different colors fo

Re: [R] igraph_vertex

2024-02-25 Thread Kimmo Elo
Hi, a quick additional note: try "edge.width= E(.)$weight" instead of the current "edge.width= network". Seems to work and makes a visible difference... HTH, Kimmo su, 2024-02-25 kello 19:11 +, Kimmo Elo kirjoitti: > > Hi again, > > your code i

Re: [R] igraph_vertex

2024-02-25 Thread Kimmo Elo
Hi again, your code is still not reproducible without modifications, but I succeed in getting the data straight. All read.csv-command are missing 'sep="\t"', it is need to read you tsv-data. And it could be more reproducible if you used e.g. --- snip --- aes<-read.csv(text="A.A B.B

Re: [R] igraph_vertex

2024-02-24 Thread Kimmo Elo
Hi, first of all, your example was not reproducible! But once I added "library(igraph)" and "library(scico)" plus generally replaced "aes_collapsed" by "edge_list", I started to work :-) Anyway, the error is produced by this line: + edge.width= network, It seems to me that you have forgott

Re: [R] Help

2024-02-04 Thread Kimmo Elo
Hi, the command line with 'text' should be: text(-8,-8, expression(R^2 * " = 0.62, r = 0.79, N = 161"), cex = 2 ) Best, Kimmo su, 2024-02-04 kello 17:16 +0100, Jibrin Alhassan kirjoitti: > Here is the script I used to plot the graph indicating the text I > wanted to > insert. The line in the

Re: [R] Help

2024-02-04 Thread Kimmo Elo
Hi, maybe this works: expression(R^2 * "= 0.62") HTH, Kimmo 4. helmik. 2024, 16.11, Jibrin Alhassan mailto:jibrin.alhas...@unn.edu.ng>> kirjoitti: I have done a scatter plot in R. I want to insert the coefficient of determination R^2 = 0.62 as a text in the plot. I have tried to write R^2 bu

Re: [R] Choosing colours for lines in ggplot2

2023-08-02 Thread Kimmo Elo
Hi, when using 'scale_colours_manual' the colours must be defined as value- color pairs (i.e. "A"="red", "B"="blue" an so on). If you read the documentation it is recommended to use a named vector. If I understood it correctly, in your code #2 R understood the variable "Stat" as a number (i.e. co

Re: [R] plotly

2023-07-26 Thread Kimmo Elo
Hi, ke, 2023-07-26 kello 02:04 +, Thomas Subia via R-help kirjoitti: > Question 1:How can I save the plotly graph with a specific graph > size?Using ggsave, one can define the height, width and unit of > measure, is there something similar in plotly?Since I am creating the > same gauge plot bu

Re: [R] how to change the y-axis to logarithmic in a barplot ggplot

2023-07-17 Thread Kimmo Elo
Hi, Have you tried: scale_y_continuous(trans='log10') HTH, Kimmo Lähettäjä: Maria Lathouri via R-help Lähetetty: maanantai 17. heinäkuuta 2023 23.01.57 Vastaanottaja: Maria Lathouri via R-help; Ivan Krylov Aihe: Re: [R] how to change the y-axis to logar

Re: [R] how to change the y-axis to logarithmic in a barplot ggplot

2023-07-17 Thread Kimmo Elo
Hi, try: scale_y_continuous(trans='log10') HTH, Kimmo 17. heinäk. 2023, 1.58, Maria Lathouri via R-help mailto:r-help@r-project.org>> kirjoitti: I will find the ggplot help. But I have tried everything, including what you have suggested and nothing works. Kind regards, Maria Στις Κυρ

Re: [R] Simple Stacking of Two Columns

2023-04-04 Thread Kimmo Elo
Hi, or maybe this? NamesLong<-data.frame(Names=unlist(NamesWide), row.names = NULL) HTH, Kimmo ma, 2023-04-03 kello 16:23 +, Ebert,Timothy Aaron kirjoitti: > My first thought was pivot_longer, and stack() is new to me. > How about append(c1,c2) as another solution? Or > data.frame(append(

Re: [R] I need help with this

2022-04-06 Thread Kimmo Elo
Hi! No question. No idea, what you want to achieve. So do not be surprised that we cannot give you any help. Kimmo ti, 2022-04-05 kello 21:59 -0400, ihejirika christopher via R-help kirjoitti: > install.packages("titanic") > library(titanic) > > training_set <- titanic_train#Saves the train set

Re: [R] Syntax help for 'Pivot_longer'

2021-11-28 Thread Kimmo Elo
Hi! If I understood this correctly, you want to pivot the columns from 2 to 25 and use the first column as a "key". Your data has 27 columns in total, right? I tested it with your data and seems that the parameter 'cols' does have some problems. It takes all variables irrespectively of the range

Re: [R] adding results to plot

2021-09-16 Thread Kimmo Elo
Hi! Maybe with this: text(x=0.6, y=1.2, paste0(capture.output(res), collapse="\n"), adj=0) HTH, Kimmo to, 2021-09-16 kello 14:12 +, PIKAL Petr kirjoitti: > Virhe vahvistaessa allekirjoitusta: Virhe tulkittaessa > Dear all > > I know I have seen the answer somewhere but I am not able

Re: [R] Find "undirected" duplicates in a tibble

2021-08-22 Thread Kimmo Elo
Hi! Thank you very much for the fascinating solutions. Nice to learn different approaches. All solutions seem to work with text data as well. @Gabor (who suggested the 'igraph' package): yes, I am familiar with 'igraph' and the solution suggested by you works fine, too. Since I need this kind of

[R] Find "undirected" duplicates in a tibble

2021-08-20 Thread Kimmo Elo
with 'count(pair)'. I have done a lot of searching but not found any function providing this functionality. Does someone know an alternative, maybe a more effective function/solution? Best, Kimmo Elo -- Dr. Kimmo Elo Senior researcher in European Studies =

Re: [R] How to modify rows matching patter on multiple columns of dataframe?

2021-08-12 Thread Kimmo Elo
Hi, something like this (a customised version based on this: https://stackoverflow.com/questions/25768305/r-replace-multiple-values-in-multiple-columns-of-dataframes-with-na ): --- snip --- col_idx<-grep("^var[123]", names(df)) m1<-as.matrix(df[,col_idx]) m1[m1=="a"]<-"z" df[col_idx]<-m1 df --

Re: [R] Removing a space from a string

2020-07-29 Thread Kimmo Elo
Hi! How about this? --- snip --- > x <- c("STRING 01. Remainder of the string","STR ING 01. Remainder of the string","STRIN G 01. Remainder of the string","STR IN G 01. Remainder of the string") > x1<-unlist(strsplit(x,"\\.")) > for (i in seq(1,length(x1),2)) { x[(i+1) %/% 2]<-paste(gsub(

Re: [R] How to convert European short dates to ISO format?

2020-06-10 Thread Kimmo Elo
Hi! Should it be: as.Date(oriDates, format="%d/%m/%y") # See the order of %d and %m!! This command seems to work for me, here the output: [1] "2020-01-23" "2020-01-24" "2020-01-25" "2020-01-26" "2020-01-27" "2020-01-28" "2020-01-29" "2020-01-30" [9] "2020-01-31" "2020-02-01" "2020-02-02" "202