Re: [R] replace character by numeric value

2023-09-28 Thread Ivan Calandra
Dear Arnaud, I don't quite unterstand why you have imbricated ifelse() statements. Do you have more that BUY (1) and SELL (-1)? If not, why not simply: mynewdf2 <- mydf2 |> dplyr::mutate(side = ifelse(side == 'BUY', 1, -1)) That would solve the problem. I'm not quite sure exactly what

Re: [R] How to fix this problem

2023-09-25 Thread Ivan Calandra
Dear David, simply check str(KD6). My guess (because we don't have your dataset, only a print of it) is that KD6 is not a matrix but a data.frame. The problem seems to come from the column "E..coli" which contains commas instead of periods (so text and not number). There might be other issues

Re: [R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
(. ~ RAWMAT, data = my_data[-1], FUN = mean, na.rm = TRUE, na.action = na.pass) Cheers, Ivan On 04/09/2023 13:56, Rui Barradas wrote: Às 12:51 de 04/09/2023, Ivan Calandra escreveu: Thanks Rui for your help; that would be one possibility indeed. But am I the only one who finds that behavior

Re: [R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
= TRUE) to calculate the group stats. Best wishes, Ivan On 04/09/2023 13:46, Rui Barradas wrote: Às 10:44 de 04/09/2023, Ivan Calandra escreveu: Dear useRs, I have just stumbled across a behavior in aggregate() that I cannot explain. Any help would be appreciated! Sample data: my_data

Re: [R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
issing data. > > Iago > ---- > *De:* R-help de part de Ivan Calandra > > *Enviat el:* dilluns, 4 de setembre de 2023 11:44 > *Per a:* R-help > *Tema:* [R] aggregate formula - differing results > Dear useRs, > &g

[R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
names = c(1L, 2L, 3L, 4L, 5L, 111L, 112L, 113L, 114L, 115L), class = "data.frame") aggregate(cbind(EdgeLength, SurfaceArea, Length, Width) ~ RAWMAT, data = my_data2, FUN = mean, na.rm = TRUE) aggregate(. ~ RAWMAT, data = my_data2[-1], FUN = mean, na.rm = TRUE) group_by(my_data2, RAWMAT)

Re: [R] Pipe operator

2023-01-03 Thread Ivan Calandra
Maybe I missed it in the whole discussion, but since R 4.2.0 the base R pipe operator also has a placeholder '_' to specify where the result of the left-hand side should be used in the right-hand side (see https://stat.ethz.ch/pipermail/r-announce/2022/000683.html). So the only difference in

Re: [R] Pipe operator

2023-01-03 Thread Ivan Calandra
much better than I can. In any case, once I started using it, I realized that all the pros for the pipe operator are real and now I like using it! Best, Ivan *LEIBNIZ-ZENTRUM* *FÜR ARCHÄOLOGIE* *Dr. Ivan CALANDRA* **Imaging Lab MONREPOS Archaeological Research Centre, Schloss Monr

Re: [R] Confusing fori or ifelse result in matrix manipulation

2022-04-25 Thread Ivan Calandra
nce and are based on data contained in another vector. Where that vector comes from is important too because the whole thing might be unnecessary. Is that maybe what you were hinting at, Bert? Maybe Uwe can tell us more about what/why he wants to do! Ivan -- Dr. Ivan Calandra Imaging lab R

Re: [R] Confusing fori or ifelse result in matrix manipulation

2022-04-25 Thread Ivan Calandra
lue with the same shape as test||". So, because x[i] == 0 returns a single value (TRUE or FALSE), ifelse will also return a single value (either A[, i][1] or 0) and not a vector of length 3 as you wanted. This single value is recycled to fill M[, i], hence the result. HTH, Ivan -- Dr. Iva

Re: [R] conditional filling of data.frame - improve code

2022-03-11 Thread Ivan Calandra
In my first trials, I made a typo, which resulted in more columns than needed in the output of merge, which is why I needed more formatting. But now, it is indeed done all in one line and it is, as I said already, nicer anyway! -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological

Re: [R] placeholder for native pipes

2022-03-09 Thread Ivan Calandra
Dear Jeff, Thank you for the hint. I had read about it. While it is quite useful, I doubt that any of my colleagues would understand the construct... Waiting for the placeholder :) Best, Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos

Re: [R] placeholder for native pipes

2022-03-09 Thread Ivan Calandra
Thank you Ivan for the info. That's exciting! Do you also know for which R release it is planned? Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra

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

2022-01-13 Thread Ivan Calandra
list! My $0.02 Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra From: R-help on behalf of Duncan Murdoch Sent: T

Re: [R] Format dates issues with R

2021-12-14 Thread Ivan Calandra
Dear Luigi, Quickly, I spot two problems: 1) "09/20/2021" can only be month/day/year (and not day/month/year as you specified). 2) The year is given with century, so it should be upper case Y So as.Date(ori[[n[3]]], format = "%m/%d/%Y") should work. HTH, Ivan -- Dr. I

Re: [R] ggsave() with width only

2021-09-21 Thread Ivan Calandra
Dear Adam, This would work indeed, but then the default aspect ratio (1.618) would be used. I could as well calculate the height from the width and aspect ratio. Unfortunately, this doesn't help me in my case (but as I said, I have found a workaround). Thank you again. Ivan -- Dr. Ivan

Re: [R] ggsave() with width only

2021-09-20 Thread Ivan Calandra
a workaround using the package patchwork: I put the plots together into one plot, that I save on an A4 page. Best, Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile

Re: [R] ggsave() with width only

2021-09-14 Thread Ivan Calandra
Thank you Adam! I'm a bit surprised that an extra package is needed for this, but why not! Best, Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra

Re: [R] ggsave() with width only

2021-09-06 Thread Ivan Calandra
it and, as it is, I am not sure it would be worth the effort. I might be missing some arguments for it, but I would actually like someone to show me how it could look like - this might just be what I need to be convinced! -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre

Re: [R] ggsave() with width only

2021-09-06 Thread Ivan Calandra
including plots and extra plots as PDF, I cannot use pdf(). That's why I use ggsave(). Or am I missing something? Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile

[R] ggsave() with width only

2021-09-06 Thread Ivan Calandra
the height nor the aspect ratio? If I specify the width only, the plots are truncated in width because the aspect ratio is not correct. Thank you for the tip! Ivan -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631

Re: [R] combining geom_boxplot and geom_point with jitter

2021-09-06 Thread Ivan Calandra
Thank you very much Rui! -- Dr. Ivan Calandra Imaging lab RGZM - MONREPOS Archaeological Research Centre Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra On 04/09/2021 18:22, Rui Barradas wrote: Hello, The problem is that you

[R] combining geom_boxplot and geom_point with jitter

2021-09-02 Thread Ivan Calandra
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1

Re: [R] md5sum issues

2021-02-04 Thread Ivan Calandra
, but not necessarily or exclusively for other projects). Best wishes, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243

