Re: [R] Scatterplot3d :: Rotating x tick labels by x degrees
Hi Alex, this should be related to the "las" argument of "par()" but actually it does not seem to be parametered in scatterplot3d. Searching the net for "scatterplot3d las" provides a link to: https://stackoverflow.com/questions/25458652/specifying-the-orientation-of-the-axes-labels-in-scatterplot3d You may try the solution that is provided in this link or consider using alternate packages (like rgl or the plotly packages which one may be more powerfull as far as I can judge). However I can't help more. It seems ggplot does not produce 3d plots (but it looks like it can interact with plotly when using 3d plots). Olivier. On Mon, 30 Oct 2017 23:56:02 + Alex Restrepo wrote: > Hi, > > I would like to rotate the x axis tick labels by 45 degrees. Using > the code below, could someone please provide an example? Many > Thanks In Advance, Alex > > library("scatterplot3d") > mydf=data.frame(rate=seq(158, 314) > ,age=seq(1, 157) > ,market_date=seq(as.Date("2000/1/1"), as.Date > ("2003/1/1"), by="7 days")) > > mydf$market_date=as.Date(mydf$market_date, format="%Y-%m-%d") > > scatterplot3d(mydf$market_date > ,mydf$rate > ,mydf$age > ,x.ticklabs = seq(as.Date("2000/1/1"), as.Date > ("2003/1/1"), by="330 days")) > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD /Assistant Professor/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes /Guest Researcher/ @UMCG (University Medical Center Groningen) ENT department Rijksuniversiteit Groningen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question
Hi, I think he's talking about how much a statistical estimator is influenced by extreme datapoints, e.g. https://en.m.wikipedia.org/wiki/Robust_statistics#Breakdown_point Olivier -- Olivier Crouzet Assistant Professor @LLING UMR6310 - Université de Nantes / CNRS Guest Scientist @UMCG - University Medical Center Groningen / RijksUniversiteit Groningen > Le 19 avr. 2018 à 11:00, Keith Jewell a écrit > : > >> On 15/04/2018 17:26, Marc Girondot via R-help wrote: >>> Le 15/04/2018 à 17:56, alireza daneshvar a écrit : >>> break-down point >> Can you explain more what you plan to do and give an example of what you >> have tried to do until now to do a "break down point" in R. Perhaps a "break >> down point" is common in your field, but I have no idea about what it is ! >> https://en.wikipedia.org/wiki/Breakdown_(1997_film) >> Sincerely >> Marc > Perhaps the OP means "breakpoint" in which case the 'strucchange' package > might be relevant > <https://cran.r-project.org/web/packages/strucchange/index.html> > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] display double dot over character in plotmath?
> > __________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html and provide commented, > > minimal, self-contained, reproducible code. > > > > > -- > Important Notice: This mailbox is ignored: e-mails are set to be > deleted on receipt. Please respond to the mailing list if > appropriate. For those needing to send personal or professional > e-mail, please use appropriate addresses. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD /Assistant Professor/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes /Guest Researcher/ @UMCG (University Medical Center Groningen) ENT department Reijksuniversiteit Groningen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Creating/Reading a complex string in R
On Tue, 18 Jul 2017 22:35:17 +0530 Christofer Bogaso wrote: > Thanks for your pointer. > > Is there any way in R how to replace " ' " with " /' " > programmatically? > Hi, perhaps you should simply read the content of a corresponding text file? There's a simple way using the readr package. Using this package, you can store the content of a whole file as a single string. I haven't used it... but if you do choose this way, you should investigate how it stores / mangages end-of-lines. #install.packages(readr) library(readr) temp <- read_file('file.txt') You can then process the string that is contained in the temp variable as you wish to. Olivier. > My actual string is quite lengthy, so changing it manually may not be > possible. I am aware of gsub() function, however not sure I can apply > it directly on my original string. > > Regards, > > On Tue, Jul 18, 2017 at 10:27 PM, John McKown > wrote: > > Try: > > > > String = ' > > > >
Re: [R] Read text file
Hi, I think that you need scan() but you should at least give us an example of your text data. Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Université de Nantes -Original Message- From: Steven Yen Sender: "R-help" Date: Thu, 18 Jun 2015 01:10:39 To: r-help Reply-To: sye...@gmail.com Subject: [R] Read text file How do I read a block of space-delimited numbers into a column vector using the read.table command? Thank you. -- Steven Yen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] abline?
> > > > plot(r2,d) > > res = lm(r2~d) > > > Mixing up your x and y coordinate. Do: > > plot(d,r2) ... or use: plot(r2 ~ d) so that res <- lm(r2 ~ d) uses exactly the same pattern... Olivier. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] save structure to be accesible later
Hi, have a look at save() and load(). You can save part of your workspace to a file (save()) and load it from this file (load()). Of course the file format is R specific (but its specifications are free) You may easily share the file with other R users. Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Université de Nantes -Original Message- From: Alaios via R-help Sender: "R-help" Date: Thu, 5 Feb 2015 12:57:42 To: R-help Mailing List Reply-To: Alaios Subject: [R] save structure to be accesible later Dear all,I have a function that returns the following list. At the end I will call my function 1000 times and I want to keep for each of these 1000 "results" (the structure as given below)in an order to be accessible later (Load the 1000 results and access them within a for loop for example) How should I approach the issue?I would like to thank you for your exampleRegardsAlex P,S The result of my function str(fitcass1) List of 10 $ parameters :'data.frame': 2 obs. of 3 variables: ..$ pi : num [1:2] 0.833 0.167 ..$ mu : num [1:2] 8828 11 ..$ sigma: num [1:2] 18085 1543 $ se :'data.frame': 2 obs. of 3 variables: ..$ pi.se : num [1:2] NA NA ..$ mu.se : num [1:2] NA NA ..$ sigma.se: num [1:2] NA NA $ distribution: chr "gamma" $ constraint :List of 8 ..$ conpi : chr "NONE" ..$ conmu : chr "NONE" ..$ consigma: chr "NONE" ..$ fixpi : NULL ..$ fixmu : NULL ..$ fixsigma: NULL ..$ cov : NULL ..$ size : NULL $ chisq : num 52.4 $ df : num 5 $ P : num 4.57e-10 $ vmat : num [1:5, 1:5] NA NA NA NA NA NA NA NA NA NA ... $ mixdata :Classes ‘mixdata’ and 'data.frame': 11 obs. of 2 variables: ..$ X : num [1:11] 1e+04 2e+04 3e+04 4e+04 5e+04 6e+04 7e+04 8e+04 9e+04 1e+05 ... ..$ count: int [1:11] 993 137 82 30 21 5 7 14 21 2 ... $ usecondit : logi FALSE - attr(*, "class")= chr "mix" [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Impute time-series data, perhaps with a Kalman filter - do you know of any R code?
Hi, searching for "kalman filter R" gives this paper that was published in JSS. It may help. @article{Tusell:2010:JSSOBK:v39i02, author = "Fernando Tusell", title = "Kalman Filtering in R", journal = "Journal of Statistical Software", volume = "39", number = "2", pages = "1--27", day = "1", month = "3", year ="2011", CODEN = "JSSOBK", ISSN ="1548-7660", bibdate = "2010-08-17", URL = "http://www.jstatsoft.org/v39/i02";, accepted ="2010-08-17", acknowledgement = "", keywords ="", submitted = "2010-01-12", } 15:23:00 -0500 "John Sorkin" wrote: > Does anyone have code that uses a Kalman filter to impute time-series > data? If not, do you know of any software that can be used to impute > time-series data? Thank you, John > John David Sorkin M.D., Ph.D. > Professor of Medicine > Chief, Biostatistics and Informatics > University of Maryland School of Medicine Division of Gerontology and > Geriatric Medicine Baltimore VA Medical Center > 10 North Greene Street > GRECC (BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) > > Confidentiality Statement: > This email message, including any attachments, is for ...{{dropped:28}} __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need help with R in Boston area this Friday-Sunday paid gig
This list is not here to do your homework... Even if you plan to pay ! Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Université de Nantes -Original Message- From: Richard Lerner Sender: r-help-bounces@r-project.orgDate: Tue, 23 Sep 2014 22:20:07 To: Reply-To: richa...@uchicago.edu Subject: [R] Need help with R in Boston area this Friday-Sunday paid gig I have a project that I have to do this Friday-Sunday. I have 2 dirty excel spreadsheets that I need brought into R, cleaned up, and then some descriptive statistics run. I am very new to R and not having fun. I can pay, but you will need to 1) be expert and 2) be willing to show me how the work is done and 3) be patient. respond if interested. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to calculate a numeric's digits count?
Le Fri, 24 Oct 2014 14:11:08 +0800 (CST), PO SU a écrit : > > Ok, what i want is find how many numbers after . in a numeric ,and > i don't know if there is already exists a function to do it( i wrote > one by myself which will be showed later). e.g. 1.234 has 3 numbers > after . 1 has 0 number > 1.5342 has 4 numbers > And i solved the above format using: > find<-function(x) > { > str<-as.character(x) > if(is.na(strsplit(str,"\\.")[[1]][2])) return(0) else return(nchar(strsplit(str,"\\.")[[1]][2])) > } It appears that your initial vector (x) is a numeric one that you (obviously) need to transform to a character vector. So any number it contains will have been shortened to its minimal representation when you convert it to string. As far as I can tell (though I'm no expert in number representation), you should work with x as a string vector from the very beginning (which, to me, seems rather intuitive as the 0 in 1.230 is, really, only a string isn't it ?) If you can "see" zeros when you print the numeric vector by e.g. print (x), that's simply because R displays them with a default precision but they may contain many more digits... Try dput (x) before str <- as.character (x) and you will see what I mean. Also, it may be usefull to look at what the following lines produce : sprintf("%.10f", x) sprintf("%.30f", x) You will see that actually R stores many more digits that what you think there are and that your "0" in "1.340" for example is, really not single... except when it is basically a string. Olivier. > > But when i find(1.340) i get 2 not 3. find(1.3400) will also get 2 > not 4. So,my question is how to implement the above needing? TKS. > > > > > -- > > PO SU > mail: desolato...@163.com > Majored in Statistics from SJTU > > > > > At 2014-10-24 12:04:18, "Jeff Newmiller" > wrote: > >I am baffled. I think those were English words but they didn't make > >any sense to me. Not was there a reproducible example to turn to. > >Can you try again? > >--- > >Jeff NewmillerThe . . Go > >Live... DCN:Basics: ##.#. > >##.#. Live Go... > > Live: OO#.. Dead: OO#.. > > Playing > >Research Engineer (Solar/BatteriesO.O#. #.O#. with > >/Software/Embedded Controllers) .OO#. .OO#. > >rocks...1k > >--- > >Sent from my phone. Please excuse my brevity. > > > >On October 23, 2014 8:35:06 PM PDT, PO SU > >wrote: > >> > >>Dear usRers, > >> Now i want to cal ,e.g. > >> cal(1.234) will get 3 > >> cal(1) will get 0 > >> cal(1.3045) will get 4 > >> But the difficult part is cal(1.3450) will get 4 not 3. > >>So, is there anyone happen to know the solution to this problem, or > >>it can't be solved in R, because 1.340 will always be transformed > >>autolly to 1.34? > >> > >> > >> > >> > >> > >> > >>-- > >> > >>PO SU > >>mail: desolato...@163.com > >>Majored in Statistics from SJTU > >>__ > >>R-help@r-project.org mailing list > >>https://stat.ethz.ch/mailman/listinfo/r-help > >>PLEASE do read the posting guide > >>http://www.R-project.org/posting-guide.html > >>and provide commented, minimal, self-contained, reproducible code. > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to speed up list access in R?
Hi, perhaps pre-generating the list before processing would speed it up significantly. Though it may still be slower than python. e.g. try something like: d = as.list(rep(NA,length(numbers))) rather than: d = list() Olivier. On Thu, 30 Oct 2014 11:17:59 -0400 Thomas Nyberg wrote: > Hello, > > I want to do the following: Given a set of (number, value) pairs, I > want to create a list l so that l[[toString(number)]] returns the > vector of values associated to that number. It is hundreds of times > slower than the equivalent that I would write in python. I'm pretty > new to R so I bet I'm using its data structures inefficiently, but > I've tried more or less everything I can think of and can't really > speed it up. I have done some profiling which helped me find problem > areas, but I couldn't speed things up even with that information. I'm > thinking I'm just fundamentally using R in a silly way. > > I've included code for the different versions. I wrote the python > code in a style to make it as clear to R programmers as possible. > Thanks a lot! Any help would be greatly appreciated! > > Cheers, > Thomas > > > R code (with two versions depending on commenting): > > - > > numbers <- numeric(0) > for (i in 1:5) { > numbers <- c(numbers, sample(1:3, 1)) > } > > values <- numeric(0) > for (i in 1:length(numbers)) { > values <- append(values, sample(1:10, 1)) > } > > starttime <- Sys.time() > > d = list() > for (i in 1:length(numbers)) { > number = toString(numbers[i]) > value = values[i] > if (is.null(d[[number]])) { > #if (number %in% names(d)) { > d[[number]] <- c(value) > } else { > d[[number]] <- append(d[[number]], value) > } > } > > endtime <- Sys.time() > > print(format(endtime - starttime)) > > - > > uncommented version: "45.64791 secs" > commented version: "1.423056 mins" > > > > Another version of R code: > > - > > numbers <- numeric(0) > for (i in 1:5) { > numbers <- c(numbers, sample(1:3, 1)) > } > > values <- numeric(0) > for (i in 1:length(numbers)) { > values <- append(values, sample(1:10, 1)) > } > > starttime <- Sys.time() > > d = list() > for (number in unique(numbers)) { > d[[toString(number)]] <- numeric(0) > } > for (i in 1:length(numbers)) { > number = toString(numbers[i]) > value = values[i] > d[[number]] <- append(d[[number]], value) > } > > endtime <- Sys.time() > > print(format(endtime - starttime)) > > - > > "47.15579 secs" > > > > The python code: > > - > > import random > import time > > numbers = [] > for i in range(5): > numbers += random.sample(range(3), 1) > > values = [] > for i in range(len(numbers)): > values.append(random.randint(1, 10)) > > starttime = time.time() > > d = {} > for i in range(len(numbers)): > number = numbers[i] > value = values[i] > if d.has_key(number): > d[number].append(value) > else: > d[number] = [value] > > endtime = time.time() > > print endtime - starttime, "seconds" > > - > > 0.123021125793 seconds > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] cut - strange NA as output
Hi, On Tue, 6 Oct 2015 21:20:13 +0200 Hermann Norpois wrote: > Hello, > > why do I get NA for the following: > > cut (x, seq (0, max(x), by=1), label=FALSE) > [1] 1322 1175 1155 1149 1295 1173 1289 1197 NA 1129 The NA comes from your max value and it's due to your seq(0, max(x), by = 1) creating a sequence that will stop BEFORE your decimal max (x)... Therefore the element of x which equals 1355.888 is not part of the allowed outputs of cut(). Are you sure you would not rather use either round (x) or ceiling (x)? Not sure however what you really want from this... Olivier. > > dput (x) > c(1321.55376901374, 1174.35657200935, 1154.02042504008, > 1148.60981925942, 1294.6166388941, 1172.45806806869, > 1288.31933914639, 1196.26080041462, 1355.88836502166, > 1128.09901883228) > > Thanks > Hermann > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Block Triangular Matirx
Hi, I think this page will help, https://stat.ethz.ch/R-manual/R-devel/library/base/html/lower.tri.html Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Université de Nantes -Original Message- From: Amina Shahzadi Shahzadi Sender: "R-help" Date: Mon, 25 Jan 2016 00:39:22 To: r-help@R-project.org Subject: [R] Block Triangular Matirx Hi I want to create a block upper triangular square matrix. Anybody who can help in this regard. Thank You [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] difference between successive values
Hi, (1) You should provide a minimal working example; (2) But anyway, does... x = sample(10) c(x[1],diff(x)) ... do what you want? Olivier. On Fri, 4 Mar 2016 13:22:07 +0200 catalin roibu wrote: > Dear all! > > I want to calculate difference between successive values (cumulative > values) with R. I used diff function, but I want to keep the first > values. > > Please help me to solve this problem! > > Thank you! > > Best regards! > > CR > > -- > > - > - > Catalin-Constantin ROIBU > > Lecturer PhD, Forestry engineer > Forestry Faculty of Suceava > Str. Universitatii no. 13, Suceava, 720229, Romania > office phone +4 0230 52 29 78, ext. 531 > mobile phone+4 0745 53 18 01 > FAX:+4 0230 52 16 64 > silvic.usv.ro <http://www.usv.ro/> > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique de Nantes -- UMR6310 CNRS / Université de Nantes Chemin de la Censive du Tertre -- BP 81227 44312 Nantes cedex 3 France http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Chi2 algorithm - R
Hi, (1) If the package has been installed from CRAN then it's been tested (which does not imply that it's'exempt of any bugs), any other source (e.g. Github) has not been tested... according to my understanding; (2) The GNU GPL explicitly states that you install and use the software "at your own risk"... This is the case for any GPL licensed software, even for base-R... so this is no surprise! Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes UMR 6310 CNRS / Université de Nantes -Original Message- From: Luke Skywalker Sender: "R-help" Date: Wed, 23 Nov 2016 22:26:45 To: peter dalgaard Cc: Subject: Re: [R] Chi2 algorithm - R What does it mean to "have a mantainer"? Is he a third party? Is he an individual developer and you can install whose package on your risk? Are the package created by maintainers not tested? Anyway, I wrote him. I'm waiting for response. Regards Il 23/Nov/2016 22:21, "peter dalgaard" ha scritto: > Notice that this relates to an R _package_, which has a maintainer. You > cannot expect general R users or developers to know about the details of > the package. It doesn't look like there is dcoumentation beyond the help > pages, so you may need to contact the maintainer or study the actual code. > > -pd > > > On 23 Nov 2016, at 17:08 , Luke Skywalker wrote: > > > > Good evening, > > > > I'm encountering a different kind of discretization with respect to the > > 1997 Liu and Setiono's one descripted in their papers, using Chi2 > algorithm > > for feature selection with discretization. > > > > As stated in R documentation (discretization - R (from CRAN) > > <https://cran.r-project.org/web/packages/discretization/ > discretization.pdf>), > > R package discretizion offers the function Chi2, which comes to life in > the > > following papers: > > > > Liu, H. and Setiono, R. (1995). Chi2: Feature selection and > discretization > > of numeric attributes, Tools with Artificial Intelligence, 388–391. > > > > Liu, H. and Setiono, R. (1997). Feature selection and discretization, > IEEE > > transactions on knowledge and data engineering, Vol.9, no.4, 642–645. > > > > I wrote the following R programming language code, in which I have set > > alpha and delta equal to the ones set in the papers above. Finally, the > > following code prints out the discretized dataframe. I used Iris > dataframe, > > as in one of the examples in the two papers. The first paper above states > > that alfa = 0.5 and delta = 5%, and that "the originally odd numbered > data > > are selected for training (75 patterns) and rest for testing (75 > > patterns)". With this asset, Sepal attributes should be removed. > > > > library(discretization) > > data(iris) > > df1 <- iris[FALSE,]for(i in 1:nrow(iris)){ > >if(i %% 2 != 0){ > >df1 <- rbind(df1, iris[i,]) > >}} > > chi2(df1, alp=0.5, del=0.05)$Disc.data > > > > The point is that, observing the dataframe printed out by the last > > instruction, you can see that no attribute is removed. The discretized > data > > frame still have 4 attributes discretized: if I correctly understood the > > above papers, Sepal Length and Sepal Width should have been both > > discretized in just one interval by Chi2 algorithm. > > > > I have posted a question here: http://stats.stackexchange.com/questions/ > > 247499/why-does-not-r-chi2-algorithm-discretize-in-the- > > same-manner-as-in-the-paper-by-l?noredirect=1#comment470974_247499. > > > > > > Moreover, it's really hard to understand the cut points that Chi2 > algorithm > > implemented in R makes. For example: > > > > res <- chi2(iris, 0.5, 0.05) > > > > cut(iris$Sepal.Length, res$cutp, labels=FALSE) is different from > > res$Disc.data$Sepal.Length > > > > Help me understand, please > > > > Best regards > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd@cbs.dk Priv: pda...@gmail.com > > > > &g
Re: [R] use of Encoding()?
Hi, using R version 3.3.2 under Linux, these work perfectly (but I receive a correct encoding ("UTF-8"), not "unknown"). What is your system (windows, mac, linux)? Your R version? Which interface (RStudio, Windows R interface)? There are often issues with character encoding using Windows (in many different programming languages) but it may not be the case concerning R. If these operations are meant to read data from a file, you may alternatively consider the option fileEncoding= from read.table / read.csv (to change encoding) or, perhaps but I would suggets first trying the preceding option, encoding= (to specifically declare the file encoding if you know it but R does not detect it). Olivier. On Fri, 3 Feb 2017 17:29:20 +0100 Tilmann Faul wrote: > Hey, > > this is my first question here, so forgive me if i my be clumsy. > > I want to use Encoding to set the encoding of a character vector, but > it doese not seem to work. See example. > > > x <- "16-03-02" > > Encoding(x) > [1] "unknown" > > Encoding(x) <- "latin1" > > Encoding(x) > [1] "unknown" > > Is this intended? > Actually i want to change encoding of a character vector generated by > list.file on a linux computerwith UTF-8 file encoding, rstudio > encoding is iso8859-15. > Any hints? > > best Tilmann > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique de Nantes -- UMR6310 CNRS / Université de Nantes Chemin de la Censive du Tertre -- BP 81227 44312 Nantes cedex 3 France http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] use of Encoding()?
On Fri, 3 Feb 2017 11:23:02 -0800 David Winsemius wrote: Oups, I (erroneously) tried with accented characters, which explains my answer. Actually, I (correctly) get "unknown" if using characters from the ASCII set, so my understanding is that there's actually no problem with the OP's request as there's no reason why "16-03-02" should be represented as anything else than "unknown" according to this information (all characters are in the ASCII set). Olivier. > > > On Feb 3, 2017, at 10:12 AM, Olivier Crouzet > > wrote: > > > > Hi, > > > > using R version 3.3.2 under Linux, these work perfectly (but I > > receive a correct encoding ("UTF-8"), not "unknown"). > > > > What is your system (windows, mac, linux)? Your R version? Which > > interface (RStudio, Windows R interface)? There are often issues > > with character encoding using Windows (in many different programming > > languages) but it may not be the case concerning R. > > I'm wondering if it's being done on a Mac, since I see the same > behavior at my console (the "standard" R.app GUI). If the issue is > with reading a Windows file while using one of the `read.*` > functions, then setting the `fileEncoding` parameter to one of > 'iso-8859-1' or 'cp1252' may be attempted. > > The ?Encodings page says: "ASCII strings will never be marked with a > declared encoding, since their representation is the same in all > supported encodings." > > Running the example in the help page (on a Mac): > > > x <- "fa\xE7ile" > > Encoding(x) > [1] "unknown" > > Encoding(x) <- "latin1" > > x > [1] "façile" > > Encoding(x) > [1] "latin1" > > > -- > David. > > > > If these operations are meant to read data from a file, you may > > alternatively consider the option fileEncoding= from read.table / > > read.csv (to change encoding) or, perhaps but I would > > suggets first trying the preceding option, encoding= (to > > specifically declare the file encoding if you know it but R does > > not detect it). > > > > Olivier. > > > > > > On Fri, 3 Feb 2017 17:29:20 +0100 Tilmann Faul > > wrote: > > > >> Hey, > >> > >> this is my first question here, so forgive me if i my be clumsy. > >> > >> I want to use Encoding to set the encoding of a character vector, > >> but it doese not seem to work. See example. > >> > >>> x <- "16-03-02" > >>> Encoding(x) > >> [1] "unknown" > >>> Encoding(x) <- "latin1" > >>> Encoding(x) > >> [1] "unknown" > >> > >> Is this intended? > >> Actually i want to change encoding of a character vector generated > >> by list.file on a linux computerwith UTF-8 file encoding, rstudio > >> encoding is iso8859-15. > >> Any hints? > >> > >> best Tilmann > >> > >> __ > >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html and provide commented, > >> minimal, self-contained, reproducible code. > > > > > > -- > > Olivier Crouzet, PhD > > Laboratoire de Linguistique de Nantes -- UMR6310 > > CNRS / Université de Nantes > > Chemin de la Censive du Tertre -- BP 81227 > > 44312 Nantes cedex 3 > > France > > > > http://www.lling.univ-nantes.fr/ > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html and provide commented, > > minimal, self-contained, reproducible code. > > David Winsemius > Alameda, CA, USA > -- Olivier Crouzet, PhD Laboratoire de Linguistique de Nantes -- UMR6310 CNRS / Université de Nantes Chemin de la Censive du Tertre -- BP 81227 44312 Nantes cedex 3 France http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] display UTF8 characters in pdf
Hi, AFAICT, you need to use a Cairo device for being able to display some Unicode characters in a plot. From my experience, the CairoPDF() from library(Cairo) does not work (and I don't understand the difference with cairo_pdf()), but the cairo_pdf() from grDevices does work perfectly well for this aim. As far as I'm concerned, I use it with both ggplot2 and regular plots and it does a perfect job. Here is a short example: In an R console: cairo_pdf(filename = "test.pdf") plot(1,1,pch = "\u254") dev.off() Also, I use it with knitr and it works great. You just have to declare a specific device ("cairo_pdf"). For example, in an RMarkdown document: ```{r ipaunicode, echo=TRUE, dev='cairo_pdf'} plot(1, 1, pch = "\u254") ``` and in a LaTeX / knitr document as well: <>= plot(1, 1, pch = "\u251") @ Hope this helps. Yours. Olivier. On Fri, 10 Mar 2017 17:06:25 +0100 Thierry Onkelinx wrote: Dear all, I'd like to use some UTF-8 characters in a plot. Some of them are not rendered with saving the plot as pdf. Any suggestions? library(ggplot2) symbols <- c("\U1F697", "\U00A9", "\U24DA", "\U00C1") test <- data.frame( x = seq_along(symbols) %% ceiling(sqrt(length(symbols))), y = ceiling(seq_along(symbols) / ceiling(sqrt(length(symbols, symbol = symbols ) p <- ggplot(test, aes(x = x, y = y, label = symbol)) + geom_text(size = 10) p ggsave(p, file = "test.png") ggsave(p, file = "test.pdf") The last command gives several similar warnings, all related to the symbols which are not rendered properly: Warning messages: 1: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), ... : conversion failure on '🚗' in 'mbcsToSbcs': dot substituted for I'm running R 3.3.2 under Ubuntu 16.04.1 and ggplot2 2.2.1 Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD /Assistant Professor/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes /Guest Researcher/ @UMCG (University Medical Center Groningen) ENT department Reijksuniversiteit Groningen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] speech spectogram
Le Mon, 19 Oct 2009 12:00:16 +0530, rajesh j a écrit : > Hi, > > I need to plot a spectogram for a speech signal. Is there a package > that can do this? > Late answer, but you should have a look at seewave package on CRAN. The function spectro() is what you need. Olivier. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Département de Sciences du Langage UFR Lettres et Langages Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] spectrogram
Le Mon, 4 Jan 2010 14:17:44 +0530, rajesh j a écrit : > Hi, > I need to plot spectrogram of a waveform.What package offers this? > See the seewave package. on cran: http://cran.r-project.org/web/packages/seewave/index.html and on the package's website for online documentation: http://sueur.jerome.perso.neuf.fr/seewave.html Olivier. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Département de Sciences du Langage UFR Lettres et Langages Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Replacing NAs with 0 for variables with the same ending
Uli Kleinwechter a écrit : data[,grep("x",names(data))][is.na(data[,grep("x",names(data))])]<-0 thanks a lot. I'm just afraid that grep matches any occurence of "x" in the variable name. So variables which would contain "x" at any position, not necessarily only at the last one would be selected, as well. To refine my example (sorry for having been so imprecise before...): Replacing "x" with "x$" in grep calls should do the job... Olivier. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] empty data frame and POSIXct data types
Hi Stefano, my guess is that you're expecting data recycling to apply but your data frame is only one row long... therefore you can't insert a 2-row vector into a 1-row vector. Recycling won't help. You should specify the number of rows that will be required in your data frame using (e.g) rep(). (here I use 10 rows as an example) mydf <- data.frame(data_POSIX=rep(as.POSIXct(NA), 10), value=as.numeric(NA)) Olivier. On Thu, 24 Jun 2021 13:34:31 + Stefano Sofia wrote: > Dear R users, > I know that this question is silly (I am not a R newby) but I already > wasted quite a lot of energies trying to fill in an empty data frame > (with "POSIXct" "POSIXt" data type). > > Suppose I create > mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA)) > day1 <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M", > tz="Etc/GMT-1") day2 <- as.POSIXct("2018-02-02-00-00", > format="%Y-%m-%d-%H-%M", tz="Etc/GMT-1") > > then > mydf$data_POSIX <- c(day1, day2) > > does not work, it gives me: > "Error in `$<-.data.frame`(`*tmp*`, data_POSIX, value = c(1517439600, > 1517612400 : replacement has 2 rows, data has 1" > > There are few basic concepts that I am missing. > Why c(day1, day2) is not a vector? > Why I am not able to populate my data frame? > > Could somebody please give me the right hints? > Thank you for your precious help > Stefano > > > (oo) > --oOO--( )--OOo-- > Stefano Sofia PhD > Civil Protection - Marche Region - Italy > Meteo Section > Snow Section > Via del Colle Ameno 5 > 60126 Torrette di Ancona, Ancona (AN) > Uff: +39 071 806 7743 > E-mail: stefano.so...@regione.marche.it > ---Oo-oO > > > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può > contenere informazioni confidenziali, pertanto è destinato solo a > persone autorizzate alla ricezione. I messaggi di posta elettronica > per i client di Regione Marche possono contenere informazioni > confidenziali e con privilegi legali. Se non si è il destinatario > specificato, non leggere, copiare, inoltrare o archiviare questo > messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo > al mittente ed eliminarlo completamente dal sistema del proprio > computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, > in caso di necessità ed urgenza, la risposta al presente messaggio di > posta elettronica può essere visionata da persone estranee al > destinatario. IMPORTANT NOTICE: This e-mail message is intended to be > received only by persons entitled to receive the confidential > information it may contain. E-mail messages to clients of Regione > Marche may contain information that is confidential and legally > privileged. Please do not read, copy, forward, or store this message > unless you are an intended recipient of it. If you have received this > message in error, please forward it to the sender and delete it > completely from your computer system. > > -- > Questo messaggio stato analizzato da Libraesva ESG ed risultato non > infetto. This message was scanned by Libraesva ESG and is believed to > be clean. > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] UTF-8 to the console
Hi, from what I can tell, unicode-related issues (in several programming languages) are often specifically related to the MS Windows operating system rather than to R (though that does not imply it is irrelevant here). You may wish to have a look at: https://blog.r-project.org/2020/05/02/utf-8-support-on-windows/ This may provide directions to solving your issue. Yours. Olivier. On Thu, 23 Jun 2022 12:26:23 +0200 Helmut Schütz wrote: > Dear all, > > I want to send UTF-8 characters to the console. Font in the > GUI-Preference 'Lucida Console', supporting the desired symbols: > greater than or equal: UTF-8 2265, HTML-entity ≥ HTML-Unicode > ≥ TeX \ge > approximately equal: UTF-8 2248, HTML-entity ≈ HTML-Unicode > ≈ TeX \approx > > txt <- "x ≥ y, x \u2265 y; a ≈ b, a \u2248 b" > Encoding(txt) <- "UTF-8" > print(txt) > [1] "x = y, x = y; a \230 b, a \230 b" > cat(txt, "\n") > x = y, x = y; a ˜ b, a ˜ b > > Desired "x ≥ y, x ≥ y; a ≈ b, a ≈ b" > > I'm sending the email in UTF-8. Don’t know how @r-project.org is > configured (ASCII?) If you see garbage, I'm sorry but you should get > the idea. > > R 4.2.0 on Windows 7 (UCRT10.0.10240.16390) and Windows 11. > > Helmut > -- > Ing. Helmut Schütz > BEBAC – Consultancy Services for > Bioequivalence and Bioavailability Studies > Neubaugasse 36/11 > 1070 Vienna, Austria > E helmut.schu...@bebac.at <mailto:helmut.schu...@bebac.at> > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reg: Help regarding ggplot2
Dear Upananda, to complement the current response to your question, your data source looks like a "wide table" while you would certainly need them to be organised as a "long table", or to speak differently as a "tidy table". You should read this source in order to get a grasp on these issues: https://tidyr.tidyverse.org/articles/tidy-data.html Please note that the etiquette on this list states that example data should conform to some constraints that your message does not conform to (you shoud therefore also read the posting guide: http://www.R-project.org/posting-guide.html). Yours. Olivier. On Tue, 2 May 2023 14:27:24 +0530 Upananda Pani wrote: > Dear All, > > I have a dataset which contains date and 12 other countries data. I > have extracted the data as xts object. > > I am not able to recall all the series in the Y axis. My data set > looks like this > > index crepub finland france germany italy netherlands norway > poland >1 2005-01-03 1.21 0.615 1.903.01 0.346 > 0.509 1.051.13 2 2005-01-04 1.18 0.615 1.852.89 > 0.346 0.509 0.889 1.12 3 2005-01-05 1.15 0.615 1.81 > 2.78 0.346 0.509 0.785 1.09 4 2005-01-06 1.11 0.615 > 1.762.67 0.346 0.509 0.711 1.06 5 2005-01-07 1.08 > 0.615 1.722.57 0.346 0.509 0.661 1.02 6 2005-01-10 > 1.04 0.615 1.692.48 0.346 0.509 0.630 1.01 > > My code for the same is as follows > > ggplot(data=data_vol3, aes(x=index, y=data_vol3$usa)+ > geom_line()) > > Any help in this regard will be highly appreciated > > With regards, > Upananda Pani > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mac/PC differences in lmer results
t; >> Does anyone have an idea what the underlying cause might be? > >> > >> Thanks, > >> Nico > >> > >> > >> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@r-project.org <mailto:R-help@r-project.org> mailing list -- > >> To UNSUBSCRIBE and more, see > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> <https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the > >> posting guide http://www.R-project.org/posting-guide.html > >> <http://www.r-project.org/posting-guide.html> and provide > >> commented, minimal, self-contained, reproducible code. > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes /Guest Researcher/ @UMCG (University Medical Center Groningen) ENT department Rijksuniversiteit Groningen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Read Unicode text (*.txt)
Hi Javad, I could not make sense of the data structure associated with the csv file as it is copied in your previous message. Would you mind sending a link so one can download your csv file directly (or at least the first few lines) so people can check the exact properties of your file? Yours. Olivier. On Tue, 2 Jul 2019 07:56:07 +0430 javad bayat wrote: > Dear all; > I use your suggestion but I gave the same warning messages. I changed > the file name (Data.csv). > " > d4<-read.csv("./Data.csv",sep=";",header=TRUE,encoding="UTF-16") > Warning messages: > 1: In read.table(file = file, header = header, sep = sep, > quote = quote, : >line 1 appears to contain embedded nulls > 2: In read.table(file = file, header = header, sep = sep, > quote = quote, : > line 2 appears to contain embedded nulls > 3: In read.table(file = file, header = header, sep = sep, > quote = quote, : > line 3 appears to contain embedded nulls > 4: In read.table(file = file, header = header, sep = sep, > quote = quote, : >line 4 appears to contain embedded nulls > 5: In read.table(file = file, header = header, sep = sep, > quote = quote, : > line 5 appears to contain embedded nulls > 6: In read.table(file = file, header = header, sep = sep, > quote = quote, : >line 1 appears to contain embedded nulls > 7: In scan(file = file, what = what, sep = sep, quote = > quote, dec = dec, : > embedded nul(s) found in input > " > > I opened the Data in notepad. This is the head of Data.csv. The > columns have been separated by semicolons. > " > "INLET Time";"INLET ValueY";"TRATED WATER TANK Time";"TRATED WATER > TANK ValueY" > 10/28/2018;550.057861328125;10/28/2018;487.812530517578 > 10/28/2018 12:00:01 ق.ظ;550.057861328125;10/28/2018 12:00:01 > ق.ظ;487.812530517578 > 10/28/2018 12:00:02 ق.ظ;550.057861328125;10/28/2018 12:00:02 > ق.ظ;487.812530517578 > 10/28/2018 12:00:03 ق.ظ;550.057861328125;10/28/2018 12:00:03 > ق.ظ;487.812530517578 > 10/28/2018 12:00:04 ق.ظ;550.057861328125;10/28/2018 12:00:04 > ق.ظ;487.812530517578 > . > . > . > " > Thanks. > > > > On Tue, Jul 2, 2019 at 6:14 AM Jeff Newmiller > wrote: > > > Don't be so US-centric, Abby... how do you know that javad's > > version of Excel doesn't default to using semicolons? > > > > ?read.csv2 > > > > On July 1, 2019 6:06:32 PM PDT, Abby Spurdle > > wrote: > > >> I am trying to read an excel CSV file (1.csv). When I read it as > > >> csv > > >file > > >> in R, the R shows me the exact number of row. But it puts all > > >> columns > > >in > > >> one column, while I have 3 or 4 columns in the data frame. > > >> d4 = read.table("./4.csv",sep=";",header=TRUE) > > > > > >Firstly, I recommend against naming your file "1.csv". > > >(Start with a letter not a number). > > > > > >Secondly, a CSV file should be separated by commas not semicolons. > > >You can specify sep=",", however, it's probably easier to use the > > >read.csv() function. > > > > > >Note that you should be able to open your file in a text editor to > > >see the > > >separators. > > > > > >> I dont know why in the "save as type" box Unicode text (*.txt) > > > > > >Other posters have suggested that you need to specify the encoding. > > >Assuming that you create your CSV file correctly in Excel, I doubt > > >that this is necessary, but I could be wrong... > > > > > >Your comment suggests that you have saved your document as "Unicode > > >text". > > >You need to tell Excel to save the file as a CSV file. > > >(There should be a list of save options). > > > > > >Simply typing a file name with a .csv file extension is unlikely to > > >produce > > >the desired result. > > > > > > [[alternative HTML version deleted]] > > > > > >__ > > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > >https://stat.ethz.ch/mailman/listinfo/r-help > > >PLEASE do read the posting guide > > >http://www.R-project.org/posting-guide.html > > >and provide commented, minimal, self-contained, reproducible code. > > > >
Re: [R] Rmarkdown code rendering as LaTeX, not executing?
the R code block as I edit it and add spaces and lines. > > If the block above is saved as "RW_test.Rmd", I use these lines to > create the PDF: > === > library(rmarkdown) > render("RW_test.Rmd") > > > No errors are generated. > > Can anyone help me understand what I'm doing wrong? A much shorter > test file I created seems to work okay. > > Thanks in advance for any advice. > > -Kevin > > > sessionInfo() > R version 4.3.0 (2023-04-21) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Ubuntu 22.04.2 LTS > > Matrix products: default > BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 > LAPACK: > /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; > LAPACK version 3.10.0 > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > LC_TIME=en_US.UTF-8 > [4] LC_COLLATE=en_US.UTF-8LC_MONETARY=en_US.UTF-8 > LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 > LC_ADDRESS=en_US.UTF-8 > [10] LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 > LC_IDENTIFICATION=en_US.UTF-8 > > time zone: America/New_York > tzcode source: system (glibc) > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] kableExtra_1.3.4 tidycensus_1.4 lubridate_1.9.2 > forcats_1.0.0 stringr_1.5.0dplyr_1.1.2 > [7] purrr_1.0.1 readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 > ggplot2_3.4.2tidyverse_2.0.0 > [13] rmarkdown_2.22 > > loaded via a namespace (and not attached): > [1] gtable_0.3.3xfun_0.39 raster_3.6-20 > tigris_2.0.3rJava_1.0-6 > [6] lattice_0.21-8 tzdb_0.4.0 vctrs_0.6.2 > tools_4.3.0 generics_0.1.3 > [11] curl_5.0.0 proxy_0.4-27fansi_1.0.4 > pkgconfig_2.0.3 KernSmooth_2.23-21 > [16] webshot_0.5.4 uuid_1.1-0 lifecycle_1.0.3 > compiler_4.3.0 munsell_0.5.0 > [21] tinytex_0.45terra_1.7-29codetools_0.2-19 > htmltools_0.5.5 class_7.3-22 > [26] yaml_2.3.7 crayon_1.5.2pillar_1.9.0 > classInt_0.4-9 tidyselect_1.2.0 > [31] rvest_1.0.3 digest_0.6.31 stringi_1.7.12 > sf_1.0-13 fastmap_1.1.1 > [36] grid_4.3.0 colorspace_2.1-0cli_3.6.1 > magrittr_2.0.3 utf8_1.2.3 > [41] e1071_1.7-13withr_2.5.0 scales_1.2.1 > rappdirs_0.3.3 sp_1.6-1 > [46] timechange_0.2.0httr_1.4.6 hms_1.1.3 > OpenStreetMap_0.3.4 evaluate_0.21 > [51] knitr_1.43 rgdal_1.6-7 viridisLite_0.4.2 > rlang_1.1.1 Rcpp_1.0.10 > [56] glue_1.6.2 DBI_1.1.3 xml2_1.3.4 > svglite_2.1.1 rstudioapi_0.14 > [61] jsonlite_1.8.4 R6_2.5.1systemfonts_1.0.4 > units_0.8-2 > > > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can someone please have a look at this query on stackoverflow?
Dear Ashim, I don't think the aspectratio is appropriate in this context because it would imply that the beamer (LaTeX) class is used but you're actually using the article (LaTeX) class. You may use specifications of the geometry package rather than specifying options to the class: e.g. replace your current header: --- title: "Testing landscape and aspect ratio" output: pdf_document: number_sections: true classoption: - landscape - "aspectratio=169" header-includes: - \usepackage{dcolumn} documentclass: article geometry: margin=1.5cm --- with this one: --- title: "Testing landscape and aspect ratio" output: pdf_document: number_sections: true header-includes: - \usepackage{dcolumn} documentclass: article geometry: margin=1.5cm, paperwidth=24cm, paperheight=13.5cm --- Of course, you may change the exact dimensions and it will impact the relative font sizes. I've tested it and it generates what you want. Yours. Olivier. On Tue, 14 Nov 2023 10:03:23 +0530 Ashim Kapoor wrote: > Dear all, > > I have posted a query which has received a response but that is not > working on my computer. > > Here is the query: > > https://stackoverflow.com/questions/77387434/pdf-from-rmarkdown-landscape-and-aspectratio-169 > > Can someone please help me ? > > Best Regards, > Ashim > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Can someone please have a look at this query on stackoverflow?
Dear Ashim, these are documented in the LaTeX 'geometry' package (see for example on CTAN: https://ctan.org/pkg/geometry). As I added in my response on Stackoverflow, several parts in the RMarkdown header actually concern information that are processed by LaTeX to actually generate the PDF, among which the 'geometry' line. For someone who is used to working with LaTeX, it is relatively natural to 'identify' LaTeX options in these lines even though they are not structured exactly this way in a LaTeX document (but their names are the same). Concerning the choice for these specific numbers, it is relatively arbitrary. I've been doing this on LaTeX for years when I want to generate slides without using the 'beamer' document class and the things to take into account are: - These dimensions express the physical sizes of the pdf page (in a sense, what their size would be if you print the document without adapting to the paper in your printer) - If these sizes are reduced... the relative font size will increase because LaTeX will project the same font on a smaller virtual paper, - And if these sizes are increased... the relative font size will decrease because LaTeX will project the same font on a larger virtual paper, - I processed starting from 16x9cm sizes, resp. for paperwidth and paperheight, and estimated that the fonts were too large to my taste, then doubled them and felt that the fonts were too small for slides, then I ended up trying multiplying 16x9cm by a factor of 1.5, which gave me 24x13.5cm and I found it was ok. - But one may vary these sizes arbitrary (even using smaller steps and ratios differing from 16/9) depending on the aims to be reached. - It is also possible to specify different units (pt = points, in = inches...) Yours. Olivier. On Sat, 18 Nov 2023 09:53:19 +0530 Ashim Kapoor wrote: > Dear Olivier, > > Many thanks for your reply. > > This works well for me. > > How did you come up with the pagewidth / pageheight numbers? I do > understand that their ratio = 16:9, > but how did you choose these numbers? > > Best Regards, > Ashim > > On Fri, Nov 17, 2023 at 9:25 PM Olivier Crouzet > wrote: > > > > Dear Ashim, > > > > I don't think the aspectratio is appropriate in this context because > > it would imply that the beamer (LaTeX) class is used but you're > > actually using the article (LaTeX) class. > > > > You may use specifications of the geometry package rather than > > specifying options to the class: > > > > e.g. replace your current header: > > > > --- > > title: "Testing landscape and aspect ratio" > > output: > > pdf_document: > > number_sections: true > > classoption: > > - landscape > > - "aspectratio=169" > > header-includes: > >- \usepackage{dcolumn} > > documentclass: article > > geometry: margin=1.5cm > > --- > > > > with this one: > > > > --- > > title: "Testing landscape and aspect ratio" > > output: > > pdf_document: > > number_sections: true > > header-includes: > >- \usepackage{dcolumn} > > documentclass: article > > geometry: margin=1.5cm, paperwidth=24cm, paperheight=13.5cm > > --- > > > > Of course, you may change the exact dimensions and it will impact > > the relative font sizes. I've tested it and it generates what you > > want. > > > > Yours. > > Olivier. > > > > > > > > > > > > On Tue, 14 Nov 2023 10:03:23 > > +0530 Ashim Kapoor wrote: > > > > > Dear all, > > > > > > I have posted a query which has received a response but that is > > > not working on my computer. > > > > > > Here is the query: > > > > > > https://stackoverflow.com/questions/77387434/pdf-from-rmarkdown-landscape-and-aspectratio-169 > > > > > > Can someone please help me ? > > > > > > Best Regards, > > > Ashim > > > > > > __ > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide > > > http://www.R-project.org/posting-guide.html and provide commented, > > > minimal, self-contained, reproducible code. > > > > > > -- > > Olivier Crouzet, PhD > > http://olivier.ghostinthemachine.space > > /Maître de Conférences/ > > @LLING - Laboratoire de Linguistique de Nantes > > UMR6310 CNRS / Université de Nantes > > > > __
Re: [R] Can someone please have a look at this query on stackoverflow?
Indeed, it's not far from that. Actually stating these parameters (paperwidht and paperheight) with the geometry package replaces the A4 size (or any default size as e.g. letterpaper...) with specific dimensions. But the nuance is that common sizes are declared with, e.g. the 'paper=a4paper' argument, but that in your situation this setup will be replaced with specific dimensions (the paper argument only accepts predefined names defining conventional dimensions, while the paperwidth and paperheight arguments let you define arbitrary dimensions). Yours. Olivier. On Sat, 18 Nov 2023 13:20:49 +0530 Ashim Kapoor wrote: > Dear Olivier, > > Many thanks for your reply. > > Very cool. > > You know what I thought ? I thought you had modified the A4 sheet size > to compute the paperheight and paperwidth ? > > I wonder if that's another way of proceeding. > > Best, > Ashim > > On Sat, Nov 18, 2023 at 12:51 PM Olivier Crouzet > wrote: > > > > Dear Ashim, > > > > these are documented in the LaTeX 'geometry' package (see for > > example on CTAN: https://ctan.org/pkg/geometry). As I added in my > > response on Stackoverflow, several parts in the RMarkdown header > > actually concern information that are processed by LaTeX to > > actually generate the PDF, among which the 'geometry' line. For > > someone who is used to working with LaTeX, it is relatively natural > > to 'identify' LaTeX options in these lines even though they are not > > structured exactly this way in a LaTeX document (but their names > > are the same). > > > > Concerning the choice for these specific numbers, it is relatively > > arbitrary. I've been doing this on LaTeX for years when I want to > > generate slides without using the 'beamer' document class and the > > things to take into account are: > > > > - These dimensions express the physical sizes of the pdf page (in a > > sense, what their size would be if you print the document without > > adapting to the paper in your printer) > > - If these sizes are reduced... the relative font size will increase > > because LaTeX will project the same font on a smaller virtual paper, > > - And if these sizes are increased... the relative font size will > > decrease because LaTeX will project the same font on a larger > > virtual paper, > > - I processed starting from 16x9cm sizes, resp. for paperwidth and > > paperheight, and estimated that the fonts were too large to my > > taste, then doubled them and felt that the fonts were too small for > > slides, then I ended up trying multiplying 16x9cm by a factor of > > 1.5, which gave me 24x13.5cm and I found it was ok. > > - But one may vary these sizes arbitrary (even using smaller > > steps and ratios differing from 16/9) depending on the aims to be > > reached. > > - It is also possible to specify different units (pt = points, in = > > inches...) > > > > Yours. > > Olivier. > > > > On Sat, 18 Nov 2023 09:53:19 +0530 Ashim Kapoor > > wrote: > > > > > Dear Olivier, > > > > > > Many thanks for your reply. > > > > > > This works well for me. > > > > > > How did you come up with the pagewidth / pageheight numbers? I do > > > understand that their ratio = 16:9, > > > but how did you choose these numbers? > > > > > > Best Regards, > > > Ashim > > > > > > On Fri, Nov 17, 2023 at 9:25 PM Olivier Crouzet > > > wrote: > > > > > > > > Dear Ashim, > > > > > > > > I don't think the aspectratio is appropriate in this context > > > > because it would imply that the beamer (LaTeX) class is used > > > > but you're actually using the article (LaTeX) class. > > > > > > > > You may use specifications of the geometry package rather than > > > > specifying options to the class: > > > > > > > > e.g. replace your current header: > > > > > > > > --- > > > > title: "Testing landscape and aspect ratio" > > > > output: > > > > pdf_document: > > > > number_sections: true > > > > classoption: > > > > - landscape > > > > - "aspectratio=169" > > > > header-includes: > > > >- \usepackage{dcolumn} > > > > documentclass: article > > > > geometry: margin=1.5cm > > > > --- > > > > > > > > with this one: > > >
Re: [R] Can someone please have a look at this query on stackoverflow?
And indeed again (I did not understand your previous question exactly at first), the 'hard-coded' definition of a landscape a4 sheet would therefore be: paperwidth=29.7cm, paperheight=21cm Olivier. On Sat, 18 Nov 2023 13:20:49 +0530 Ashim Kapoor wrote: > Dear Olivier, > > Many thanks for your reply. > > Very cool. > > You know what I thought ? I thought you had modified the A4 sheet size > to compute the paperheight and paperwidth ? > > I wonder if that's another way of proceeding. > > Best, > Ashim > > On Sat, Nov 18, 2023 at 12:51 PM Olivier Crouzet > wrote: > > > > Dear Ashim, > > > > these are documented in the LaTeX 'geometry' package (see for > > example on CTAN: https://ctan.org/pkg/geometry). As I added in my > > response on Stackoverflow, several parts in the RMarkdown header > > actually concern information that are processed by LaTeX to > > actually generate the PDF, among which the 'geometry' line. For > > someone who is used to working with LaTeX, it is relatively natural > > to 'identify' LaTeX options in these lines even though they are not > > structured exactly this way in a LaTeX document (but their names > > are the same). > > > > Concerning the choice for these specific numbers, it is relatively > > arbitrary. I've been doing this on LaTeX for years when I want to > > generate slides without using the 'beamer' document class and the > > things to take into account are: > > > > - These dimensions express the physical sizes of the pdf page (in a > > sense, what their size would be if you print the document without > > adapting to the paper in your printer) > > - If these sizes are reduced... the relative font size will increase > > because LaTeX will project the same font on a smaller virtual paper, > > - And if these sizes are increased... the relative font size will > > decrease because LaTeX will project the same font on a larger > > virtual paper, > > - I processed starting from 16x9cm sizes, resp. for paperwidth and > > paperheight, and estimated that the fonts were too large to my > > taste, then doubled them and felt that the fonts were too small for > > slides, then I ended up trying multiplying 16x9cm by a factor of > > 1.5, which gave me 24x13.5cm and I found it was ok. > > - But one may vary these sizes arbitrary (even using smaller > > steps and ratios differing from 16/9) depending on the aims to be > > reached. > > - It is also possible to specify different units (pt = points, in = > > inches...) > > > > Yours. > > Olivier. > > > > On Sat, 18 Nov 2023 09:53:19 +0530 Ashim Kapoor > > wrote: > > > > > Dear Olivier, > > > > > > Many thanks for your reply. > > > > > > This works well for me. > > > > > > How did you come up with the pagewidth / pageheight numbers? I do > > > understand that their ratio = 16:9, > > > but how did you choose these numbers? > > > > > > Best Regards, > > > Ashim > > > > > > On Fri, Nov 17, 2023 at 9:25 PM Olivier Crouzet > > > wrote: > > > > > > > > Dear Ashim, > > > > > > > > I don't think the aspectratio is appropriate in this context > > > > because it would imply that the beamer (LaTeX) class is used > > > > but you're actually using the article (LaTeX) class. > > > > > > > > You may use specifications of the geometry package rather than > > > > specifying options to the class: > > > > > > > > e.g. replace your current header: > > > > > > > > --- > > > > title: "Testing landscape and aspect ratio" > > > > output: > > > > pdf_document: > > > > number_sections: true > > > > classoption: > > > > - landscape > > > > - "aspectratio=169" > > > > header-includes: > > > >- \usepackage{dcolumn} > > > > documentclass: article > > > > geometry: margin=1.5cm > > > > --- > > > > > > > > with this one: > > > > > > > > --- > > > > title: "Testing landscape and aspect ratio" > > > > output: > > > > pdf_document: > > > > number_sections: true > > > > header-includes: > > > >- \usepackage{dcolumn} > > > > documentclass: article > > > > geometry:
Re: [R] How to use R0 package?
1,14,17, 1, 7, > > >> > 3, 4, > > 8, > > >> > 6, 7) > > >> > d1 = c("2020-01-23", "2020-01-24", "2020-01-25", "2020-01-26", > > >> > "2020-01-27", "2020-01-28", "2020-01-29", > > >> >"2020-01-30", "2020-01-31", "2020-02-01", "2020-02-02", > > >> > "2020-02-03", "2020-02-04", "2020-02-05", > > >> >"2020-02-06", "2020-02-07", "2020-02-08", "2020-02-09", > > >> > "2020-02-10", "2020-02-11", "2020-02-12", > > >> >"2020-02-13", "2020-02-14", "2020-02-15", "2020-02-16", > > >> > "2020-02-17", "2020-02-18", "2020-02-19", > > >> >"2020-02-20", "2020-02-21", "2020-02-22", "2020-02-23", > > >> > "2020-02-24", "2020-02-25", "2020-02-26", > > >> >"2020-02-27", "2020-02-28", "2020-02-29", "2020-03-01", > > >> > "2020-03-02", "2020-03-03", "2020-03-04", > > >> >"2020-03-05", "2020-03-06", "2020-03-07", "2020-03-08", > > >> > "2020-03-09", "2020-03-10", "2020-03-11", > > >> >"2020-03-12", "2020-03-13", "2020-03-14", "2020-03-15", > > >> > "2020-03-16", "2020-03-17", "2020-03-18", > > >> >"2020-03-19", "2020-03-20", "2020-03-21", "2020-03-22", > > >> > "2020-03-23", "2020-03-24", "2020-03-25", > > >> >"2020-03-26", "2020-03-27", "2020-03-28", "2020-03-29", > > >> > "2020-03-30", "2020-03-31", "2020-04-01", > > >> >"2020-04-02", "2020-04-03", "2020-04-04", "2020-04-05", > > >> > "2020-04-06", "2020-04-07", "2020-04-08", > > >> >"2020-04-09", "2020-04-10", "2020-04-11", "2020-04-12", > > >> > "2020-04-13", "2020-04-14", "2020-04-15", > > >> >"2020-04-16", "2020-04-17", "2020-04-18", "2020-04-19", > > >> > "2020-04-20", "2020-04-21", "2020-04-22", > > >> >"2020-04-23", "2020-04-24", "2020-04-25", "2020-04-26", > > "2020-04-27" > > >> > ,"2020-04-28", "2020-04-29", > > >> >"2020-04-30", "2020-05-01", "2020-05-02", "2020-05-03", > > >> > "2020-05-04", "2020-05-05", "2020-05-06", > > >> >"2020-05-07", "2020-05-08", "2020-05-09", "2020-05-10", > > >> > "2020-05-11", "2020-05-12", "2020-05-13", > > >> >"2020-05-14", "2020-05-15", "2020-05-16", "2020-05-17", > > "2020-05-18") > > >> > names(x1) <- d1 > > >> > pop = 1438443864 > > >> > Ts_mean = 5.16 > > >> > Ts_sd = 1.49 > > >> > N=1 > > >> > TODAY = Sys.Date() > > >> > mGT = generation.time("gamma", c(Ts_mean, Ts_sd)) > > >> > R0 = estimate.R(x1, t=d1, GT=mGT, begin=as.Date(d1[1]), > > >> > end=TODAY, methods="EG",pop.size=pop, nsim=N) > > >> > ``` > > >> > but when I run I get: > > >> > ``` > > >> > Error in if (end.nb <= begin.nb) stop("'begin' and 'end' are > > >> > not consistent.") : > > >> > argument is of length zero > > >> > > as.Date(d1[1]) > > >> > [1] "2020-01-23" > > >> > > TODAY > > >> > [1] "2020-05-22" > > >> > > str(TODAY) > > >> > Date[1:1], format: "2020-05-22" > > >> > > str(as.Date(d1[1])) > > >> > Date[1:1], format: "2020-01-23" > > >> > ``` > > >> > Since I provided both start and end in the same format, I don't > > understand > > >> > the error. > > >> > Any tips? > > >> > Thank you > > >> > -- > > >> > Best regards, > > >> > Luigi > > >> > > > >> > [[alternative HTML version deleted]] > > >> > > > >> > __ > > >> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, > > >> > see https://stat.ethz.ch/mailman/listinfo/r-help > > >> > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > >> > and provide commented, minimal, self-contained, reproducible > > >> > code. > > > > > > > > > > > > -- > > > Best regards, > > > Luigi > > > > > -- > Best regards, > Luigi > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes /Guest Researcher/ @UMCG (University Medical Center Groningen) ENT department Rijksuniversiteit Groningen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple groups anova
Hi Stanley, You need to convert your dataframe (it's'not a matrix obviously) to a "long format". Each measurement will then be a single line within this "table". Each column will then be viewed as a single statistical variable. Then you will learn to apply relevant anovas on such data. Essentially, you need to read an introduction to R. Olivier. -- Olivier Crouzet LLING - Laboratoire de Linguistique de Nantes - EA3827 Université de Nantes -Original Message- From: Dragana Stanley Sender: r-help-bounces@r-project.orgDate: Thu, 12 Jun 2014 14:21:53 To: r-help@r-project.org Subject: [R] multiple groups anova Hi All I have a matrix on which I want to do ANOVA between different Groups. My matrix looks something like this Sample GroupMes1 Mes2 Mes3 sample1Group1 10 0 5 sample2Group1 2 0 1 sample3Group1 2 0 1 sample4Group1 2 0 3 sample5Group2 6 2 1 sample6Group2 10 1 0 sample7Group2 4 0 10 sample8Group2 7 0 2 sample9Group3 7 5 2 sample10 Group3 0 4 2 sample11 Group3 3 0 6 sample12 Group3 4 0 5 where Mes1-Mes100 columns are numerous measurements (like for example different genes or sequence counts) taken on each sample Is there simple way to do anova between different groups and effect size measure (ie summary) Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Subcripting matrix
Hi, it seems the following works as needed... Mat[,colnames(Mat)=="a"] Olivier. On Fri, 20 Sep 2013 16:22:37 +0530 Christofer Bogaso wrote: > Hello again, > > I have one question on subscripting matrix. Let say I have following > matrix: > > > Mat <- matrix(1:9, 3) > > colnames(Mat) <- c("a", "b", "a") > > Mat > a b a > [1,] 1 4 7 > [2,] 2 5 8 > [3,] 3 6 9 > > > Now I want to fetch data for colnames 'a'.I did following: > > > Mat[, "a"] > [1] 1 2 3 > > > However it is not taking second 'a' colume. Basically I expected to > get 1st and 3rd columns > > Can somebody tell me how to achieve that? > > Thanks and regards, > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] colour code areas of a plot
On Tue, 22 Oct 2013 16:43:18 +0200 Martin Batholdy wrote: Hi, you should replace your "color names" by calls to the rgb() function in order to generate the adequate colors, something like: bg_colors <- c(rep (rgb (0,1,0),20), rep (rgb (0,1,1),10), rep (rgb (0,1,0),20), rep(rgb (1,0,0),5), rep(rgb (1,1,0),45)) (though it should obviously be automatically extracted from your data I suppose). Then it is possible to use the color vector as an option to any plotting command e.g.: plot(color_scheme$t, color_scheme$t,col=bg_colors) or (something like): rect(xleft = color_scheme$t[1:99], ybottom = -1, xright = color_scheme$t [2:100], ytop = 1, col=bg_colors, lwd=0) Olivier. > Hi, > > I would like to colour different areas of a plot. > But I don't know how to do this efficiently. > > As an example; > > lets say three stimuli were presented in an experiment, alternating, > one at a time. Now I want to plot time on the x-axis and the > plot-area should colour code the stimulus that was presented at that > time interval (green for stimulus 1, yellow for stimulus 2 etc.) > > > here an example: > (t = time) > > > t <- 1:100 > bg_colors <- c(rep('green',20), rep('yellow',10), rep('green',20), rep > ('red',5), rep('yellow',45)) > > color_scheme <- data.frame(t, bg_colors) > > plot(c(), c(), xlim = c(1,100), ylim=c(-1,1)) > > > rect(xleft = 1, ybottom = -1, xright = 20, ytop = 1, col = 'green', > lwd=0) rect(xleft = 20, ybottom = -1, xright = 30, ytop = 1, col = > 'yellow', lwd=0) … > > > now how can I do this efficiently based on the color_scheme > data-frame and without having to manually draw all the rectangles as > in the example above? > > > > thanks for any suggestions! > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] International phonetic symbols in R.
Dear Rolf, I've started trying to understand your issue but it may take me some time as I'm rather busy within the next few days. However, if you can put the screen capture on an external web site, that would be great as it would help decipher what kind of system the student used for representing IPA characters as my first investigations on your data lead me to assume he/she (or you when reading the data) may not use an adequate unicode encoding... But depending on what the data actually look like, it would help locating the issue... Anyway, that is something "standard" in R. I use these fonts regularly within R so I'll help you as much as I can and obviously you do not need to upgrade your distrib. Olivier. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] International phonetic symbols in R.
g, I would happily provide advice to working with IPA characters within R. Yours sincerely. Olivier. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.univ-nantes.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error Installing or Updating Packages (Maybe because of a proxy)
Dear all, I receive the very same error message on a Debian computer (testing) with R 2.13.0 also. > install.packages('emu') Installing package(s) into ‘/home/olivier/R/i486-pc-linux-gnu-library/2.13’ (as ‘lib’ is unspecified) Error in ret[i, ] <- c(pkgs[i], lib, desc) : number of items to replace is not a multiple of replacement length I have no proxy settings on this computer (neither in .bashrc / .bash_profile, nor in my desktop environment, and I'm doing it at home where I'm not using any proxy). I can download a file on the web from within R (using both download.file () or download.packages ('emu','/home/olivier/R/i486-pc-linux-gnu-library/2.13')... and finally I can also use install.packages() on this downloaded file and the install works flawlessly. I can't find any old R base package in the various directories indicated by .libPaths(). > .libPaths() [1] "/home/olivier/R/i486-pc-linux-gnu-library/2.13" [2] "/usr/local/lib/R/site-library" [3] "/usr/lib/R/site-library" [4] "/usr/lib/R/library" The only place where I can think there may be one are the local trees ([1] and [2]) as the 2 others are (should be) updated automatically when updating R with the Debian pkg mngmt system and there's nothing inside them. Only [4] contains a base/ subdirectory (a single one) but I suppose this is the current one for R 2.13.0 I can install a package once it's been downloaded locally (through R CMD INSTALL pkg) but can't succeed in installing the same package from the CRAN mirrors using install.packages(). I experience the very same issue with all related instructions (old.packages(), update.packages()) I also could do that several months ago on a different Debian computer (but with an older R version than the current one). Any hints (including what kind of information I should give to enhance the description of this issue)? Olivier. On Wed, 20 Apr 2011 10:29:17 +0200 Uwe Ligges wrote: > If the internet connection from R works, can you please verify that > you do not have any R base package from an old R version in a current > R library that you may have in the .libPaths() already? > > Uwe Ligges > > > > On 20.04.2011 09:25, Majid Einian wrote: > > Dear R Helpers, > > (I am using Ubuntu lucid and R 2.13.0 > > When I try to update packages I get this error: > > > >> update.packages() > > --- Please select a CRAN mirror for use in this session --- > > Loading Tcl/Tk interface ... done > > Error in ret[i, ]<- c(pkgs[i], lib, desc) : > >number of items to replace is not a multiple of replacement > > length > > > > I had no problem before (case 1) but now (case 2) I cannot get it > > to work, googleing did not help: > > case 1: > > * connecting directly without any proxy setting (at my > > university) > > * using R 2.12.2 > > case 2: > > * connecting through proxy setting (at my workplace) > > * using R 2.13.0 > > > > I set the proxy in terminal too but it does not help (echo > > $http_proxy gives me http://192.168.0.1:8080/) > > > > __________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Département de Sciences du Langage UFR Lettres et Langages Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error Installing or Updating Packages (Maybe because of a proxy)
Back again, just tried at work (through a proxy, same R version, "should be" same Debian Linux version = Debian Testing recently updated but one on a Macbook computer (at home, does not work), the other on a Desktop PC (at work, works flawlessly)). Will try to investigate further... Majid, did you locate the source of your problem ? Thanks. Olivier. -Le Wed, 8 Jun 2011 17:32:36 +0200, Olivier Crouzet a écrit : > Dear all, > > I receive the very same error message on a Debian computer (testing) > with R 2.13.0 also. > > > install.packages('emu') > Installing package(s) into > ‘/home/olivier/R/i486-pc-linux-gnu-library/2.13’ (as ‘lib’ is > unspecified) > Error in ret[i, ] <- c(pkgs[i], lib, desc) : > number of items to replace is not a multiple of replacement length > > I have no proxy settings on this computer (neither > in .bashrc / .bash_profile, nor in my desktop environment, and I'm > doing it at home where I'm not using any proxy). > > I can download a file on the web from within R (using both > download.file () or download.packages > ('emu','/home/olivier/R/i486-pc-linux-gnu-library/2.13')... and > finally I can also use install.packages() on this downloaded file and > the install works flawlessly. > > I can't find any old R base package in the various directories > indicated by .libPaths(). > > > .libPaths() > [1] "/home/olivier/R/i486-pc-linux-gnu-library/2.13" > [2] "/usr/local/lib/R/site-library" > [3] "/usr/lib/R/site-library" > [4] "/usr/lib/R/library" > > The only place where I can think there may be one are the local trees > ([1] and [2]) as the 2 others are (should be) updated automatically > when updating R with the Debian pkg mngmt system and there's nothing > inside them. Only [4] contains a base/ subdirectory (a single one) > but I suppose this is the current one for R 2.13.0 > > I can install a package once it's been downloaded locally (through R > CMD INSTALL pkg) but can't succeed in installing the same package > from the CRAN mirrors using install.packages(). I experience the very > same issue with all related instructions (old.packages(), > update.packages()) > > I also could do that several months ago on a different Debian computer > (but with an older R version than the current one). > > Any hints (including what kind of information I should give to enhance > the description of this issue)? > > Olivier. > > > > > On Wed, 20 Apr 2011 10:29:17 +0200 Uwe Ligges > wrote: > > > If the internet connection from R works, can you please verify that > > you do not have any R base package from an old R version in a > > current R library that you may have in the .libPaths() already? > > > > Uwe Ligges > > > > > > > > On 20.04.2011 09:25, Majid Einian wrote: > > > Dear R Helpers, > > > (I am using Ubuntu lucid and R 2.13.0 > > > When I try to update packages I get this error: > > > > > >> update.packages() > > > --- Please select a CRAN mirror for use in this session --- > > > Loading Tcl/Tk interface ... done > > > Error in ret[i, ]<- c(pkgs[i], lib, desc) : > > >number of items to replace is not a multiple of replacement > > > length > > > > > > I had no problem before (case 1) but now (case 2) I cannot get it > > > to work, googleing did not help: > > > case 1: > > > * connecting directly without any proxy setting (at my > > > university) > > > * using R 2.12.2 > > > case 2: > > > * connecting through proxy setting (at my workplace) > > > * using R 2.13.0 > > > > > > I set the proxy in terminal too but it does not help (echo > > > $http_proxy gives me http://192.168.0.1:8080/) > > > > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html and provide commented, > > minimal, self-contained, reproducible code. > > -- Olivier Crouzet, PhD Laboratoire de Linguistique -- EA3827 Département de Sciences du Langage UFR Lettres et Langages Université de Nantes Chemin de la Censive du Tertre - BP 81227 44312 Nantes cedex 3 France phone:(+33) 02 40 14 14 05 (lab.) (+33) 02 40 14 14 36 (office) fax: (+33) 02 40 14 13 27 e-mail: olivier.crou...@univ-nantes.fr http://www.lling.fr/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error Installing or Updating Packages (Maybe because of a proxy)
Le Thu, 9 Jun 2011 12:14:55 +0200, Olivier Crouzet a écrit : Back again again, actually, the big difference between the two computers is in the library path. On the computer where package installation works, .libPaths() returns: > .libPaths() [1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" [3] "/usr/lib/R/library" With no path being part of my local home directory... and the install puts the installed packages into the first one (/usr/local/lib/R/site-library/) as expected. I will try to change the destination directory for the install on the other computer. Olivier. > > > just tried at work (through a proxy, same R version, "should be" same > Debian Linux version = Debian Testing recently updated but one on a > Macbook computer (at home, does not work), the other on a Desktop PC > (at work, works flawlessly)). > > Will try to investigate further... Majid, did you locate the source of > your problem ? > > Thanks. > Olivier. > > > > -Le Wed, 8 Jun > 2011 17:32:36 +0200, Olivier Crouzet a écrit : > > > Dear all, > > > > I receive the very same error message on a Debian computer (testing) > > with R 2.13.0 also. > > > > > install.packages('emu') > > Installing package(s) into > > ‘/home/olivier/R/i486-pc-linux-gnu-library/2.13’ (as ‘lib’ is > > unspecified) > > Error in ret[i, ] <- c(pkgs[i], lib, desc) : > > number of items to replace is not a multiple of replacement length > > > > I have no proxy settings on this computer (neither > > in .bashrc / .bash_profile, nor in my desktop environment, and I'm > > doing it at home where I'm not using any proxy). > > > > I can download a file on the web from within R (using both > > download.file () or download.packages > > ('emu','/home/olivier/R/i486-pc-linux-gnu-library/2.13')... and > > finally I can also use install.packages() on this downloaded file > > and the install works flawlessly. > > > > I can't find any old R base package in the various directories > > indicated by .libPaths(). > > > > > .libPaths() > > [1] "/home/olivier/R/i486-pc-linux-gnu-library/2.13" > > [2] "/usr/local/lib/R/site-library" > > [3] "/usr/lib/R/site-library" > > [4] "/usr/lib/R/library" > > > > The only place where I can think there may be one are the local > > trees ([1] and [2]) as the 2 others are (should be) updated > > automatically when updating R with the Debian pkg mngmt system and > > there's nothing inside them. Only [4] contains a base/ subdirectory > > (a single one) but I suppose this is the current one for R 2.13.0 > > > > I can install a package once it's been downloaded locally (through R > > CMD INSTALL pkg) but can't succeed in installing the same package > > from the CRAN mirrors using install.packages(). I experience the > > very same issue with all related instructions (old.packages(), > > update.packages()) > > > > I also could do that several months ago on a different Debian > > computer (but with an older R version than the current one). > > > > Any hints (including what kind of information I should give to > > enhance the description of this issue)? > > > > Olivier. > > > > > > > > > > On Wed, 20 Apr 2011 10:29:17 +0200 Uwe Ligges > > wrote: > > > > > If the internet connection from R works, can you please verify > > > that you do not have any R base package from an old R version in a > > > current R library that you may have in the .libPaths() already? > > > > > > Uwe Ligges > > > > > > > > > > > > On 20.04.2011 09:25, Majid Einian wrote: > > > > Dear R Helpers, > > > > (I am using Ubuntu lucid and R 2.13.0 > > > > When I try to update packages I get this error: > > > > > > > >> update.packages() > > > > --- Please select a CRAN mirror for use in this session --- > > > > Loading Tcl/Tk interface ... done > > > > Error in ret[i, ]<- c(pkgs[i], lib, desc) : > > > >number of items to replace is not a multiple of replacement > > > > length > > > > > > > > I had no problem before (case 1) but now (case 2) I cannot get > > > > it to work, googleing did not help: > > > > case 1: > > > > * connecting directly without any proxy setting (at
Re: [R] R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
Dear John, Considering that you've got the following dataframe: ID <- c(rep(1,10),rep(2,6),rep(3,2)) date <- c(rep(1,2),rep(2,2),rep(3,2),rep(4,2),rep(5,2), rep(5,3),rep(6,3),rep(10,2)) df <- data.frame(ID, date) I would suggest to go this way: newdf <- df %>% dplyr::group_by(ID) %>% dplyr::mutate(firstday = first(date)) Which produces: > newdf # A tibble: 18 × 3 # Groups: ID [3] ID date ave 1 1 1 1 2 1 1 1 3 1 2 1 4 1 2 1 5 1 3 1 6 1 3 1 7 1 4 1 8 1 4 1 9 1 5 1 10 1 5 1 11 2 5 5 12 2 5 5 13 2 5 5 14 2 6 5 15 2 6 5 16 2 6 5 17 31010 18 31010 I think it does what you need Olivier. Tom Woolman wrote: > Check out the dplyr package, specifically the mutate function. > > # Create new column based on existing column value > > df <- df %>% mutate(FirstDay = if(ID = 2, 5)) > > df > > > > Repeat as needed to capture all of the day/firstday combinations you > want to account for. > > Like everything else in R, there are probably at least a dozen other > ways to do this, between base R and all of the library packages > available. > > > > > On Wednesday, November 27th, 2024 at 11:30 AM, Sorkin, John > wrote: > > > > > > > I am an old, long time SAS programmer. I need to produce R code > > that processes a dataframe in a manner that is equivalent to that > > produced by using a by statement in SAS and an if first.day > > statement and a retain statement: > > > > I want to take data (olddata) that looks like this > > ID Day > > 1 1 > > 1 1 > > 1 2 > > 1 2 > > 1 3 > > 1 3 > > 1 4 > > 1 4 > > 1 5 > > 1 5 > > 2 5 > > 2 5 > > 2 5 > > 2 6 > > 2 6 > > 2 6 > > 3 10 > > 3 10 > > > > and make it look like this: > > (withing each ID I am copying the first value of Day into a new > > variable, FirstDay, and propagating the FirstDay value through all > > rows that have the same ID: > > > > ID Day FirstDay > > 1 1 1 > > 1 1 1 > > 1 2 1 > > 1 2 1 > > 1 3 1 > > 1 3 1 > > 1 4 1 > > 1 4 1 > > 1 5 1 > > 1 5 1 > > 2 5 5 > > 2 5 5 > > 2 5 5 > > 2 6 5 > > 2 6 5 > > 2 6 5 > > 3 10 3 > > 3 10 3 > > > > SAS code that can do this is: > > > > proc sort data=olddata; > > by ID Day; > > run; > > > > data newdata; > > retain FirstDay; > > set olddata; > > by ID; > > if first.ID then FirstDay=Day; > > run; > > > > I have NO idea how to do this is R (so I can't post test-code), but > > below I have R code that creates olddata: > > > > ID <- c(rep(1,10),rep(2,6),rep(3,2)) > > date <- c(rep(1,2),rep(2,2),rep(3,2),rep(4,2),rep(5,2), > > rep(5,3),rep(6,3),rep(10,2)) > > date > > olddata <- data.frame(ID=ID,date=date) > > olddata > > > > Any suggestions on how to do this would be appreciated. . . I have > > worked on this for more than 12-hours, despite multiple we searches > > I have gotten nowhere. . . > > > > Thanks > > John > > > > > > > > > > John David Sorkin M.D., Ph.D. > > Professor of Medicine, University of Maryland School of Medicine; > > Associate Director for Biostatistics and Informatics, Baltimore VA > > Medical Center Geriatrics Research, Education, and Clinical Center; > > PI Biostatistics and Informatics Core, University of Maryland > > School of Medicine Claude D. Pepper Older Americans Independence > > Center; Senior Statistician University of Maryland Center for > > Vascular Research; > > > > Division of Gerontology and Paliative Care, > > 10 North Greene Street > > GRECC (BT/18/GR) > > Baltimore, MD 21201-1524 > > Cell phone 443-418-5382 > > > > > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > https://www.R-project.org/posting-guide.html and provide commented, > > minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Remove all box around a plot except bottom line (base graphics)
Dear Michael, Isn't the axis() function what you're looking for? plot(rnorm(10), rnorm(10), axes=FALSE) axis(1) see help(axis) Yours. Olivier. On Thu, 28 Nov 2024 13:36:21 + Michael Dewey wrote: > To make the plot clearer I have removed the axes but I wish to remove > all the boz except the bottom horizontal line. Using the bty > parameter does not seem to enable me to just leave the horizontal > line at the foot. I can get the "l" version to remove everything > except the left hand side and the base. I could also remove the > entire box but that looks odd. Am I reading the documentation > incorrectly or is it really impossible? > > -- > Michael > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [off-topic] crossword
Thank you all for the helpful and enlightening comments. One question though, isn't "say" a synonym in oral forms of american english for "for example"? Which would translate to: > Writes in C or R, [for example]. which would involve that C and R are possible examples of the usage contexts considered here in which someone would "write"? This would then make perfect sense to me for the proposed answer: "codes". Yours. Olivier. On Fri, 13 Dec 2024 08:02:32 + CALUM POLWART wrote: > Well to complicate things, I don't think RULES is the answer. > > This is a cryptic crossword clue. They usually contain the answer > twice (well... Cryptically!!) > > Writes in C or R, say. > > I think the answer is CODER > > If you look up the definition of say in the dictionary one option is: > > > >1. give instructions to or direct somebody to do something with >authority (verb) > > > That's the simple part of the clue. (Notice the comma cryptic clues > have two parts giving the "same" answer) > > The more complex part I think is that and 'ode' (a poem that is > written like it is said or something) is written in between C and R > giving C ODE R, > > ... > > > Very happy to be corrected... > > > (Oh and as a third part a coder writes in C or R... I hope the > JavaScript kids are listening ;-) ) > > On Fri, 13 Dec 2024, 04:26 Ebert,Timothy Aaron, > wrote: > > > I do not understand the question and I do not understand the answer. > > Possibly one confounds the other. > > > > -Original Message- > > From: R-help On Behalf Of Erin > > Hodgess Sent: Thursday, December 12, 2024 11:56 AM > > To: Bill Dunlap > > Cc: r-help@R-project.org > > Subject: Re: [R] [off-topic] crossword > > > > [External Email] > > > > RULES! > > > > > > Erin Hodgess, PhD > > mailto: erinm.hodg...@gmail.com > > > > > > On Thu, Dec 12, 2024 at 9:42 AM Bill Dunlap > > wrote: > > > > > The New York Times crossword this morning had the clue (51 down, 5 > > > letters) "Writes in C or R, say". > > > > > > -Bill > > > > > > [[alternative HTML version deleted]] > > > > > > __ > > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > > https://stat/ > > > .ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C02%7Ctebert%40ufl.edu > > > %7C9366be18e5a944b55dba08dd1acde487%7C0d4da0f84a314d76ace60a62331e1b84 > > > %7C0%7C0%7C638696193817496836%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGki > > > OnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ > > > %3D%3D%7C0%7C%7C%7C&sdata=hhGilTFwNpgxXeDLO0HS7l4ofoCk%2FXuGhYx3QkuzFj > > > c%3D&reserved=0 > > > PLEASE do read the posting guide > > > https://www/. > > > r-project.org%2Fposting-guide.html&data=05%7C02%7Ctebert%40ufl.edu%7C9 > > > 366be18e5a944b55dba08dd1acde487%7C0d4da0f84a314d76ace60a62331e1b84%7C0 > > > %7C0%7C638696193817516516%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRy > > > dWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D% > > > 3D%7C0%7C%7C%7C&sdata=Z7oKvEwSTzOCNXiMVlYtWtGTg30KADP8F09tQyv3fkA%3D&r > > > eserved=0 and provide commented, minimal, self-contained, > > > reproducible code. > > > > > > > [[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > https://www.r-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > __ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > https://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. -- Olivier Crouzet, PhD http://olivier.ghostinthemachine.space /Maître de Conférences/ @LLING - Laboratoire de Linguistique de Nantes UMR6310 CNRS / Université de Nantes __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.