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

2023-07-25 Thread PIKAL Petr
Not sure if correct but Chatgpt answer is: Here are some popular R packages for sea current vectors: oce: The "oce" package provides a wide range of functions for oceanographic data analysis, including handling sea current data. It allows you to work with current data in various formats and

Re: [R] Plotting factors in graph panel

2023-07-07 Thread PIKAL Petr
; https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: <https://www.precheza.cz/en/01-disclaimer/> https://www.precheza.cz/en/01-disclaimer/ From: Anupam Tyagi Sent: Friday, July 7, 2023 12:48 P

Re: [R] Plotting factors in graph panel

2023-07-07 Thread PIKAL Petr
Hallo Anupam I do not see much difference in ggplot or lattice, they seems to me provide almost identical results when removing theme part from ggplot. library(ggplot2) library(lattice) ggplot(TrialData4, aes(x=Income, y=Percent, group=Measure)) + geom_point() + geom_line() +

Re: [R] Plotting factors in graph panel

2023-07-03 Thread PIKAL Petr
Hi I believe that facet_grid his is quite close to what you expect. p <- ggplot(mpg, aes(displ, cty)) + geom_point()+geom_line() p + facet_grid(vars(drv), vars(cyl)) You can inspect how mpg data is organized by head(mpg) Cheers Petr > -Original Message- > From: R-help On Behalf Of

Re: [R] Help/documentation on Rgui

2023-07-03 Thread PIKAL Petr
Hi I am not sure about opening Rgui in terminal but for customising Rgui appearance you can modify Rconsole and Rprofile or Rprofile.site which you should find in etc folder of your R installation. https://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rconsole.html

Re: [R] Plotting factors in graph panel

2023-06-29 Thread PIKAL Petr
Hi Anupam Using Jim's data library(reshape2) at_long <- melt(at_df) at_long$innum <- as.numeric(as.factor(at_long$Income)) ggplot(at_long, aes(x=innum, y=value)) + geom_path() + facet_wrap(~variable, ncol=1) is probably close to what you want. You need to fiddle with labels, facets variable

Re: [R] horizontal grouped stacked plots and removing space between bars

2023-06-29 Thread PIKAL Petr
Hi Anamaria Thanks for the data. See in line. > -Original Message- > From: R-help On Behalf Of Ana Marija > Sent: Wednesday, June 28, 2023 6:00 PM > To: r-help > Subject: [R] horizontal grouped stacked plots and removing space between > bars > > I have code like this: > > data

Re: [R] Plotting factors in graph panel

2023-06-28 Thread PIKAL Petr
Hi You probably can use any package including base R for such plots. 1. Posting in HTML scrambles your date so they are barely readable. 2. Use dput(head(yourdata, 20)) and copy the output to your mail to show how your data look like. Although it seems to be not readable, R will consumes it

Re: [R] Should help of estimate in t.test be corrected?

2023-04-03 Thread PIKAL Petr
t or two sample paired test" Cheers Petr > -Original Message- > From: Samuel Granjeaud IR/Inserm > Sent: Monday, April 3, 2023 1:25 PM > To: PIKAL Petr ; r-help@r-project.org > Subject: Re: [R] Should help of estimate in t.test be corrected? > > Hi > >

Re: [R] Should help of estimate in t.test be corrected?

2023-04-03 Thread PIKAL Petr
Hi You need to use paired option > t.test(x=0:4, y=sample(5:9), paired=TRUE)$estimate mean difference -5 Cheers Petr > -Original Message- > From: R-help On Behalf Of Samuel Granjeaud > IR/Inserm > Sent: Sunday, April 2, 2023 11:39 PM > To: r-help@r-project.org > Subject:

Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-22 Thread PIKAL Petr
Sorry for my questions, it is something I never done before but I now need to resolve it in a way which fits to our IT environment. Best regards. Petr -Original Message- From: Duncan Murdoch Sent: Tuesday, March 21, 2023 5:43 PM To: PIKAL Petr ; r-help Subject: Re: [R] Rprofile.site and

Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread PIKAL Petr
MASS) #** test <-(scan("pack.txt", character(), quote = "")) x<- utils::installed.packages() utils::install.packages(test[!test %in% x], repos="https://cloud.r-project.org;) ##** Options are set and working. MASS should be loaded but is not > sea

Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread PIKAL Petr
their .Rprofile to get customised way how to start R. Best regards Petr > -Original Message- > From: Duncan Murdoch > Sent: Tuesday, March 21, 2023 1:55 PM > To: PIKAL Petr ; r-help > Subject: Re: [R] Rprofile.site and automatic installation of missing > packages > &g