Re: [R] md5sum issues

2021-02-03 Thread Ivan Calandra
realized this doesn't help much. Then I tried with MD5 and I thought it was solved, but it was obviously not solved. Duncan solution seems to work (I have not fully checked yet, though), but I am really open to other, more robust alternatives. Thanks for the input! Ivan -- Dr. Ivan Calandra TraCEr

Re: [R] md5sum issues

2021-02-03 Thread Ivan Calandra
Thank you very much Duncan for your help. I'll try that. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243

Re: [R] md5sum issues

2021-02-03 Thread Ivan Calandra
place to start. Or am I missing something (I am still a newbie on these things...)? Ivan C -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany

Re: [R] md5sum issues

2021-02-02 Thread Ivan Calandra
Thank you Jeff for the pointer. If it's not an R issue, I guess it will be difficult to solve... But maybe there is a workaround using R, like using another function or editing the files...? Does anyone have any idea? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled

[R] md5sum issues

2021-02-02 Thread Ivan Calandra
me sorting it out. Thank you in advance, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772

Re: [R] merged data frame with

2020-09-29 Thread Ivan Calandra
, or better a reproducible example using dput(). For the second part, your syntax was not correct (subsetting a column for elements based on a column that is not part of the subset!). And there is no column "pch" in your example. Try: df3[df3$event == "start", "event"]

