Re: [R] Fwd: r-stats: Geometric Distribution

2023-10-18 Thread Jim Lemon
Please delete drjimle...@gmail.com from your mailing lists. He passed away a mknth ago. Regards, Juel Wife On Tue, 17 Oct 2023, 22:58 Sahil Sharma -- Forwarded message - > From: Sahil Sharma > Date: Tue, Oct 17, 2023 at 12:10 PM > Subject: r-stats: Geometric Distribution > To:

Re: [R] Best way to test for numeric digits?

2023-10-18 Thread Jim Lemon
Please delete drjimle...@bitwrit.com from your mailing list. He passed away a month ago. Regards, Juel (wife) On Thu, 19 Oct 2023, 02:09 Ben Bolker There are some answers on Stack Overflow: > > >

Re: [R] save(), load(), saveRDS(), and readRDS()

2023-10-04 Thread Jim Lemon
Hello, I am very sad to let you know that my husband Jim died on 18th September. I apologise for not letting you know earlier but I had trouble finding the password for his phone. Kind regards, Juel On Fri, 29 Sep 2023, 01:48 Shu Fai Cheung Hi All, > > There is a thread about the use of save(),

Re: [R] Problems Structuring My Data

2023-10-04 Thread Jim Lemon
Hello, I am very sad to let you know that my husband Jim died in 18th September. I apologise for not letting you know earlier but I had trouble finding the password for his phone. If you wish to do an obituary please let me know by emailing juelsallybri...@gmail.com, I can send info through. Kind

Re: [R] download.file strict certificate revocation check

2023-10-04 Thread Jim Lemon
Hello, I am very sad to let you know that my husband Jim died in 18th September. I apologise for not letting you know earlier but I had trouble finding the password for his phone. Kind regards, Juel Briggs On Thu, 5 Oct 2023, 02:07 Ivan Krylov В Wed, 4 Oct 2023 14:32:49 + > John Neset

Re: [R] How to create an R input