[R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread PIKAL Petr
Dear all. I am trying to install missing (not installed) packages during startup of R through code in Rprofile.site but I miserably failed and I am not sure what I am doing wrong. R is installed to C:Program files but it is not writable for the users, therefore I cannot change

Re: [R] Shaded area

2023-03-01 Thread PIKAL Petr
Hallo Excel attachment is not allowed here, but shading area is answered many times elsewhere. Use something like . "shading area r" in google. See eg. https://www.geeksforgeeks.org/how-to-shade-a-graph-in-r/ Cheers Petr -Original Message- From: R-help On Behalf Of George Brida Sent:

Re: [R] identify the distribution of the data

2023-02-08 Thread PIKAL Petr
Hi Others gave you more fundamental answers. To check the possible distribution you could use package https://cran.r-project.org/web/packages/fitdistrplus/index.html Cheers Petr > -Original Message- > From: R-help On Behalf Of Bogdan Tanasa > Sent: Wednesday, February 8, 2023 5:35 PM

Re: [R] preserve class in apply function

2023-02-07 Thread PIKAL Petr
Hi Naresh If you wanted to automate the function a bit you can use sapply to find numeric columns ind <- sapply(mydf, is.numeric) and use it in apply construct apply(mydf[,ind], 1, function(row) sum(row)) [1] 2.13002569 0.63305300 1.48420429 0.13523859 1.17515873 -0.98531131 [7]

Re: [R] How to calculate the derivatives at each data point?

2023-01-31 Thread PIKAL Petr
Hi Konstantinos Not exactly derivative but > diff(df[,2]) [1] -0.01 -0.01 -0.01 -0.01 0.00 0.01 -0.02 -0.03 -0.02 May be enaough for you. Cheers Petr > > -Original Message- > From: R-help On Behalf Of konstantinos > christodoulou > Sent: Tuesday, January 31, 2023 10:16 AM > To:

Re: [R] question

2023-01-30 Thread PIKAL Petr
Hallo Carolyn >From what you describe you cannot calculate correlations. You stated that you have two sets of data, one for December and one for March and that rows in one set is not related to the rows in another set and even persons tested in both months do not have their values on the same

Re: [R] akima interp results to zero with less than 10 values

2023-01-26 Thread PIKAL Petr
Hallo Duncan Thanks, I was not aware of this package. I will try. Petr > -Original Message- > From: Duncan Murdoch > Sent: Thursday, January 26, 2023 3:44 PM > To: PIKAL Petr ; r-help@r-project.org > Subject: Re: [R] akima interp results to zero with less than 10 value

[R] akima interp results to zero with less than 10 values

2023-01-26 Thread PIKAL Petr
Dear all I have this table > dput(mat) mat <- structure(c(2, 16, 9, 2, 16, 1, 1, 4, 7, 7, 44.52, 42.8, 43.54, 40.26, 40.09), dim = c(5L, 3L)) And I want to calculate result for contour or image plots as I did few years ago. However interp does not compute the z values and gives me zeros in z

Re: [R] package FactoMineR

2023-01-24 Thread PIKAL Petr
Hallo Sacha AFAIK the functions in FactoMineR do not enable to manipulate label size. Plot is performed by this part: if (graph & (ncp > 1)) { print(plot(res, axes = axes)) if (!is.null(quanti.sup)) print(plot(res, choix = "quanti.sup", axes = axes,

Re: [R] Printing special characters

2023-01-16 Thread PIKAL Petr
Hallo Dennis Is the STRING in R still containing **≥** character? Or it was converted during reading to R to ...? What dput(STRING) result i? Cheers Petr > -Original Message- > From: R-help On Behalf Of Dennis Fisher > Sent: Monday, January 16, 2023 9:19 AM > To: r-help@r-project.org

Re: [R] Reg: ggplot error

2023-01-11 Thread PIKAL Petr
fill = "darkgrey") Cheers Petr And I do not provide private consulting so keep your posts to R help. Others may have much more insightful answers. From: Upananda Pani Sent: Wednesday, January 11, 2023 2:43 PM To: PIKAL Petr Subject: Re: [R] Reg: ggplot error Hi Res

Re: [R] Reg: ggplot error

2023-01-11 Thread PIKAL Petr
Hi Attachments are mostly removed from emails so they probably will not reach r-help. You said you get an error, which is the first place you should look at. It can navigate you to the source of the error if you read it carefully. Anyway, if your code is complicated it is difficult to

Re: [R] Date order question

2023-01-04 Thread PIKAL Petr
Hallo Thomas Similar as suggested by Rui, you shall change your date to real date e.g. by library(lubridate) date <- paste(date, c(rep(2022,2), 2023), sep="-") date <- mdy(date) and you need to change also x coordinate in annotate. ggplot(data, aes(x=date,y=PT,group=1))+ geom_point(size=4)+

Re: [R] R Certification

2023-01-02 Thread PIKAL Petr
Hallo Mukesh R project is not Microsoft or Oracle AFAIK. But if you need some certificate you could take courses on Coursera, they are offering certificates. Cheers Petr > -Original Message- > From: R-help On Behalf Of Mukesh > Ghanshyamdas Lekhrajani via R-help > Sent: Monday,

Re: [R] if documentation

2022-12-07 Thread PIKAL Petr
more than expected")} to the help page for if. Regards Petr > -Original Message- > From: Martin Maechler > Sent: Wednesday, December 7, 2022 12:16 PM > To: PIKAL Petr > Cc: R-help Mailing List > Subject: Re: [R] if documentation > > >>>>> PIKAL Petr

[R] if documentation

2022-12-06 Thread PIKAL Petr
Hallo all Not sure if it is appropriate place but as I am not involved in r-devel list I post here. Documentation for Control (if, for, while, .) is missing "if else" command. Although it can be find online elsewhere I believe that adding it either as an example or as a third entry and

Re: [R] data frame returned from sapply but vector expected

2022-11-04 Thread PIKAL Petr
2022 1:37 PM > To: PIKAL Petr > Cc: R-help Mailing List > Subject: Re: [R] data frame returned from sapply but vector expected > > On Fri, 4 Nov 2022 15:30:27 +0300 > Ivan Krylov wrote: > > > sapply(mylist2, `[[`, 'b') > > Wait, that would simplify the return

[R] data frame returned from sapply but vector expected

2022-11-04 Thread PIKAL Petr
Hallo all I found a strange problem for coding if part of list is NULL. In this case, sapply result is ***list of data frames*** but if there is no NULL leaf, the result is ***list of vectors***. I tried simplify option but it did not help me neither I found anything in help page. The

Re: [R] Associate a .R file with the RGui

2022-11-04 Thread PIKAL Petr
Hi another option is to use SendTo folder. This was easy to find in older Windows versions. Now the easiest way is: Press the Windows Key + R to trigger the Run window. At the Open field in the window, type shell:SendTo and then click OK And SendTo folder should open. You can then add link to

Re: [R] Ids with matching number combinations?

2022-10-07 Thread PIKAL Petr
Hallo Marine Could you please make your example more reproducible by using set.seed (and maybe smaller)? If I understand correctly, you want to know if let say row 1 items from df2 (8,16) are both in item column of specific id? If I am correct in guessing, I cannot find another solution than

Re: [R] R version 4.2.1 install.packages does not work with IE proxy setting

2022-10-06 Thread PIKAL Petr
r 6, 2022 1:09 PM > To: r-help@r-project.org; PIKAL Petr > Subject: Re: [R]  R version 4.2.1 install.packages does not work with IE proxy > setting > > Petr, > You also might want to check out the bug reported here: > > https://bugs.r-project.org/show_bug.cgi?id=18379 &

Re: [R] R version 4.2.1 install.packages does not work with IE proxy setting

2022-10-05 Thread PIKAL Petr
Thanks, the workaround works but we need try the "permanent" solution with Renviron.site file in future. Cheers Petr > -Original Message- > From: Ivan Krylov > Sent: Tuesday, October 4, 2022 5:43 PM > To: PIKAL Petr > Cc: r-help mailing list > Subj

[R] R version 4.2.1 install.packages does not work with IE proxy setting

2022-10-04 Thread PIKAL Petr
Dear all After we installed new R version R 4.2.1 installing packages through IE proxy setting is compromised with warning that R could not connect to server (tested in vanilla R). > chooseCRANmirror() Warning: failed to download mirrors file (cannot open URL

Re: [R] Combine two dataframe with different row number and interpolation between values

2022-08-31 Thread PIKAL Petr
Hallo And missing value interpolation is rather tricky business dependent on what is underlying process. Maybe na.locf from zoo package? Or approxfun?, splinefun? Cheers Petr > -Original Message- > From: R-help On Behalf Of javad bayat > Sent: Wednesday, August 31, 2022 8:09 AM >

Re: [R] Combine two dataframe with different row number and interpolation between values

2022-08-31 Thread PIKAL Petr
Hallo Merge df3 <- merge(df1, df2, all=T) > head(df3) y d h ws 1 2010 1 1 NA 2 2010 1 2 NA 3 2010 1 3 20.4631367884005 4 2010 1 3 NA 5 2010 1 4 NA 6 2010 1 5 NA Cheers Petr > -Original Message- >

Re: [R] Need to insert various rows of data from a data frame after particular rows from another dataframe

2022-07-27 Thread PIKAL Petr
der and type. To get more specific answer you need to ask specific question preferably with some data included (most preferably by dput command) and error message. Cheers Petr From: Ranjeet Kumar Jha Sent: Wednesday, July 27, 2022 8:35 AM To: PIKAL Petr Cc: R-help Subject: Re: [R] Ne

Re: [R] Need to insert various rows of data from a data frame after particular rows from another dataframe

2022-07-27 Thread PIKAL Petr
Hi. >From what you say, plain "rbind" could be used, if the columns in both sets are the same and in the same order. After that you can reorder the resulting data frame as you wish by "order". AFAIK for most functions row order in data frame does not matter. Cheers Petr > -Original

Re: [R] split apply on multiple variables

2022-07-01 Thread PIKAL Petr
Hi Maybe lapply(mydf.split, function(x) aggregate(x[,4:5], list(x$date), sum)) For your particular case, but lacking overall genarality. Cheers Petr > -Original Message- > From: R-help On Behalf Of Naresh Gurbuxani > Sent: Friday, July 1, 2022 1:08 PM > To: r-help@r-project.org >

Re: [R] Dplyr question

2022-06-23 Thread PIKAL Petr
Hallo all Various suggestion were made but with this simple task I immediatelly thought about reshape2 melt function. x <- "Time_stampP1A0B0D P190-90D 'Jun-10 10:34' -0.000208 -0.000195 'Jun-10 10:51' -0.000228 -0.000188 'Jun-10 11:02' -0.000234 -0.000204 'Jun-10 11:17' -0.00022

Re: [R] missing values error in if statement

2022-05-20 Thread PIKAL Petr
factor function. You probably modified the code from help page but in that case you should check if all your objects are the same mode and structure as the objects in help page code. Cheers Petr From: Neha gupta Sent: Friday, May 20, 2022 3:22 PM To: PIKAL Petr Cc: r-help mailing list Subject

Re: [R] missing values error in if statement

2022-05-20 Thread PIKAL Petr
Hi Strange, you say > prot <- ifelse(test$CE == '2', 1, 0) /// Error comes here but with your data ifelse(test$CE == '2', 1, 0) [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Re: [R] ggplot pointrange from other df and missing legend

2022-05-16 Thread PIKAL Petr
data frame? Best regards Petr > -Original Message- > From: Rui Barradas > Sent: Monday, May 16, 2022 1:53 PM > To: PIKAL Petr ; r-help@r-project.org > Subject: Re: [R] ggplot pointrange from other df and missing legend > > Hello, > > In the code below the legen

[R] ggplot pointrange from other df and missing legend

2022-05-16 Thread PIKAL Petr
Hallo all Here are the data from dput test <- structure(list(Sample = c("A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C"), SSAtype = c("one", "one", "one", "two", "two", "two", "one", "one", "one", "two", "two", "two", "one", "one", "one", "two",

Re: [R] customizing edit.data.frame

2022-05-02 Thread PIKAL Petr
Hallo I do not have much experience with Linux, Rstudio and ESS, but you can customise R startup by .Rprofile.site .Rconsole files which are situated in /etc directory of your installation You can find some info about it in Rintro chapter 10.8 Customizing the environment Cheers Petr >

Re: [R] Violin plots in R

2022-04-01 Thread PIKAL Petr
Hi. Beside advice of others, at least str(yourdata) and the ggplot code is minimum for us to be able to offer some advice. Preferable way how to send your data is output from dput(yourdata) or dput(head(yourdata)) Just copy paste to your email. Cheers Petr > -Original Message- >

Re: [R] pcalg library : estimated DAG graph

2022-03-31 Thread PIKAL Petr
Hallo It is not obvious what is your problem. You maybe should go through some articles about functions in the package. https://pdfs.semanticscholar.org/aee5/cca63aad422c96ee637b5561bb051724d76c.pdf?_ga=2.241710466.1872226166.1648790330-1600227915.1617009045 or maybe you do not have Rgraphviz

Re: [R] NA's in segmented

2022-03-10 Thread PIKAL Petr
Hi 1. Do not use HTML formated mail, your message is scrambled 2. With your code only you can get result all of us get error > Mod = lm(as.numeric(data[,"meanMSD25"])~(as.numeric(data[,"Slice"])), > weights=1*sqrt(as.numeric(data[,"Detec"]))) Error in data[, "meanMSD25"] : object of type

Re: [R] Question About lm()

2022-02-09 Thread PIKAL Petr
Hi Is it enough for explanation? https://stats.stackexchange.com/questions/26176/removal-of-statistically-sig nificant-intercept-term-increases-r2-in-linear-mo https://stackoverflow.com/questions/57415793/r-squared-in-lm-for-zero-interc ept-model Cheers Petr > -Original Message- >

Re: [R] Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed

2022-01-26 Thread PIKAL Petr
ator == 'T13', 1, 0) the most probable source of the error is fc= fairness_check(explainer, protected = prot, privileged = privileged) so you should check explainer and privileged Cheers Petr From: javed khan Sent: Wednesday, January 26, 2022 3:45

Re: [R] Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed

2022-01-26 Thread PIKAL Petr
Hi It seems that you are hiding what you really do. This > options(error = NULL) works fine without any error. So please If you want some reasonable answer post question with data and code which is causing the error. My wild guess is that you have some objects in your environment and you do

Re: [R] Error in if (fraction <= 1) { : missing value where TRUE/FALSE needed

2022-01-26 Thread PIKAL Petr
Hi Do not post in HTML, please. Try to show your real data - use str(test), or preferably dput(test). If test is big, use only fraction of it The problem must be probably in your data. x <- sample(1:20, 100, replace=T) fake <- paste("T", x, sep="") ifelse(fake=="T14", 1,0) [1] 0 0 0 0 0 0 0 0

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread PIKAL Petr
Hallo You should explain better what do you want as many people here do not use tidyverse functions. I am not sure what the function should do. table(iris$Species) give the same result and whatever you do in tidyverse part it always finalise in table(...$Species) Cheers Petr > -Original

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

2022-01-13 Thread PIKAL Petr
Hallo all I do not consider answers here unresponsive or unfriendly. Most answers point to the way how to procced and solve the problems. Although RTFM is sometimes the best what anybody can do (and I did it myself around 1997 when I started with R). Hardly anybody here is flamed when he/she

Re: [R] ggtree node labels

2022-01-09 Thread PIKAL Petr
Hi If you asked google ggtree node label you will get many hits which tell you how to label nodes E.g. https://bioc.ism.ac.jp/packages/3.3/bioc/vignettes/ggtree/inst/doc/treeAnnot ation.html And you will get it much more quickly than by asking here. Cheers Petr > -Original Message- >

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

2022-01-07 Thread PIKAL Petr
l Message- > From: ani jaya > Sent: Friday, January 7, 2022 9:12 AM > To: PIKAL Petr ; r-help > Subject: Re: [R] unexpected (?) behavior of box() > > Hi Petr, > > Thank you for pointing that out! Silly newbie here. > So, just want to make sure my mind, >

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

2022-01-06 Thread PIKAL Petr
Hi. Why do you consider it unexpected? see map(database = "world", regions = ".", exact = FALSE, boundary = TRUE, interior = TRUE, projection = "", parameters = NULL, orientation = NULL, fill = FALSE, col = 1, plot = TRUE, add = FALSE, namesonly = FALSE, xlim = NULL, ylim = NULL, wrap =

Re: [R] splitting data matrix into submatrices

2022-01-05 Thread PIKAL Petr
Hi As Jeff said for data frames you can use split. If you insist to work with matrices, the principle is similar but you cannot use split. mat <- matrix(1:20, 5,4) mat [,1] [,2] [,3] [,4] [1,]16 11 16 [2,]27 12 17 [3,]38 13 18 [4,]49 14 19

Re: [R] how to run r biotools boxM terst on multiple groups?

2022-01-04 Thread PIKAL Petr
Hi. Not sure if statistically correct but what about iris$int<- interaction(iris$bin, iris$Species) boxM(iris[,1:4], iris[,7]) Cheers Petr > -Original Message- > From: R-help On Behalf Of Luigi Marongiu > Sent: Tuesday, January 4, 2022 11:56 AM > To: r-help > Subject: [R] how to run

Re: [R] Multiple Data Import Excel

2022-01-04 Thread PIKAL Petr
Hi Try readxl package which has possibility to limit range of cells for reading. https://cran.r-project.org/web/packages/readxl/readxl.pdf Cheers Petr > -Original Message- > From: R-help On Behalf Of Bradley Heins via > R-help > Sent: Tuesday, January 4, 2022 4:20 AM > To:

Re: [R] mixture univariate distributions fit

2022-01-03 Thread PIKAL Petr
to do my homework if I decided to code such function myself. Thank you again and best regards. Petr > -Original Message- > From: Bert Gunter > Sent: Friday, December 31, 2021 6:57 PM > To: PIKAL Petr > Cc: Ivan Krylov ; r-help mailing list project.org> > Sub

Re: [R] mixture univariate distributions fit

2021-12-31 Thread PIKAL Petr
he only way how to procced is to code such function by myself and take care of suitable starting values. Best regards. Petr > -Original Message- > From: Ivan Krylov > Sent: Friday, December 31, 2021 9:26 AM > To: PIKAL Petr > Cc: r-help mailing list > Subject: Re: [R] mixture

Re: [R] mixture univariate distributions fit

2021-12-30 Thread PIKAL Petr
ew year 2022. Petr > -Original Message- > From: Bert Gunter > Sent: Thursday, December 30, 2021 5:10 PM > To: PIKAL Petr > Cc: r-help mailing list > Subject: Re: [R] mixture univariate distributions fit > > Petr: > > 1. I now am somewhat confused by your goa

Re: [R] mixture univariate distributions fit

2021-12-30 Thread PIKAL Petr
iginal Message- > From: Bert Gunter > Sent: Wednesday, December 29, 2021 5:01 PM > To: PIKAL Petr > Cc: r-help mailing list > Subject: Re: [R] mixture univariate distributions fit > > No. > > However, if the object returned is the "Value" structure of whate

[R] mixture univariate distributions fit

2021-12-29 Thread PIKAL Petr
Dear all I have data which are either density distribution estimate or cummulative density distribution estimate (temp1, temp2 below). I would like to get values (mu, sd) for underlaying original data but they are not available. I found mixtools package which calculate what I need but it

Re: [R] Question about Rfast colMins and colMaxs

2021-12-01 Thread PIKAL Petr
Hi. It is always worth to consult excellent R help. max and min return the maximum or minimum of all the values present in their arguments, as integer if all are logical or integer, as double if all are numeric, and character otherwise. Character versions are sorted lexicographically, and

Re: [R] converting to POSIXct

2021-11-30 Thread PIKAL Petr
Duncan Murdoch > Sent: Tuesday, November 30, 2021 12:05 PM > To: Jim Lemon ; PIKAL Petr > > Cc: r-help mailing list ; Stefano Sofia > > Subject: Re: [R] converting to POSIXct > > On 30/11/2021 3:41 a.m., Jim Lemon wrote: > > Hi, > > Petr is right. Apparentl

Re: [R] converting to POSIXct

2021-11-30 Thread PIKAL Petr
Hi You probably has zero hours in all your data see > temp data_POSIX Sensor_code value 1 2002-11-01 00:00:001694 7.2 2 2002-11-01 00:00:001723 10.8 without hours > as.POSIXct(temp$data_POSIX, format = "%Y-%m-%d %H:%M:%S", tz="Etc/GMT-1") [1] "2002-11-01 +01"

Re: [R] vectorization of loops in R

2021-11-18 Thread PIKAL Petr
Hi above tapply and aggregate, split *apply could be used) sapply(with(df, split(z, y)), mean) Cheers Petr > -Original Message- > From: R-help On Behalf Of Luigi Marongiu > Sent: Wednesday, November 17, 2021 2:21 PM > To: r-help > Subject: [R] vectorization of loops in R > > Hello,

Re: [R] Date

2021-11-04 Thread PIKAL Petr
Hi Not sure why the date format was changed but if I am correct R do not read dates as dates but as character vector. You need to transfer such columns to dates by asDate. The error is probably from your use two asDate commands. Cheers Petr -Original Message- From: R-help On Behalf Of

Re: [R] by group

2021-11-02 Thread PIKAL Petr
Hi Although you got several answers, simple aggregate was omitted. > with(dat, aggregate(wt, list(Year=Year, Sex=Sex), mean)) Year Sexx 1 2001 F 12.0 2 2002 F 13.3 3 2003 F 12.0 4 2001 M 15.0 5 2002 M 16.3 6 2003 M 15.0 you can reshape the result >

Re: [R] customize the step value

2021-10-29 Thread PIKAL Petr
Hi One has to be careful when using fractions in seq step. Although it works for 0.5 > (seq(0,10, .5) - round(seq(0,10,.5),2))==0 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [16] TRUE TRUE TRUE TRUE TRUE TRUE in case of 0.3 (or others) it does not always

Re: [R] Replacing NA s with the average

2021-10-18 Thread PIKAL Petr
Hi. sometimes is worth to try google first R fill NA with average resulted in https://stackoverflow.com/questions/25835643/replace-missing-values-with-col umn-mean and from that library(zoo) na.aggregate(DF) will replace all numeric NA values with column averages. Cheers Petr >

Re: [R] creating a new variable and merging it on the dataframe

2021-10-18 Thread PIKAL Petr
Hi I cannot say anything about mutate but read.csv results in data frame you can use then wbpractice$gap <- with(wbpractice, total.food.exp-total.nfood.exp) Cheers Petr BTW, do not use HTML formating your email is a mess. > -Original Message- > From: R-help On Behalf Of Admire

[R] complicated sequence with preset length

2021-10-12 Thread PIKAL Petr
Dear all I know it is quite easy to get a simple seqence by rep function > c(rep(1:3, 2), rep(4:6,2)) [1] 1 2 3 1 2 3 4 5 6 4 5 6 I could easily get vector of length 24 or 36 using another rep > rep(c(rep(1:3, 2), rep(4:6,2)),2) [1] 1 2 3 1 2 3 4 5 6 4 5 6 1 2 3 1 2 3 4 5 6 4 5 6 >

Re: [R] unexpected behavior in apply

2021-10-11 Thread PIKAL Petr
Hi it is not surprising at all. from apply documentation Arguments X an array, including a matrix. data.frame is not matrix or array (even if it rather resembles one) So if you put a cake into oven you cannot expect getting fried potatoes from it. For data frames sapply or lapply is

Re: [R] adding results to plot

2021-10-07 Thread PIKAL Petr
. Thanks and best regards. Petr > -Original Message- > From: Rui Barradas > Sent: Friday, September 17, 2021 9:56 PM > To: PIKAL Petr ; r-help > Subject: Re: [R] adding results to plot > > Hello, > > *.test functions in base R return a list of class "hte

Re: [R] Strange behavior of 2-d array within function

2021-10-07 Thread PIKAL Petr
Hi I would print/save iteration number to see at what time this occured and probably traceback() could give you some hint. Alternatively you could make a function from your code see ?function and use debug to trace the error. Without some working example it is impossible to see where is the

Re: [R] Need in formatting data for circos plot

2021-10-05 Thread PIKAL Petr
Hm, Maybe if you change > C(-7, 7) Error in C(-7, 7) : object not interpretable as a factor to > c(-7, 7) [1] -7 7 Cheers Petr S pozdravem | Best Regards RNDr. Petr PIKAL Vedoucí Výzkumu a vývoje | Research Manager PRECHEZA a.s. nábř. Dr. Edvarda Beneše 1170/24 | 750 02 Přerov | Czech

Re: [R] adding results to plot

2021-09-17 Thread PIKAL Petr
Thanks Jim This seems to be strightforward and quite simple. I considered addtable2plot but was not sure how to make propper data frame from the result. Regards Petr > -Original Message- > From: Jim Lemon > Sent: Friday, September 17, 2021 2:31 AM > To: PIKAL Petr ; r-

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
his: > > 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

Re: [R] adding results to plot

2021-09-16 Thread PIKAL Petr
Hallo Thanks, I will try wat option is better if yours or Kimmo's Best regards Petr > -Original Message- > From: Bert Gunter > Sent: Thursday, September 16, 2021 5:00 PM > To: PIKAL Petr > Cc: r-help > Subject: Re: [R] adding results to plot > > I was wr

Re: [R] unable to remove NAs from a data frame

2021-09-16 Thread PIKAL Petr
Hi You should consult either complete.cases function or to remove only rows in which are only NAs you could use something like (untested) df[!(colSums(is.na(df))==8),] Cheers Petr > -Original Message- > From: R-help On Behalf Of Ana Marija > Sent: Thursday, September 16, 2021 4:12 PM

[R] adding results to plot

2021-09-16 Thread PIKAL Petr
Dear all I know I have seen the answer somewhere but I am not able to find it. Please help > plot(1,1) > res <- shapiro.test(rnorm(100)) > res Shapiro-Wilk normality test data: rnorm(100) W = 0.98861, p-value = 0.5544 I would like to add whole res object to the plot. I can do it one

Re: [R] How to globally convert NaN to NA in dataframe?

2021-09-03 Thread PIKAL Petr
Hi Luigi. Weird. But maybe it is the desired behaviour of summary when calculating mean of numeric column full of NAs. See example dat <- data.frame(x=rep(NA, 110), y=rep(1, 110), z= rnorm(110)) # change all values in second column to NA dat[,2] <- NA # change some of them to NAN dat[5:6, 2:3]

Re: [R] Loop over columns of dataframe and change values condtionally

2021-09-02 Thread PIKAL Petr
Hi you could operate with whole data frame (sometimes) head(iris) Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2

Re: [R] How to globally convert NaN to NA in dataframe?

2021-09-02 Thread PIKAL Petr
Hi what about data[sapply(data, is.nan)] <- NA Cheers Petr > -Original Message- > From: R-help On Behalf Of Luigi Marongiu > Sent: Thursday, September 2, 2021 3:18 PM > To: r-help > Subject: [R] How to globally convert NaN to NA in dataframe? > > Hello, > I have some NaN values in

Re: [R] Converting characters back to Date and Time

2021-09-01 Thread PIKAL Petr
Hi You can use as.POSIXct function https://stackoverflow.com/questions/19172632/converting-excel-datetime-seria l-number-to-r-datetime But you should preferably try to read the date as character vector and then convert it to date and time. Cheers Petr > -Original Message- > From:

Re: [R] Selecting elements

2021-08-24 Thread PIKAL Petr
ult[[i]] <- sss[[i]][1:selection[i],] } Maybe someone come with other ingenious solution. Cheers Petr From: Silvano Cesar da Costa Sent: Monday, August 23, 2021 7:54 PM To: PIKAL Petr Cc: r-help@r-project.org Subject: Re: [R] Selecting elements Hi, I apologize for the confusion. I will t

Re: [R] Selecting elements

2021-08-23 Thread PIKAL Petr
alue is in D so either 3A - 3B - 2C - 2D or 3A - 3B - 2C - 2D should be appropriate. And here I am again lost as both sets are same. Maybe you need to reconsider your statements. Cheers Petr From: Silvano Cesar da Costa Sent: Friday, August 20, 2021 9:28 PM To: PIKAL Petr Cc: r-help@r-project.

Re: [R] Selecting elements

2021-08-20 Thread PIKAL Petr
Hallo I am confused, maybe others know what do you want but could you be more specific? Let say you have such data set.seed(123) Var.1 = rep(LETTERS[1:4], 10) Var.2 = sample(1:40, replace=FALSE) data = data.frame(Var.1, Var.2) What should be the desired outcome? You can sort data <-

Re: [R] Getting different results with set.seed()

2021-08-19 Thread PIKAL Petr
Alam Sent: Thursday, August 19, 2021 10:10 AM To: PIKAL Petr Cc: r-help mailing list Subject: Re: [R] Getting different results with set.seed() Dear Petr, It is more than 2000 lines of code with a lot of functions and data inputs. I am not sure whether it would be useful to upload it. However

Re: [R] Getting different results with set.seed()

2021-08-19 Thread PIKAL Petr
Hi Please provide at least your code preferably with some data to reproduce this behaviour. I wonder if anybody could help you without such information. My wild guess is that you used set.seed(1234) some code the code used again in which case you have to expect different results. Cheers

Re: [R] Rolling 7 day incidence

2021-08-17 Thread PIKAL Petr
-08-13 63.1 > 5 2021-08-12 62.8 > 6 2021-08-11 63.7 > 7 2021-08-10 67.3 > 8 2021-08-09 69.3 > 9 2021-08-08 69.2 >10 2021-08-07 74.5 ># … with 563 more rows > > which seems to be correct :-)-O so I can now

Re: [R] Rolling 7 day incidence

2021-08-17 Thread PIKAL Petr
Hi. There are several ways how to do it. You could find them easily using Google. e.g. https://stackoverflow.com/questions/19200841/consecutive-rolling-sums-in-a-vector-in-r where you find several options. Cheers Petr > -Original Message- > From: R-help On Behalf Of Dr Eberhard >

Re: [R] Sanity check in loading large dataframe

2021-08-09 Thread PIKAL Petr
quot; NA y[which(x<5)] [1] "a" "c" "d" dat <- data.frame(x,y) dat[x<5,] xy 1 1a NA NA 3 3c 4 4d NA.1 NA > dat[which(x<5),] x y 1 1 a 3 3 c 4 4 d Both results are OK, but one has to consider this NA value propagatio

Re: [R] Sanity check in loading large dataframe

2021-08-06 Thread PIKAL Petr
Hi You already got answer from Avi. I often use dim(data) to inspect how many rows/columns I have. After that I check if some columns contain all or many NA values. colSums(is.na(data)) keep <- which(colSums(is.na(data)) -Original Message- > From: R-help On Behalf Of Luigi Marongiu >

Re: [R] Cumulates of snowfall within a given interval

2021-07-30 Thread PIKAL Petr
Hi I would use ?embed function. nr <- which(rowSums(embed(mydf$hn, 2))>=80) mydf[nr,] But I feel strange that variant 40,50 should be accepted but 0, 90 should not. Both after two consecutive days result in more than 80cm cumulative snow. What about 1,80 how it differs from 0, 81. basically

  1   2   3   4   5   6   7   8   9   10   >