Re: [R] facet_wrap(nrow) ignored

2020-09-10 Thread Ivan Calandra
any other R-related emails. Are there few today or is it just me? There might even be more answers to my question... -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Mo

[R] facet_wrap(nrow) ignored

2020-09-09 Thread Ivan Calandra
ets is that this facet plot is part of a patchwork and I would like to have the same number of rows for all facet plots of the patchwork (so that they all align well). Is there a way to force the number of rows in the facet_wrap()? Thank you in advance. Best, Ivan -- -- Dr. Ivan Calandra TraCEr, laborat

Re: [R] & and |

2020-08-21 Thread Ivan Calandra
Thank you Bert, this is wonderful! Best wishes, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https

Re: [R] select() columns using their positions

2020-08-20 Thread Ivan Calandra
OK, my bad... I'm sure I had tried it and it didn't work, but I guess the error was somewhere else... Thank you! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss

[R] select() columns using their positions

2020-08-20 Thread Ivan Calandra
ng "[", but I expected it would be possible with select() as well; it would make the code more readable than: mydata %>%   .[ vector_of_indices ] Thank you for your help. Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological

Re: [R] combine filter() and select()

2020-08-20 Thread Ivan Calandra
-1 vector. But my real goal is not to end up with a single value or even a single column. I just thought that simplifying my example was the best approach to ask for advice. But thank you for letting me know that what I'm doing is pointless! Ivan -- Dr. Ivan Calandra TraCEr, laboratory

Re: [R] combine filter() and select()

2020-08-20 Thread Ivan Calandra
I'm using tidyverse the proper way :) Best regards, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772

Re: [R] & and |

2020-08-20 Thread Ivan Calandra
Thank you all for all the very helpful answers! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https

Re: [R] & and |

2020-08-19 Thread Ivan Calandra
Indeed! I was just hoping that there would be a shorter way... intersect() is a nice alternative too. Maybe I can make it work with pipes so that I don't have to repeat "mydata" but that's another story. Thank you for the help! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for

Re: [R] & and |

2020-08-19 Thread Ivan Calandra
Thank you Bert for the pointer. So I guess the solution is: grep("ConfoMap.+GuineaPigs", mydata, value=TRUE) This is not the case here, but what if "GuineaPigs" comes before "ConfoMap"? Of course I could do two "grep()" calls, but if there a better solu

Re: [R] & and |

2020-08-19 Thread Ivan Calandra
Thank you Eric, I didn't think about intersect(). Now I'm trying to do that in tidyverse with pipes, and I think that's too much for me for now! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human

[R] combine filter() and select()

2020-08-19 Thread Ivan Calandra
= c("tbl_df", "tbl", "data.frame")) I want to subset the rows with "a" in the column "files", and keep only that column. So I did: myfile <- mytbl %>%   filter(grepl("a", files)) %>%   select(files) It works, but I believe there must

[R] & and |

2020-08-19 Thread Ivan Calandra
a, value=TRUE) it returns an empty vector, character(0). But if I do: grep("ConfoMap|GuineaPigs", mydata, value=TRUE) it returns all the elements that include either "ConfoMap" or "GuineaPigs", as I would expect. So what is wrong with my "&" constru

Re: [R] Best settings for RStudio video recording?

2020-08-18 Thread Ivan Calandra
Thank you again Duncan for the details. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https

Re: [R] Best settings for RStudio video recording?

2020-08-17 Thread Ivan Calandra
stallation of RStudio... Is there a way to identify (and delete, if wished) these packages? Or have I misunderstood? Thank you! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schlos

Re: [R] install.packages() R vs RStudio

2020-08-17 Thread Ivan Calandra
Thank you Duncan for the very detailed and clear answer! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243

[R] install.packages() R vs RStudio

2020-08-17 Thread Ivan Calandra
in code) about installing packages through RStudio. In general, it would be nice to have a list of the differences in behavior between R and RStudio, but I believe this should come from the RStudio side of things. Thank you all for the insights. Ivan -- Dr. Ivan Calandra TraCEr, laboratory