2023-08-30 Thread Jim Lemon
HI Jeff, This might give you a start. add_stuff<-function(x) { x<-xinc<-NA finished<-FALSE while(is.na(x)) x<-as.numeric(readline("What number do you want to start? ")) while(is.na(xinc) || !finished) { xinc<-as.numeric(readline("What number do you want to add? ")) if(is.numeric(xinc))

Re: [R] OFF TOPIC: chatGPT glibly produces a lot of wrong answers?

2023-08-13 Thread Jim Lemon
Hi Bert, The article notes that chatGPT often gets the concept wrong, rather than the facts. I think this can be traced to the one who poses the question. I have often encountered requests for help that did not ask for what was really wanted. I was recently asked if I could graphically concatenate

Re: [R] Seeking Assistance: Plotting Sea Current Vectors in R

2023-07-25 Thread Jim Lemon
Hi Kostas, The function vectorField in the plotrix package may do what you want. See the example. Jim On Tue, Jul 25, 2023 at 9:30 PM konstantinos christodoulou wrote: > > Dear Rcommunity, > > I hope this email finds you well. I am writing to seek your assistance with > a data visualization

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

2023-07-17 Thread Jim Lemon
I haven't really focused on the statistical capabilities of AI, that marriage of massive memory and associative learning. I am impressed by its ability to perform text-to-image conversion, something I have recently needed. My artistic ability is that of the average three year old, yet I can employ

Re: [R] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-12 Thread Jim Lemon
Hi John, I'm not sure how to do this with ggplot, but: Time<- c("Age.25","Age.35","Age.45","Age.55") Medians<-c(128.25,148.75,158.5,168.75) > is.character(Time) # [1] TRUE - thus it has no intrinsic numeric value to plot > is.numeric(Medians) # [1] TRUE # coerce Medians to factor and then plot

Re: [R] Plotting factors in graph panel

2023-06-29 Thread Jim Lemon
4 5 9 > None 1 3.05 2.29 2.24 1.71 1.30 2.83 > Equity 2 29.76 28.79 29.51 28.90 31.67 36.77 > Debt 3 31.18 32.64 34.31 35.65 37.59 33.15 > Hybrid 4 36.00 36.27 33.94 33.74 29.44 27.25 > Bank AC > None 1 46.54 54.01 59.1 62.17 67.67 60.87 > Current 2 24.75 24.4 25 24.61 24.02 2

Re: [R] Plotting factors in graph panel

2023-06-28 Thread Jim Lemon
Hi Anupam, Haven't heard from you in a long time. Perhaps you want something like this: at_df<-read.table(text= "Income MF MF_None MF_Equity MF_Debt MF_Hybrid Bank_None Bank_Current Bank_Savings Bank_NA $10 1 3.05 29.76 31.18 36.0 46.54 24.75 25.4 3.307 $25 2 2.29 28.79 32.64 36.27 54.01 24.4

Re: [R] Plotrix pyramid plot: request for a little help

2023-06-06 Thread Jim Lemon
Hi Mohsin, I must have hit the wrong key and sent the last email. The last paragraph should read: To answer your question, I used the "laxlab" and "raxlab" arguments. I also extended them to 0-200 to cover the range of the largest counts. You can use 0-150 for both, but it is not a good idea to

Re: [R] Plotrix pyramid plot: request for a little help

2023-06-06 Thread Jim Lemon
Hi Mohsin, As I don't have your data, I had to fake it, so there are probably some mistakes in the example below: # my suggestion x<-c(143,108,95,72,70,85,125,123,64,67,144,55,60,200,70,100,65,140,49,45,77,58,66,50,77)

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

2023-04-24 Thread Jim Lemon
Hi Bruce, Reading your message, I get the idea that you want a radial.plot with arcs to indicate "at least one bat is in this state'.This can be done with an addition to the rp.type= argument. If you already have what you want in this format, it may not be worth programming it. However, if you

Re: [R] Query about code

2023-04-22 Thread Jim Lemon
; >> ... in which case they should simply email the author directly, no? >> >> -- Bert >> >> On Fri, Apr 21, 2023 at 3:22 PM Jim Lemon wrote: >> > >> > Hi Yeswanth, >> > You seem to be referring to a specific publication by a specific >>

Re: [R] Query about code

2023-04-21 Thread Jim Lemon
Hi Yeswanth, You seem to be referring to a specific publication by a specific author. Unless someone in R-help knows who and what you are referring to, it seems very difficult. Perhaps you could supply a reference to the work you are using? JIm On Sat, Apr 22, 2023 at 7:03 AM ADIGARLA YESWANTH

Re: [R] single character in R, and how to manipulate it

2023-03-30 Thread Jim Lemon
Also see the "arctext" function in the plotrix package. Jim On Fri, Mar 31, 2023 at 11:12 AM Jim Lemon wrote: > > Hi Jinsong, > Maybe "srt" will do what you want. As you noted non-orthogonal > rotations may not work on some devices. You may be able to download

Re: [R] single character in R, and how to manipulate it

2023-03-30 Thread Jim Lemon
Hi Jinsong, Maybe "srt" will do what you want. As you noted non-orthogonal rotations may not work on some devices. You may be able to download mirror fonts from places like fontmirror.com, but it more complicated. Jim On Thu, Mar 30, 2023 at 7:25 PM Jinsong Zhao wrote: > > Hi there, > > > I

Re: [R] Shaded area

2023-03-12 Thread Jim Lemon
Hi all, I was quite intrigued by George's question, for I thought this might be a problem faced by many. The solution attached is only useful for a monotonically increasing x vector, a paired vector of y values, and a criterial value above which a polygon will be displayed. More work would needed

Re: [R] MFA variables graph, filtered by separate.analyses

2023-02-21 Thread Jim Lemon
Hi Gavin, I can't work through this right now, but I would start by looking at the 'hetcor' package to get the correlations, or if they are already in the return object, build a plot from these. Jim On Wed, Feb 22, 2023 at 4:24 AM gavin duley wrote: > > Hi! > > Apologies if this is not the

Re: [R] Question about italics in legendg() - plotrix

2023-02-14 Thread Jim Lemon
Hi Nicole, plotrix is intended to be modular, that is, it builds plots step by step. This makes it easier to understand code that you haven't written or haven't seen for a while. Here is an example showing how to change the font using par(): library(plotrix)

Re: [R] overlaying two graphs / plots /lines

2023-02-07 Thread Jim Lemon
Hi Bogdan, Try this: A<-data.frame(x=c(1,7,9,20), y=c(39,91,100,3)) B<-data.frame(x=c(10,21,67,99,200), y=c(9,89,1000,90,1001)) # one value omitted to equalize the rows xrange<-range(c(unlist(A$x),unlist(B$x))) yrange<-range(c(unlist(A$y),unlist(B$y)))

Re: [R] Extracting data using subset function

2023-02-05 Thread Jim Lemon
Hi Upananda, As a couple of respondents noted, you only need the logical statement, not subset(). You did "frame the logical condition" in your example, for if you use the extraction operator "[" this will work: subset(p,(1:length(p)) <= 20) as Jeff already pointed out. Obviously it is easier to

Re: [R] Reg: To change the x axis label in ts.plot function

2022-12-24 Thread Jim Lemon
Hi Upananda, First, the date sequence you are using doesn't match the dates you specify in your post. The code below may give you what you want: # make up some prices price<-c(seq(60,25,length.out=25),seq(25,70,length.out=54))+rnorm(79) pricet <- ts(price, start =

Re: [R] Format printing with R

2022-11-21 Thread Jim Lemon
Hi Steven, I thought that the problem might be in the two large numbers, but using a subset (I didn't want to edit out all the line numbers), I get what I expected: sydf<-read.table(text="Mean Std.dev [1,] 0.3107966 0.462820 [2,] 0.1880302 0.390736 [3,] 45.3185794 16.313635 [4,]

Re: [R] Plotting a triangular prism

2022-11-10 Thread Jim Lemon
Hi Erin, If you want a realistic 3D prism, I would use something like POVRay or other rendering software. You have to know your geometry, but you can get a very realistic image. I suspect that you want more than just a picture of a prism, so you can then generate a PNG image and use it as a layer

Re: [R] Unsubscribe from mailing list please

2022-11-01 Thread Jim Lemon
Hi Eva, As it says in the footer, go here: https://stat.ethz.ch/mailman/listinfo/r-help Jim On Wed, Nov 2, 2022 at 6:51 AM Eva Maria Leunissen wrote: > > Hi, > > Could I please unsubscribe from the R-help mailing list? > > Thanks > > Eva > > [[alternative HTML version deleted]] > >

Re: [R] pairwise.var.test

2022-10-30 Thread Jim Lemon
Hi Thomas, I have assumed the format of your p-value matrix. This may require some adjustment. A B C D E F A 1 0.7464 0.01870.0865 0.0122 0.4693 B 0.7464 1 0.03580.1502 0.0173 0.3240 C 0.0187

Re: [R] Forestplot, grid graphics Viewplot grid.arange

2022-10-13 Thread Jim Lemon
Hi Mary, I didn't see any answers to your post, but doing something like this is quite easy in base graphics. If you are still stuck, I may be able to suggest something. Jim On Mon, Oct 10, 2022 at 6:05 PM Putt, Mary wrote: > > > I have created several plots using the forestplot package and the

Re: [R] cat in a subroutine

2022-10-13 Thread Jim Lemon
dered Logit / > Probit Probabilities", : >unused arguments (fortytwo, "\n") > > On 10/13/2022 4:46 PM, Jim Lemon wrote: > > Hi Steven & Erin, > > This works: > > > > fortytwo<-42 > > cat("\nMarginal and Discrete Effects of

Re: [R] cat in a subroutine

2022-10-13 Thread Jim Lemon
Hi Steven & Erin, This works: fortytwo<-42 cat("\nMarginal and Discrete Effects of Gen Ordered Logit / Probit Probabilities","logisitic =",fortytwo,"\n") j<-grep(".one\\b",c(".one\\a",".one\\b")) Marginal and Discrete Effects of Gen Ordered Logit / Probit Probabilities logisitic = 42 If I don't

Re: [R] cat in a subroutine

2022-10-13 Thread Jim Lemon
Hi Steven, I think Erin is right, unless there is a variable named "logistic" visible within the function, "cat" will think it is either an argument or an R object. If you have the "psych" package loaded, it may see it as a closure. There is also a "Logistic" in the stats package, but that

Re: [R] Ids with matching number combinations?

2022-10-08 Thread Jim Lemon
Hi Marine, I'm not sure that I have the right idea, but this worked for me and may help. # I had to fix this line df<-data.frame(id=rep(1:10,each=10),item1=sample(1:20, 100, replace=TRUE)) df2<-data.frame(a=c(8, 8,10,9, 5, 1,2,1),b=c(16,18,11, 19,18, 11,17,12))

Re: [R] Creating a year-month indicator and groupby with category

2022-10-03 Thread Jim Lemon
Hi Tariq, There were a couple of glitches in your data structure. Here's an example of a simple plot: dat<-structure(list(year = c(2018, 2019, 2019, 2019, 2019, 2019, 2019, 2019, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018,

Re: [R] How long does it take to learn the R programming language?

2022-09-28 Thread Jim Lemon
Given some of the questions that are posted to this list, I am not sure that there is an upper bound to the estimate. Jim __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Converting Character date to Dates in r

2022-09-28 Thread Jim Lemon
Hi Admire, Your attachment didn't get through, although CSV format should. The code you included seems a very roundabout way to extract a series of dates as character strings and as there is no assignment of return values in some lines, is unlikely to work. Perhaps if you send just a few of the

Re: [R] Need help plotting

2022-09-23 Thread Jim Lemon
Hi David, No, read.table converts a text representation of data into a data frame object. Jim On Sat, Sep 24, 2022 at 2:29 AM DFP wrote: > > Do I need that read.table if the tst dataframe already exists in my > system? If so, why? > > -- > >

Re: [R] Write text file in Fortran format

2022-09-21 Thread Jim Lemon
Sorry, line 9 should be: if(substr(air[airline],1,1) == " ") Jim On Thu, Sep 22, 2022 at 8:51 AM Jim Lemon wrote: > > Hi Javad, > The example text file you sent doesn't appear to have the two > "trailer" lines that you describe. I would try this brute force

Re: [R] Write text file in Fortran format

2022-09-21 Thread Jim Lemon
y specific number). > 3- Insert the removed first 8 rows of the original text file as header in the > dataframe. > 4- Insert the last 2 rows of the original text file at the end of dataframe. > 5- Write the dataframe as a new text file exactly similar to the original > text f

Re: [R] Write text file in Fortran format

2022-09-21 Thread Jim Lemon
Hi, There was a .txt attachment that is some type of data file. Maybe what you mean is can the header be stripped and the rest written out in a format that can be input with a FORTRAN read routine. Yes, you just have to read it into a data frame and write it out so that it is in either free or

Re: [R] Need help plotting

2022-09-20 Thread Jim Lemon
Hi David, I'm back home again. Try this: b<-read.table(text= "Dtime DNO2 DVOC Dpm10Dpm2.5 Dpm1 Mtime MNO2 MVOCMpm10 Mpm2.5 Mpm1 18:00 28 164 81.34773 24.695435 14 18:00 19 151 3.00 21 18:01 27 163 74.44034 23.751198 14 18:01 20 148 3.00 21

Re: [R] Need help plotting

2022-09-19 Thread Jim Lemon
2022 at 7:41 AM Parkhurst, David wrote: > > I just sent a subset of the data, with a dataframe called test. Can you see > that? It may not have been approved by the moderator yet. > > DFP (iPad) > > > On Sep 19, 2022, at 5:29 PM, Jim Lemon wrote: > > > >

Re: [R] Need help plotting

2022-09-19 Thread Jim Lemon
Hi David, Since you used read.csv to get the data frame, the file must be i text format. If you can include a few lines of the input (with made up NO2 values if necessary), it would be easy to respond with the required commands and a plot. Jim On Mon, Sep 19, 2022 at 9:12 PM Parkhurst, David

Re: [R] Overlapping barplots and lines

2022-09-15 Thread Jim Lemon
Hi Stefano, The bar x centers are returned by the barplot function. You can also use the barp function (plotrix package) that places the bars at unit intervals by default. Jim On Thu, Sep 15, 2022 at 3:47 PM Stefano Sofia wrote: > > Dear R-list users, > > I have a silly problem with plot that I

Re: [R] Clustering of datasets

2022-09-05 Thread Jim Lemon
Hi Subhamitra, I think the fact that you are passing a vector of values rather than a matrix is part of the problem. As you have only one value for each country, The points plotted will be the index on the x-axis and the value for each country on the y-axis. Passing a value for ylim= means that

Re: [R] Getting minimum value of a column according a factor column of a dataframe

2022-08-25 Thread Jim Lemon
Hi Javad, In that case, just modify the function to extract the rows with both the minimum and maximum Q from each station df1<-read.table(text="Code Y M D Q N O 41003 81 1 19 0.16 7.17 2.5 41003 77 9 22 0.197 6.8 2.2 41003 79 7 28 0.21 4.7 6.2 41005 79 8 17 0.21 5.5 7.2 41005 80 10 30

Re: [R] Reading a CSV file

2022-08-06 Thread Jim Lemon
HI Erin, Just index out the lines in the result vector. Jim On Sun, Aug 7, 2022 at 10:16 AM Erin Hodgess wrote: > > Hello! > > Is there a way to read the first line of a CSV file, then skip 4 lines, > then continue reading, please? > > I know you can skip from the top, but I don't know if you

Re: [R] Extract time and state of charge (Start and End) and Count

2022-07-19 Thread Jim Lemon
Hi Roslina, I think you have changed the code as "bc_start" in my code is "BCStartTime" in yours. When I run the attached code, I get a data frame "hourly_SoC" that looks right, and a matrix "result" (hour by SoC) that checks against the data frame. I have tried to comment the code so that you an

Re: [R] A Request

2022-06-21 Thread Jim Lemon
Hi Chishti, Try this: dim(x)[2] length(dn) >From your error message, the two will be different. They should be the same. A wild guess is that the offending line of code should be: dimnames[2]<-1:dn Jim On Tue, Jun 21, 2022 at 11:10 PM Muhammad Zubair Chishti wrote: > > Hi, Dear Professor, >

Re: [R] Query regarding R 'irr' package 'N.cohen.kappa'

2022-06-16 Thread Jim Lemon
Hi Kalaivani, The N.cohen.kappa function was written by Matthais Gamer, the maintainer of the irr package. Both that function and N2.cohen.kappa (written by Puspendra Singh) involve corrections that are described in the references on the respective help pages. It is likely that there will be small

Re: [R] Changing sign of columns and values

2022-06-12 Thread Jim Lemon
> 2-1 > 2-2 2- 2 > "snp003""C" "A" 11.03 > 2 > 0 1 > "snp004""G"

Re: [R] Changing sign of columns and values

2022-06-11 Thread Jim Lemon
; For instance i am looking the data > mydf > IDnumber OA EA beta > 11 A C 0.050 > 22 G A 0.098 > 33 T G 0.789 > > Best, > Hana > > > > Original message > From: Jim Lemon > Date: 6/12/22 1:59 AM (GMT+03:00) &

Re: [R] Changing sign of columns and values

2022-06-11 Thread Jim Lemon
Hi Hana, I think this is what you want: # first read in your example mydf<-read.table(text= "IDnumber OA EA beta 1 C A -0.05 2 GA0.098 3 GT-0.789", header=TRUE,stringsAsFactors=FALSE) # check it mydf IDnumber OA EA beta 11 C A

Re: [R] Mixing plotting symbols with text

2022-06-07 Thread Jim Lemon
Hi Erin, Here's a kinda clunky way to get your plot title. It can be modified to do fancier things like intersperse symbols with letters but you may need no more than this. Have fun. par(mar=c(5,4,5,2)) plot(0,xlim=c(-1,1),ylim=c(-1,1),type="n",xlab="Nonsense",ylab="Intensity")

Re: [R] How to represent tree-structured values

2022-05-30 Thread Jim Lemon
Hi Richard, Thinking about this, you might also find intersectDiagram, also in plotrix, to be useful. Jim On Mon, May 30, 2022 at 4:37 PM Jim Lemon wrote: > > Hi Richard, > Some years ago I had a try at illustrating Multiple Causes of Death > (MCoD) data. I settled on what is some

Re: [R] How to represent tree-structured values

2022-05-30 Thread Jim Lemon
Hi Richard, Some years ago I had a try at illustrating Multiple Causes of Death (MCoD) data. I settled on what is sometimes called a "sizetree". You can see some examples in the sizetree function help page in "plotrix". Unfortunately I can't use the original data as it was confidential. Jim On

Re: [R] How to color boxplots with respect to the variable names

2022-05-29 Thread Jim Lemon
Hi Neha, As you have a distinguishing feature in the variable names, here is one way to do it: RF<- c(4.7, 1.52, 1.46, 4.5, 0.62, 1.12) RF_LOO<- c(5.2, 1.52, 1.44, 4.3, 0.64, 1.11) RF_boot<- c(5.8, 1.5, 1.23, 4.3, 0.64, 1.12) Ranger<- c(4.5, 1.57, 1.25, 3.75, 0.56, 1.09) Ranger_LOO<- c(5, 1.56,

Re: [R] Help for funnel plot

2022-05-15 Thread Jim Lemon
en't used the plotrix > before > > On Sun, May 15, 2022 at 10:56 AM Jim Lemon wrote: >> >> Hi, >> There are a number of functions that will transform numeric values >> into colors. One is color.scale in the plotrix package. This accepts a >> vector of

Re: [R] Help for funnel plot

2022-05-15 Thread Jim Lemon
Hi, There are a number of functions that will transform numeric values into colors. One is color.scale in the plotrix package. This accepts a vector of numeric values and linearly transforms them into one or more ranges of colors. The resulting colors can then be passed to the appropriate

Re: [R] Filtering an Entire Dataset based on Several Conditions

2022-05-09 Thread Jim Lemon
Hi Paul, Based on my guess that all values have been normalized, I would say: mat<-(matrix(runif(16,-5,5),4)) df<-as.data.frame(mat) df[abs(df) < 3]<-NA df V1 V2 V3V4 1 NA 4.675699 3.166625NA 2 NA NA NA 3.463660 3 4.288831 NA

Re: [R] R Code Execution taking forever

2022-04-23 Thread Jim Lemon
HI Paul, I had a problem a bit like this when trying to implement the Lim-Wolfe imputation for ranks. The size of the output matrix increases exponentially with the size of the initial matrix and it goes into disk-swapping slow motion. It works for small matrices, but rapidly runs out of memory. I

Re: [R] Error with text analysis data

2022-04-12 Thread Jim Lemon
Hi Neha, The error message is about not having _factors_ with two or more levels. Apart from using stringsAsFactors=FALSE (meaning that you probably won't get any factors in "d"), your sample data doesn't look like CSV format. Perhaps the lines have been truncated. You may get something with

Re: [R] replacing a value

2022-04-05 Thread Jim Lemon
Hi Ani, It seems to work for me: a<-c(20, 20, 14.2375646029948, 19.9, 20, 20, 16.3092078677214, 20, 20, 20, 20, 20, 20, 20, 20, 14.8590932408795, 16.178935255298, 20, 20, 20, 20, 27.6404077886079, 20, 20, 20, 20, 20, 21.9857063037444, 20, 20, 20, 20) > a==20 [1] TRUE TRUE FALSE

Re: [R] Plotting proportions

2022-04-03 Thread Jim Lemon
Hi Nick, If you can bear using R base graphics, the plotrix package has a function named "getYmult" that allows you to adjust for the aspect ratio of any plot area. Jim On Sun, Apr 3, 2022 at 11:14 PM Nick Wray wrote: > > Hello If you plot a square in the default R studio window you see a >

Re: [R] Cook's distance for least absolute deviation (lad) regressions

2022-03-20 Thread Jim Lemon
Hi Kelly, Perhaps the best place to look is the "car" package. There is a somewhat confusing reference in the "cookd" function help page to the "cooks.distance" function in the "base" package that doesn't seem to be there. Whether this is the case or not, I think you can still use the "cookd"

Re: [R] setting zeros for missing interval in data

2022-02-28 Thread Jim Lemon
Hi Eliza, It sure was: YY$datetime<-strptime(YY$TIMESTAMP,"%Y/%m/%d %I:%M:%S %p") dt5min<-seq(ISOdate(2021,5,1,0,5),ISOdate(2021,5,31,12,55),by="5 min") newdt<-data.frame(datetime=dt5min) newyy<-merge(newdt,YY,by="datetime",all=TRUE) newyy$RAINFALL[is.na(newyy$RAINFALL)]<-0

Re: [R] tidying up

2022-02-27 Thread Jim Lemon
Hi Avi, I just sent in an answer to a very simple question. In many cases it seems to me that the real problem isn't apparent from the request. ektaraK appears to have almost no experience with R (sorry if I'm wrong). A person in this position may sort of know what they want to do but do not know

Re: [R] Plot by month

2022-02-27 Thread Jim Lemon
Hi ektaraK, Here is a step by step way to create an example and get your plot: # make up a lot of dates dates<-as.Date("2021-1-1")+sample(0:364,100) # make up the temperatures temps<-runif(100,0,40) # create a data frame mydf<-data.frame(date=dates,temp=temps) # create a month variable

Re: [R] saving png images and X11

2022-02-26 Thread Jim Lemon
Hi Bogdan, If we take the error message seriously, it may be that the initial X11 image was never displayed. When this very suspicious black box function tried to transfer the image to a PNG file, it wasn't there or the function couldn't find it. Jim On Sun, Feb 27, 2022 at 2:51 AM Bogdan Tanasa

Re: [R] Survey design for multilevel analysis

2022-02-01 Thread Jim Lemon
Hi Love, I have finally had a chance to look at this more closely. I think that the following link: https://cran.r-project.org/web/packages/survival/vignettes/adjcurve.pdf may be useful. See section 4.2. This is not my area of expertise, but it seems to be a known problem. Perhaps by posting to

Re: [R] How to avoid a divide by zero issue.

2022-01-25 Thread Jim Lemon
Hi Neha, One sure cure for divide by zero is to omit zeros in the denominator variable. num<-sample(0:10,20,TRUE) denom<-sample(0:10,20,TRUE) zeros<-denom == 0 num[!zeros]/denom[!zeros] If you don't want to lose those data and there are no negative values, you could add a small number to all

Re: [R] NAs are removed

2022-01-14 Thread Jim Lemon
Hi Neha, You're using the argument "na.omit" in what function? My blind guess is that there's a divide by zero shooting you from behind. Jim On Sat, Jan 15, 2022 at 6:32 AM Neha gupta wrote: > > Hi everyone > > I use na.omit to remove NAs but still it gives me error > > Error in if (fraction <=

Re: [R] (Off-Topic) Time for a companion mailing list for R packages?

2022-01-13 Thread Jim Lemon
Hi, I wasn't going to contribute to this, but I've got a couple of minutes and the morning caffeine has hit me. My 5 Point Plan for taking life as it comes: 1) I don't like to help people, I'd rather trick them into doing it themselves. 2) I'm lazy and intolerant. If somebody wants me to do their

Re: [R] Method Guidance

2022-01-11 Thread Jim Lemon
Hi Jeff, A completely obscure question deserves a completely obscure answer: jrdf<-read.table(text="Time Event_AEvent_B Lag_B 1 1 10 2 0 11 3 0 00 4 1 00 5 0 11 6

Re: [R] unexpected (?) behavior of box()

2022-01-07 Thread Jim Lemon
aya wrote: > > Hi Jim, > > Thank you for the alternative. Absolutely will try it. > Can you explain a bit about "Maps draws an approximately 2x1 plot"? > Is it the size proportion 2 in x-axis and 1 in y-axis? > > On Fri, Jan 7, 2022 at 4:41 PM Jim Lemon wrote: &g

Re: [R] unexpected (?) behavior of box()

2022-01-06 Thread Jim Lemon
Hi Ani, Blame Mercator. Maps draws an approximately 2x1 plot. Maybe this: mappar<-par("usr") rect(mappar[1],mappar[3],mappar[2],mappar[4]) Jim On Fri, Jan 7, 2022 at 6:25 PM ani jaya wrote: > > Dear R expert, > > I try to box a figure using box(). However it box the default margin, > not the

Re: [R] Dependencies for building R

2022-01-06 Thread Jim Lemon
Thanks, Bert. I will. Jim On Fri, Jan 7, 2022 at 3:44 PM Bert Gunter wrote: > > Ask on r-sig-fedora rather than here, no? > > On Thu, Jan 6, 2022, 8:18 PM Jim Lemon wrote: >> >> Hi, >> I'm facing the usual challenge of building the latest release of R on >&

[R] Dependencies for building R

2022-01-06 Thread Jim Lemon
Hi, I'm facing the usual challenge of building the latest release of R on a new install of Fedora 35 Linux. Is there a list of dependencies that have to be installed (or even better, a package) to avoid the necessity of running ./configure many times and installing them piecemeal? I've just been

Re: [R] Mapping of groups of countries

2022-01-02 Thread Jim Lemon
Hi George, Same to you. I fooled around with the plot a bit after I sent the email. Jim On Mon, Jan 3, 2022 at 8:36 AM george brida wrote: > > Thanks a lot Jim. I really appreciate your help. Happy new year 2022. > George > > On Wed, Dec 29, 2021 at 10:10 PM Jim Lemon wrote:

Re: [R] Mapping of groups of countries

2021-12-29 Thread Jim Lemon
Hi George, This example is obviously a mess, but it shows the basic elements. The labels may be placed manually using something like boxed.labels (plotrix) with lines connecting the labels to the smaller countries. If you want the labels within the countries you will have to use a big graphics

Re: [R] Creating NA equivalent

2021-12-21 Thread Jim Lemon
On Wed, Dec 22, 2021 at 9:56 AM Bert Gunter wrote: > > But you appear to be missing something, Jim -- see inline below (and > the original post): > > Bert > > > On Tue, Dec 21, 2021 at 2:00 PM Jim Lemon wrote: > > > > Please pardon a comment that may be off

Re: [R] Creating NA equivalent

2021-12-21 Thread Jim Lemon
Please pardon a comment that may be off-target as well as off-topic. This appears similar to a number of things like fuzzy logic, where an instance can take incompatible truth values. It is known that an instance may have an attribute with a numeric value, but that value cannot be determined. It

Re: [R] help with LDA topic modelling..

2021-12-20 Thread Jim Lemon
Hi Akshay, It depends upon how the circles are calculated. If each circle encloses all of the members of each group, yes. I doubt you would get perfect separation in any real example, though. At the moment: Hanukkah is finished, Margashirsha Punima has just happened and Christmas is coming up. No

Re: [R] CandlestickCharts of any listed stock and fetching stock prices into R

2021-12-18 Thread Jim Lemon
Hi Winod, Your first error message seems to be saying that you are passing a function that returns an "ohic" object rather than the object. Maybe: ohic<-get.ohlc.yahoo("GOOG",start="2020-12-18",end="2021-12-17") candlestickChart(ohic,..) would get you a bit further. Also it's obvious that the

Re: [R] Changing time intervals in data set

2021-12-15 Thread Jim Lemon
Hi Rich, >From what you sent, it seems like you want to find where the change in _measurement interval_ occurred. That looks to me as though it is the first datetime in each row. In the first row, there is a week gap between the ten and fifteen minute intervals. This may indicate that no

Re: [R] help

2021-12-01 Thread Jim Lemon
Hi mehdi, Try this (first example in the help page): ref<-rnorm(30,sd=2) # add a little noise model1<-ref+rnorm(30)/2 # add more noise model2<-ref+rnorm(30) # display the diagram with the better model oldpar<-taylor.diagram(ref,model1) # now add the worse model

Re: [R] converting to POSIXct

2021-11-30 Thread Jim Lemon
Hi, Petr is right. Apparently as.POSIXct drops the smallest increments if all are zero: ssdf<-read.csv(text="data_POSIX,Sensor_code,value 2002-11-01 00:00:01,1694,7.2 2002-11-01 00:00:00,1723,10.8", stringsAsFactors=FALSE) ssdf$data_POSIX<-as.POSIXct(ssdf$data_POSIX,"%Y-%m-%d HH:MM:SS") ssdf

Re: [R] Package is not available for this version of R.

2021-11-26 Thread Jim Lemon
Hi Amanze, The package is apparently "apsurvival", hosted on GitHub: https://rdrr.io/github/carolinewei/apsurvival/ There seem to be instructions on how to install this, but the maintainer (Caroline Wei?) doesn't seem to have an email address listed. Perhaps the easiest thing for you to do is

Re: [R] Merge column with characters

2021-11-18 Thread Jim Lemon
Hi RosalinaZakaria, Talk about using a sledgehammer to crack a nut. In your example the two objects are character vectors. How about: dt_comb1gd <-paste0(dtpaigd,dtpmgd) Jim On Fri, Nov 19, 2021 at 2:15 AM ROSLINAZAIRIMAH BINTI ZAKARIA . wrote: > > Dear all, > > I try to merge two columns

Re: [R] How to run prop.test on 3-level factors?

2021-11-16 Thread Jim Lemon
Hi Luigi, Maybe multinomial regression? https://www.r-bloggers.com/2020/05/multinomial-logistic-regression-with-r/ Jim On Tue, Nov 16, 2021 at 7:33 PM Luigi Marongiu wrote: > > Hello, > I have a large database with a column containing a factor: > ``` > > str(df) > 'data.frame': 500 obs. of

Re: [R] Confidence Interval for p1-p2 and plot the CI with bar chart

2021-11-13 Thread Jim Lemon
Hi Abou, Perhaps this will be helpful. Be aware that you will cop some flak for putting error bars on a bar plot. aadat<-data.frame(group=c(rep("Exp",50),rep("Con",50)), v1=sample(0:1,100,TRUE), v2=sample(0:1,100,TRUE), v3=sample(0:1,100,TRUE), v4=sample(0:1,100,TRUE),

Re: [R] heatmap ploting

2021-11-05 Thread Jim Lemon
Hi Steve, That plot looks to me as though a value-to-color transformation is performed on the logarithm of gene expression. The scale bar can be roughly reproduced like this: library(plotrix) plot(0,xlim=c(0,3)) gradient.rect(0,-0.1,3,0.1, col=color.scale(seq(0,3,0.1), c(0.7,1,1,1,0.7,0.2),

Re: [R] Date

2021-11-04 Thread Jim Lemon
Hi Val, Try this: dat=read.csv("myfile.csv",stringsAsFactors=FALSE) However, the apparently silent conversion of format is a mystery to me. The only time I have struck something like this was when exporting dates from Excel some years ago, and there was a silent conversion to mm/dd/ format

Re: [R] Fwd: Merging multiple csv files to new file

2021-11-03 Thread Jim Lemon
Hi Gabrielle, I get the feeling that you are trying to merge data in which each file contains different variables, but the same subjects have contributed the data. This a very wild guess, but it may provide some insight. # assume that subjects are identified by a variable named "subjectID" #

Re: [R] by group

2021-11-01 Thread Jim Lemon
Hi Val, I think you answered your own question: by(dat$wt,dat[,c("Sex","Year")],mean) Jim On Tue, Nov 2, 2021 at 8:09 AM Val wrote: > > Hi All, > > How can I generate mean by group. The sample data looks like as follow, > dat<-read.table(text="Year Sex wt > 2001 M 15 > 2001 M 14 > 2001 M 16 >

Re: [R] Help needed with data visualization in R

2021-11-01 Thread Jim Lemon
Hi bharat, There are a number of ways to do this in R. One is: library(plotrix) example(size_n_color) Jim On Tue, Nov 2, 2021 at 6:43 AM bharat rawlley via R-help wrote: > > Thank you very much, for your time and response! > This did resolve my issue and I apologize if the question was a

Re: [R] How to slice the array?

2021-11-01 Thread Jim Lemon
Hi Alice, I can see from your two questions that your English is a bit shaky. This is not a criticism, I couldn't speak Chinese to save my life. I looked around for a Chinese R help mailing list and couldn't find one. Perhaps someone else knows of one. Not only would it make your life easier at

Re: [R] all letters like the R Logo

2021-10-30 Thread Jim Lemon
Hi Cleber, Looks like Deja Vu Sans Bold to me. If you have the GIMP, check it out. Jim On Sun, Oct 31, 2021 at 1:35 PM Cleber Borges via R-help wrote: > > I once saw an internet article someone who made all the letters of the > alphabet with the R logo style (font type, blue color and bow). > I

Re: [R] Need help to print matrix with element and position

2021-10-28 Thread Jim Lemon
; where should I place cat(row,col,mat_1[row,col],"\n")? > > On Thu, Oct 28, 2021 at 1:58 PM Jim Lemon wrote: >> >> Hi Anas, >> How about: >> >> cat(row,col,mat_1[row,col],"\n") >> >> Jim >> >> On Thu, Oct 28, 2021 at

  1   2   3   4   5   6   7   8   9   10   >