Re: [R] Output multiple sheets to Excel files with openxlsx::write.xlsx

2020-05-27 Thread Ivan Calandra
Hi, Rather than creating a workbook as suggested by Enrico, you can simply supply a list to write.xlsx(); each element will be saved in a separate sheet: write.xlsx(list(a = df1, b = df2), file = fl_out) That is not really appending, but that might work for you. HTH, Ivan -- Dr. Ivan Calandra

Re: [R] ggplot get rid of unused/empty facets

2020-04-30 Thread Ivan Calandra
Dear Petr, This is not a ggplot2 solution, but you could just remove the NA rows and drop the levels of vzorek: met2 <- met[complete.cases(met), ] met2$vzorek <- droplevels(met2$vzorek) But I guess you already thought about that...! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Trac

Re: [R] ggplot2 error bars and convex hulls

2020-04-22 Thread Ivan Calandra
Thanks Rui for these 2 possibilities; I'll have a look. Any one with pointers for the error bars issue? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos

[R] ggplot2 error bars and convex hulls

2020-04-21 Thread Ivan Calandra
estions/22805/how-to-draw-neat-polygons-around-scatterplot-regions-in-ggplot2 Thank you in advance for any pointer. Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos

Re: [R] ncol() vs. length() on data.frames

2020-04-07 Thread Ivan Calandra
Dear Hervé, This is indeed a wise recommendation; I hadn't thought about colnames() vs. names(), and in general 2D vs. list notations. I will have to edit a bit more than I thought. Thank you all for all these hints! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology

Re: [R] ncol() vs. length() on data.frames

2020-04-06 Thread Ivan Calandra
Thank you Greg for the insights! I agree with you that the decrease in speed is not worth the decrease in readability, and I'll change my length() calls to ncol(). Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
Thanks Jeff, I was just completely unaware of these options! Now I know. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0

Re: [R] project path in Rmd (Ivan Calandra)

2020-04-02 Thread Ivan Calandra
with the here package. IMHO, this functionality should be more advertised; this seems to me to be the greatest advantage of using it! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra On 02/04/2020 11:02, Ivan Ca

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
ven better if it could be applied generically. As I said, ideally, I would like to get the project directory from a script located in a subfolder. Thanks! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human B

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
So what you're saying is that I should have scripts in the project directory and not in a subfolder within it, right? But what if I need (or at least want) to? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre

Re: [R] project path in Rmd

2020-04-02 Thread Ivan Calandra
Hi Jeff, But if I do not use setwd(), the current working directory is NOT the project directory. That's what my problem is about... I guess I was not clear in my email... Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research

[R] project path in Rmd

2020-04-02 Thread Ivan Calandra
be nice is a way to get the project directory in the scripts, rather than their working directory. Does that make sense? Thank you in advance Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human

Re: [R] ncol() vs. length() on data.frames

2020-03-31 Thread Ivan Calandra
Thanks Matthias for the details! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net

Re: [R] ncol() vs. length() on data.frames

2020-03-31 Thread Ivan Calandra
to create unexpected results. Thank you, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.n

Re: [R] ncol() vs. length() on data.frames

2020-03-31 Thread Ivan Calandra
That's exactly why I was asking if it really is equivalent and if there are issues using one function or the other -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos

Re: [R] ncol() vs. length() on data.frames

2020-03-31 Thread Ivan Calandra
Thanks Eric, I know that, but that doesn't really answer my question, does it? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0

[R] ncol() vs. length() on data.frames

2020-03-31 Thread Ivan Calandra
-- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra

Re: [R] file.choose()

2020-03-03 Thread Ivan Calandra
overrides this behavior. I still find it strange that my second and third examples behave differently. Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567

Re: [R] file.choose()

2020-03-03 Thread Ivan Calandra
ot; file.choose() ## unexpectedly, opens in "C:/Users/.../Documents" setwd("D:/Data") getwd() [1] "D:/Data" file.choose() ## opens in "D:/Data" as expected Is that normal behavior? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Expe

Re: [R] citing old(er) versions of packages

2020-01-17 Thread Ivan Calandra
Dear Marc, Thank you, exactly what I needed! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https

[R] citing old(er) versions of packages

2020-01-16 Thread Ivan Calandra
? Thank you in advance. Best regards, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net

Re: [R] regex

2019-09-17 Thread Ivan Calandra
Thank you Bert. That's more like what I was looking for. Could you please tell me where I can find information on the "\\1"? This is the part I still don't get. Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Resea

Re: [R] regex

2019-09-17 Thread Ivan Calandra
Thanks Jeff! It does indeed make sense that there is no "AND" corresponding to the "|". Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Mo

Re: [R] regex

2019-09-17 Thread Ivan Calandra
the second problem is actually unfortunately even more complicated to me than the gsub() solution. But I'm glad I can learn about regmatches() and regexpr()! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum f

[R] regex

2019-09-17 Thread Ivan Calandra
<- c("dist to origin on curve [mm]","segment on section [mm]", "angle 1 [degree]", "angle 2 [degree]","angle 3 [degree]") units.var <- gsub(pattern="^.*\\[|\\]$", "", headers) It seems to be to overly complicated

[R] Fwd: Re: Column 'xyz' does not exist

2019-07-30 Thread Ivan Calandra
I have no idea about Tibble... [Reply to the list if you want helpful answers ;) ] Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany

Re: [R] Column 'xyz' does not exist

2019-07-30 Thread Ivan Calandra
Hi, I would guess that your data object (matrix, data.frame?) does not have a column called "Previous_stage". Maybe you just misspelled it; remember that R is case-sensitive. Please forgive me if I'm completely off! HTH, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for

Re: [R] convert microns to nm in a messy dataset [solved]

2019-05-13 Thread Ivan Calandra
de by 1000. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Caland

Re: [R] convert microns to nm in a messy dataset

2019-05-13 Thread Ivan Calandra
emi-colons and "if... else" statements, so I cannot really test it. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0)

[R] convert microns to nm in a messy dataset

2019-05-10 Thread Ivan Calandra
#", "2019/05/10", "#", "#", "#", "2019/05/10", "#", "#", "#", "2019/05/10", "2019/05/10"), V19 = c("0.2012800083", "45", "Sq", "µm", "0.3634383236&qu

Re: [R] Obtaining values of estimates from a regression; How do I get values from a list?

2019-02-22 Thread Ivan Calandra
I find that the str() function is really helpful to understand how an object is structured, and therefore how to extract part(s) of it. Try for example: str(zz) and it might help you understand why zz$coefficients[2,1] is what you were looking for. HTH Ivan -- Dr. Ivan Calandra TraCEr

Re: [R] differing behavior of mean(), median() and sd() with na.rm

2018-08-23 Thread Ivan Calandra
of course. I can still convert NaN to NA at the end if I need to. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631

[R] differing behavior of mean(), median() and sd() with na.rm

2018-08-22 Thread Ivan Calandra
[1] NAsd(x, na.rm=TRUE) [1] NA Thanks for any feedback. Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 ht

Re: [R] Saving objects in RData file in different name

2018-07-30 Thread Ivan Calandra
Hi! In those cases, I use R.utils::saveObject() and loadObject(). You would have to save each object separately though: saveObject(x1, file="file.Rbin") y <- loadObject(file="file.Rbin") HTH Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controll

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Ivan Calandra
I'm not sure though why one would need that. Why not use lists in that case? Thanks! Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Ivan Calandra
Just for my understanding: Is a data.frame with list columns still a data.frame? Isn't it then a list? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567

Re: [R] aggregate and list elements of variables in data.frame

2018-06-07 Thread Ivan Calandra
Using which() to subset t$id should do the trick: sapply(levels(t$A), function(x) t$id[which(t$A==x)]) Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos

Re: [R] aggregate and list elements of variables in data.frame

2018-06-06 Thread Ivan Calandra
Hi Massimo, Something along those lines could help you I guess: t$A <- factor(t$A) sapply(levels(t$A), function(x) which(t$A==x)) You can then play with the output using paste() Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeologi

Re: [R] Removing a data subset

2017-11-29 Thread Ivan Calandra
.formula'), although the ggplot() function doesn't seem to have it. In any case, I would recommend you spend some time learning that aspect, as you will always need it in one situation or another. HTH, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MON

Re: [R] Dataframe is character

2017-11-17 Thread Ivan Calandra
Good one, did not even notice that...! -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.researchgate.net

Re: [R] Dataframe is character

2017-11-17 Thread Ivan Calandra
Hi Roberto, This often happens when there are some non-numeric characters. You would have to check it. Without more information, e.g. dput(dat), you will have to find by yourself. HTH, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS

Re: [R] Graph f(x) = 1/x

2017-09-19 Thread Ivan Calandra
It's always good to start a new session when you don't understand what's wrong, because sometimes your code is correct, but you use old data without knowing it :) Ivan -- Dr. Ivan Calandra TraCEr, Laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre

Re: [R] An R question

2017-06-07 Thread Ivan Calandra
Hi, Check the FAQ 7.31 https://cran.rstudio.com/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f And read the posting guide too... https://www.r-project.org/posting-guide.html HTH, Ivan -- Dr. Ivan Calandra TraCEr, Laboratory for Traceology and Controlled Experiments

Re: [R] About change columns and specific rows in R

2017-05-23 Thread Ivan Calandra
n the square brackets, the vector before the comma indexes the rows and the one after the comma indexes the columns. The other thing you were missing correctly referencing the rows. You have to specify the data.frame you want to look into. And last, learn to use dput() to provide a nice reproducible ex

Re: [R] Wilcoxon Test

2017-04-21 Thread Ivan Calandra
Another oddity is the legend of the SAS output, which does not correspond to the data in the output itself (but corresponds to the R values with correct=TRUE)! Could the SAS documentation have some errors? I don't have SAS installed so cannot test the code. Ivan -- Dr. Ivan Calandra TraCEr,

Re: [R] Managing axis labels

2017-03-28 Thread Ivan Calandra
Hi Jamil, You first need to specify 'xaxt' and 'yaxt' in your plot() call, and then you can set the size of the labels with cex.axis: plot(x, y, xlab=expression(vartheta), ylab="Concentration", xaxt="n", yaxt="n")axis(1, cex.axis=3) axis(2, cex.axis=2) HT

Re: [R] Beginner needs help with R

2017-02-06 Thread Ivan Calandra
Hi Nabila, This is because you ask to create a sequence with seq(), which does not make much sense with non numeric data. That's why R trims the 0. One alternative would be: seq2 <- paste("DQ0", seq(60054, 60060), sep = "") Would that work for you? HTH, Ivan -- Ivan

Re: [R] legend in ggplot2

2017-02-02 Thread Ivan Calandra
-- Ivan Calandra, PhD MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany calan...@rgzm.de +49 (0) 2631 9772-243 https://www.researchgate.net/profile/Ivan_Calandra https://rgzm.academia.edu/IvanCalandra https://publons.com/author

[R] legend in ggplot2

2017-02-02 Thread Ivan Calandra
Spot", "Measurement", "Value"), row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 115L

Re: [R] Source into a specified environment

2017-01-09 Thread Ivan Calandra
Hi Georg, Not sure how it would work in your case, but the 'local' argument to source() is not only TRUE or FALSE; you can also specify an environment. HTH, Ivan -- Ivan Calandra, PhD MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567

Re: [R] scatter plot of numerical variables against different sample ids

2016-12-05 Thread Ivan Calandra
at=datf$Sample2, labels=datf$Sample) It might not be the easiest/best approach though... Someone here might have a better idea. HTH, Ivan -- Ivan Calandra, PhD MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany calan...@rgz

Re: [R] Matching/checking for occurence when values are double?

2016-09-09 Thread Ivan Calandra
Hi, Not sure, but it seems that your function equal() is exactly what all.equal() does, isn't it? Ivan -- Ivan Calandra, PhD Scientific Mediator University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.calan...@univ

  1   2   3   4   5   6   7   >