Re: [R] Code \255 no longer working to produce a short dash in base R PDF graphs

2025-02-21 Thread Paul Sherliker via R-help
Ivan Krylov wrote: >> text(1, 11, "baseline\255defined") >> text(1, 9, "done") >> graphics.off() >> >> They like that dash - but I never knew what it was called. >> >> Recently work updated my PC to the latest version of Windows, and, >> perforce, I updated to the latest version of R (4.4.

Re: [R] Code \255 no longer working to produce a short dash in base R PDF graphs

2025-02-20 Thread Duncan Murdoch
On 2025-02-19 6:36 a.m., Paul Sherliker via R-help wrote: I make graphs, in large quantities, for perfectionists. My bosses do not like the results of text like 'baseline-defined' in graphs; they feel that the resulting dash is too long. For many years, I have been in the habit of producing gr

Re: [R] Code \255 no longer working to produce a short dash in base R PDF graphs

2025-02-20 Thread Ivan Krylov via R-help
В Wed, 19 Feb 2025 11:36:15 + Paul Sherliker via R-help пишет: > text(1, 11, "baseline\255defined") > text(1, 9, "done") > graphics.off() > > They like that dash - but I never knew what it was called. > > Recently work updated my PC to the latest version of Windows, and, > perforce, I updat

Re: [R] code for year month day hr format

2024-06-17 Thread Jibrin Alhassan
Hello Rui, Thanks for your kind and unrelenting help. The code works actually. I will see what to do to sort things out. Please, accept my indebtedness. *Jibrin Adejoh Alhassan (Ph.D)* Department of Physics and Astronomy, University of Nigeria, Nsukka On Mon, Jun 17, 2024 at 8:53 PM Rui Barradas

Re: [R] code for year month day hr format

2024-06-17 Thread Rui Barradas
Às 09:44 de 17/06/2024, Jibrin Alhassan escreveu: Hello Rui, The df1 output printed from June instead of January .Here is part of it. 4288 2012-06-27 15 6.2 420 70 -7 109.9 4289 2012-06-27 16 6.5 442 70 -9 109.9 4290 2012-06-27 17 6.3 450 70 -6 109.9 4291 2012-06-27 18 6.0 45

Re: [R] code for year month day hr format

2024-06-17 Thread Jibrin Alhassan
Hello Rui, The df1 output printed from June instead of January .Here is part of it. 4288 2012-06-27 15 6.2 420 70 -7 109.9 4289 2012-06-27 16 6.5 442 70 -9 109.9 4290 2012-06-27 17 6.3 450 70 -6 109.9 4291 2012-06-27 18 6.0 453 700 109.9 4292 2012-06-27 19 6.7 473 70

Re: [R] code for year month day hr format

2024-06-17 Thread Rui Barradas
Às 09:12 de 17/06/2024, Jibrin Alhassan escreveu: Hello Rui, Here is the head(df1) output Date HR IMF SWS SSN Dst f10.7 1 2012-01-01 0 4.0 379 71 -8 999.9 2 2012-01-01 1 4.4 386 71 -3 999.9 3 2012-01-01 2 4.8 380 71 -4 999.9 4 2012-01-01 3 5.4 374 71 -5 999.9 5 2012-01-01 4 4.5 369

Re: [R] code for year month day hr format

2024-06-17 Thread Jibrin Alhassan
Hello Rui, Here is the head(df1) output Date HR IMF SWS SSN Dst f10.7 1 2012-01-01 0 4.0 379 71 -8 999.9 2 2012-01-01 1 4.4 386 71 -3 999.9 3 2012-01-01 2 4.8 380 71 -4 999.9 4 2012-01-01 3 5.4 374 71 -5 999.9 5 2012-01-01 4 4.5 369 71 -9 999.9 6 2012-01-01 5 4.2 368 71 -7 999.9 M

Re: [R] code for year month day hr format

2024-06-17 Thread Rui Barradas
Às 07:53 de 17/06/2024, Jibrin Alhassan escreveu: Part of it is pasted below YEAR DOY HRIMF SWS SSN Dst f10.7 2012 1 0 4.0 379. 71-8 999.9 2012 1 1 4.4 386. 71-3 999.9 2012 1 2 4.8 380. 71-4 999.9 2012 1 3 5.4 374. 71-5 999.9 2012 1 4 4.5

Re: [R] code for year month day hr format

2024-06-17 Thread Jibrin Alhassan
Part of it is pasted below YEAR DOY HRIMF SWS SSN Dst f10.7 2012 1 0 4.0 379. 71-8 999.9 2012 1 1 4.4 386. 71-3 999.9 2012 1 2 4.8 380. 71-4 999.9 2012 1 3 5.4 374. 71-5 999.9 2012 1 4 4.5 369. 71-9 999.9 2012 1 5 4.2 368. 71

Re: [R] code for year month day hr format

2024-06-16 Thread Jibrin Alhassan
Hello Rui, Your patience is indeed amazing. Your script tested as shown below worked perfectly well. df1 <- read.table(text = "YEAR DOY HR IMF SW SSNDst f10.7 2012 215 4 5.1 371. 143-4 138.6 ", header = TRUE) with(df1, paste(YEAR, DOY)) |> as.Date(format = "%Y %j") df1$Date <- with

Re: [R] code for year month day hr format

2024-06-16 Thread Rolf Turner
On Sun, 16 Jun 2024 08:33:03 +0100 Rui Barradas wrote: > Hello, > > There is an error in your new code: > > > paste YEAR with DOY, not with HR. > > > As for the rest, is your real data like the one you posted before? > If it is then I don't see anything wrong with my (tested) solution. >

Re: [R] code for year month day hr format

2024-06-16 Thread Rui Barradas
Às 21:42 de 15/06/2024, Jibrin Alhassan escreveu: Thank you Rui. I ran the following script df1 <- read.table("solar_hour", header = TRUE) df1$date <- as.Date(paste(df1$year, df1$hour), format = "%Y %j", origin = "2012-08-01-0") df2 <- df1[c("date", "IMF", "SWS", "SSN", "Dst", "f10")] head(df1)

Re: [R] code for year month day hr format

2024-06-15 Thread Jeff Newmiller via R-help
Please run your sequence of R statements one at a time so you can tell where the problem is. Only "run a script" after the code works one line at a time. There are too many places where things can go wrong otherwise. Is your file being read in properly? Is the filename correct? was the header p

Re: [R] code for year month day hr format

2024-06-15 Thread Jibrin Alhassan
Thank you Rui. I ran the following script df1 <- read.table("solar_hour", header = TRUE) df1$date <- as.Date(paste(df1$year, df1$hour), format = "%Y %j", origin = "2012-08-01-0") df2 <- df1[c("date", "IMF", "SWS", "SSN", "Dst", "f10")] head(df1) #To display all the rows print(df2). It gave me thi

Re: [R] code for year month day hr format

2024-06-15 Thread Ebert,Timothy Aaron
library(lubridate) library(dplyr) df1 <- read.table(text = "YEAR DOY HR IMF SW SSNDst f10.7 2012 214 0 3.4 403. 132-9 154.6 2012 214 1 3.7 388. 132 -10 154.6 2012 214 2 3.7 383. 132 -10 154.6 2012 214 3 3.7 391. 132-9 154.6 2012 215 4 5.1 371. 143-4 138.

Re: [R] code for year month day hr format

2024-06-15 Thread Rui Barradas
Às 20:00 de 15/06/2024, Jibrin Alhassan escreveu: I have solar-geophysical data e.g as blow: YEAR DOY HR IMF SW SSNDst f10.7 2012 214 0 3.4 403. 132-9 154.6 2012 214 1 3.7 388. 132 -10 154.6 2012 214 2 3.7 383. 132 -10 154.6 2012 214 3 3.7 391. 132-9 154.6 201

Re: [R] Code editor for writing R code

2023-11-30 Thread Dr Eberhard W Lisse
Sublime Text. On all platforms. On 29/11/2023 17:57, Christofer Bogaso wrote: > Hi, > > Currently I use VS-Code to write codes in R. While it is very good, it > does not allow me to write Latex expressions in comments, which I am > willing to have to write corresponding mathematical expressions a

Re: [R] Code editor for writing R code

2023-11-30 Thread Ivan Krylov
В Wed, 29 Nov 2023 21:27:37 +0530 Christofer Bogaso пишет: > Does there exist any Code editor for R, that allows me to write Latex > in comments? While I cannot guarantee that you'll like it, may I suggest GNU Emacs? Its R support is provided by the ESS package , and

Re: [R] Code editor for writing R code

2023-11-29 Thread Duncan Murdoch
On 29/11/2023 1:29 p.m., Eric Berger wrote: Bert, Posit (formerly RStudio) has moved from RMarkdown to Quarto. They still support RMarkdown but major new features will be in Quarto. For new users a better choice would be Quarto. See https://quarto.org/docs/faq/rmarkdown.html I'm not sure about

Re: [R] Code editor for writing R code

2023-11-29 Thread Jeff Newmiller via R-help
Quarto is built on top of RMarkdown when R is used, so RMarkdown isn't going anywhere soon. Don't spread unnecessary FUD. Quarto is well-supported in VSCode, though. And reply to the right branch of the thread... Bert is not in the thread below. On November 29, 2023 10:29:03 AM PST, Eric Berger

Re: [R] Code editor for writing R code

2023-11-29 Thread Eric Berger
Bert, Posit (formerly RStudio) has moved from RMarkdown to Quarto. They still support RMarkdown but major new features will be in Quarto. For new users a better choice would be Quarto. See https://quarto.org/docs/faq/rmarkdown.html Secondly, the OP stated he was using the VS-Code IDE, so there is

Re: [R] Code editor for writing R code

2023-11-29 Thread Christofer Bogaso
Hi Sergei, Where can I find TeX Comments extension in VS Code? On Wed, Nov 29, 2023 at 9:34 PM Sergei Ko wrote: > > TeX Comments extension in VS Code > > > > > Sent from my phone > > > Original message > From: Christofer Bogaso > Date: Wed, 29 Nov 2023, 15:57 > To: r-help > S

Re: [R] Code editor for writing R code

2023-11-29 Thread Bert Gunter
This might be of use to you: https://everyday.codes/tutorials/how-to-use-latex-in-rmarkdown/ -- Bert On Wed, Nov 29, 2023 at 8:21 AM Bert Gunter wrote: > > I believe RMarkdown can use and render latex comments. RStudio/Posix > provides ide extensions (e.g. R Notebooks) that seem to do what you

Re: [R] Code editor for writing R code

2023-11-29 Thread Bert Gunter
I believe RMarkdown can use and render latex comments. RStudio/Posix provides ide extensions (e.g. R Notebooks) that seem to do what you want, but I have no experience with them. As Ben suggested, there are likely others, depending on exactly what you want to do. -- Bert On Wed, Nov 29, 2023 at 7

Re: [R] Code editor for writing R code

2023-11-29 Thread Eric Berger
Another direction would be to replace your R script (.R file) with a Quarto document (.qmd file). VS-code has good support for Quarto and you could intersperse your Latex with R chunks. On Wed, Nov 29, 2023 at 6:15 PM Ben Bolker wrote: > > > >Presumably there's nothing stopping you *writing*

Re: [R] Code editor for writing R code

2023-11-29 Thread Ben Bolker
Presumably there's nothing stopping you *writing* LaTeX in comments -- do you want a code editor that will render and display the LaTeX as you write? (Or am I misunderstanding something?) Does anyone do classic literate programming *sensu* Knuth any more? https://rpubs.com/bbolker/3153

Re: [R] Code problem with R/Microeconomics

2021-11-01 Thread Eric Berger
Hi Olga, There are many people reading this list who are happy to try to help. Please provide some additional information about what you are trying to do and where you are stuck. Good luck, Eric On Mon, Nov 1, 2021 at 9:49 PM Olga Pervushina wrote: > > > Dear Sir/Madam, > > I am working on a sta

Re: [R] Code seems OK (no warnings, no error messages) but no results

2020-03-18 Thread varin sacha via R-help
Dear R Experts, So I managed to get the first part of my R code to work with one error message but R still gives me the result I am looking for. Now I'm trying to calculate the bootstrap confidence interval around the "MSE_fastMM" value. The end of my code after mean(my.data) does not work (err

Re: [R] Code seems OK (no warnings, no error messages) but no results

2020-03-18 Thread peter dalgaard
The double curlies in > my.experiment <- function() {{ look suspicious. -pd > On 16 Mar 2020, at 22:08 , varin sacha via R-help > wrote: > > Good afternoon, > > Here below my reproducible R code. I don't get any results. I am looking for > MSE_fastMM value and the bootstrap CIs around MS

Re: [R] Code modification for post-hoc power

2019-08-27 Thread Michael Dewey
getting stuck with a confusing error message sent earlier I don't understand. Best, Anne -Message d'origine- De : Michael Dewey [mailto:li...@dewey.myzen.co.uk] Envoyé : lundi, 26 août 2019 18:29 À : Marc Schwartz ; CHATTON Anne Cc : R-help Objet : Re: [R] Code modificati

Re: [R] Code modification for post-hoc power

2019-08-27 Thread Michael Dewey
confusing error message sent earlier I don't understand. Best, Anne -Message d'origine- De : Michael Dewey [mailto:li...@dewey.myzen.co.uk] Envoyé : lundi, 26 août 2019 18:29 À : Marc Schwartz ; CHATTON Anne Cc : R-help Objet : Re: [R] Code modification for post-hoc power Dea

Re: [R] Code modification for post-hoc power

2019-08-27 Thread CHATTON Anne via R-help
yzen.co.uk] Envoyé : lundi, 26 août 2019 18:29 À : Marc Schwartz ; CHATTON Anne Cc : R-help Objet : Re: [R] Code modification for post-hoc power Dear Anne In addition to Marc's comments if you are forced to do this then, assuming your package computes sample size from power then just fee

Re: [R] Code modification for post-hoc power

2019-08-26 Thread peter dalgaard
That doesn't work. In caricature, post-hoc power is - I observe a difference of nearly zero - However, to find a significant difference of that size I'd need 20 observations - I only used 100 observations - Therefore my study is useless and can be discarded (or: I calculate the probability

Re: [R] Code modification for post-hoc power

2019-08-26 Thread Michael Dewey
Dear Anne In addition to Marc's comments if you are forced to do this then, assuming your package computes sample size from power then just feed it a range of powers and find the one for which it calculates the sample size you had. There is a more elegant way to do this using uniroot but brut

Re: [R] Code modification for post-hoc power

2019-08-26 Thread Marc Schwartz via R-help
> On Aug 26, 2019, at 6:24 AM, CHATTON Anne via R-help > wrote: > > Hello everybody, > > I am trying to accommodate the R codes provided by Donohue for sample size > calculation in the package "longpower" with lmmpower function to estimate the > post-hoc power (asked by a reviewer) of a bin

Re: [R] Code that works when run as straight code, but that fails when run as a function

2019-08-23 Thread Rui Barradas
Hello, Inline. Às 20:45 de 23/08/19, Sorkin, John escreveu: I have code that works perfectly when run as in-line code, but that fails when the code is put into a function with the following message: Error in contest1D.lmerModLmerTest(model, ll, rhs = rhs, ddf = ddf, confint = confint, : lengt

Re: [R] Code that works when run as straight code, but that fails when run as a function

2019-08-23 Thread Sarah Goslee
Since this isn't reproducible, my first guess would be that alldata, which is required for your model, is not visible within the environment of the function. Or something similar: that kind of problem is almost always a scoping issue. Sarah On Fri, Aug 23, 2019 at 3:46 PM Sorkin, John wrote: >

Re: [R] Code driven data.frame naming question.

2019-04-15 Thread Fieck, Joe
Thanks for the reply Jeff. I will play around with your code example and see where it takes me. -Original Message- From: Jeff Newmiller Sent: Monday, April 15, 2019 4:55 PM To: r-help@r-project.org; Fieck, Joe ; R-help@r-project.org Subject: Re: [R] Code driven data.frame naming

Re: [R] Code driven data.frame naming question.

2019-04-15 Thread Jeff Newmiller
While the assign function is in fact the function you are looking for, I would strongly advise that you cease and desist in this endeavour and instead make a list of data frames rather than littering your global environment with many individual data frames. If you have a vector of names of file

Re: [R] Code "tags"

2018-10-10 Thread Jim Lemon
Hi Leslie, Keeping track of any sort of text (or music or pictures) can be challenging when the number of files becomes large. One way to organize a large collection is to categorize it in some way that makes sense to you. Say you create a directory structure: R_code___

Re: [R] Code "tags"

2018-10-10 Thread Leslie Rutkowski
"tags" are a way to label things digitally so that they are easier to find later - Twitter uses these, as one example. I found a nice solution: GitHubGist with an interface via Lepton, if anyone else would like to avoid rummaging through old code to find something (a function, an example, whatever

Re: [R] Code "tags"

2018-10-10 Thread Bert Gunter
"get organized around R programming" is rather vague. Nor do I know what you mean by "tagging" code snippets. A standard answer would be to write your "code" as documented functions in a package (e.g. "LeslieMisc"). RStudio -- a wholly separate software product -- has various tools to that may al

Re: [R] CODE HELP

2018-08-02 Thread Saptorshee Kanto Chakraborty
Hello, Thank you for replying. I am sorry te codes were not attached, I did attach them but I think it got blocked due to some filters. I am pasting the link for the codes: https://github.com/zhentaoshi/convex_prog_in_econometrics/tree/master/C-Lasso/PLS_static The authors never replied I have co

Re: [R] CODE HELP

2018-08-02 Thread Eric Berger
Hi Saptorshee, Two comments: 1. no attachments made it through to the list. You probably need to include the code directly in your email, and send your email as plain text (otherwise information gets stripped) 2. for anyone interested in following up on Saptorshee's question, I searched for the pap

Re: [R] Code to construct table with paired data

2017-04-08 Thread Mauricio Cardeal
Thank you Peter! Great solutions! That's exactly what I was looking for. Maurício Cardeal Em 08/04/2017 09:11, peter dalgaard escreveu: > Here's one way: > >> ddw <- reshape(dd, direction="wide", idvar="pair", timevar="treatfac") >> names(ddw) > [1] "pair" "imprfac.A" "imprfac.B" >> xtabs(

Re: [R] Code to construct table with paired data

2017-04-08 Thread peter dalgaard
Here's one way: > ddw <- reshape(dd, direction="wide", idvar="pair", timevar="treatfac") > names(ddw) [1] "pair" "imprfac.A" "imprfac.B" > xtabs(~ imprfac.A + imprfac.B, ddw) imprfac.B imprfac.A + - + 1 3 - 2 1 (reshape() is a bit of a pain to wrap one's mind around;

Re: [R] [FORGED] Re: R code, heat wave statistics

2016-07-18 Thread Rolf Turner
On 19/07/16 04:58, Christopher W Ryan wrote: I think much depends on how you define heat wave. --Chris Ryan Broome County Health Department Binghamton, NY USA Check out: @Article{Wong:2015:ASA, author = {T. S. T. Wong}, title ={Statistical Analysis of Heat Waves in

Re: [R] code to provoke a crash running rterm.exe on windows

2016-05-28 Thread Ben Bolker
Anthony Damico gmail.com> writes: > > hi, here's a minimal reproducible example that crashes my R 3.3.0 console > on a powerful windows server. below the example, i've put the error (not > crash) that occurs on R 3.2.3. > > should this be reported to http://bugs.r-project.org/ or am i doing >

Re: [R] Code for finding successive mean

2016-02-23 Thread PIKAL Petr
Hi see ?cutPOSIXt help page. something like aggregate(yourdata, list(cut(datetime, "30 mins")), mean) shall do the trick. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kwabena > Fosu-Amankwah > Sent: Tuesday, February 23, 2016 7:24

Re: [R] Code works on Mac but not Windows

2015-05-13 Thread Thierry Onkelinx
Yes > bar <- function(y = "12345"){ + message(y) + } > foo <- function(x = "a", y = "b"){ + bar(y = y) + } > bar() 12345 > bar(y = "abc") abc > foo() b > foo(y = "xyz") xyz ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie &

Re: [R] Code works on Mac but not Windows

2015-05-13 Thread Thierry Onkelinx
Dear Glenn, Please keep the mailing list in cc. In this case I would drop the "signature" like values and use correct defaults. TermStructure <- function(rates.data, method = "ns") you can drop if(missing(method)) method = "ns" in that case. Best regards, ir. Thierry Onkelinx Instituut voor n

Re: [R] Code works on Mac but not Windows

2015-05-12 Thread Thierry Onkelinx
Dear Glenn, I think that you are confusing the signature of a method and the default values of of function. It looks like you want the signature(rates.data = "character", method = "character"). But you are setting "character" as default value of both function arguments. Since you define a default

Re: [R] Code works on Mac but not Windows

2015-05-11 Thread Henrik Bengtsson
Before blaming Windows and/or OS X, make sure you verify the behavior on the exact same versions of R; it might be due to difference in R versions. If you're luck it's a bug that has been fixed and your problems goes away after updating. This is why folks on this lists are repeatable requesting t

Re: [R] Code works on Mac but not Windows

2015-05-11 Thread Glenn Schultz
Hi Thierry, Below is the function setMethod("initialize", signature("TermStructure"), function(.Object,..., tradedate = "character", period = "numeric", date = "character", spotrate = "numeric",

Re: [R] Code works on Mac but not Windows

2015-05-10 Thread Thierry Onkelinx
Dear Glenn, We need more details on the function. Please provide a commented, minimal, self-contained version of the function that reproduces the problem (as the posting guide asks you to do). Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Natu

Re: [R] Code formatting question - too ugly?

2014-07-22 Thread Jeff Newmiller
On Tue, 22 Jul 2014, John McKown wrote: I like to keep the individual lines in my source files relatively short. Mainly so that I can print them, email them, or display them on a narrow screen without needing to shift left & right. So, for a really long character string, such as an SQL query, I

Re: [R] Code for generating states and observations for HMM

2014-06-04 Thread Bukar Alhaji
Dear Dr Rolf, Thank you for your response and suggestion. But i still find it very difficult to relate my own problem to the sim.hmm() function you suggested. Because the states and the observations should come from Poisson and Negative Binomial distributions where state "0" to come from Poisso

Re: [R] Code for generating states and observations for HMM

2014-06-04 Thread Rolf Turner
Sorry, I haven't the time at the moment to delve into this in detail, but at a quick reading, your question makes no sense. If you are trying to simulate a hidden Markov chain, the states have a distribution as determined by the transition probability matrix and the initial state probability

Re: [R] Code for generating states and observations for HMM

2014-06-03 Thread Rolf Turner
You might find it helpful to look at the sim.hmm() function in the "hmm.discnp" package, or the simHMM() function in the "HMM" package. cheers, Rolf Turner On 03/06/14 21:17, Bukar Alhaji wrote: Dear R buddies, Sorry for this silly question but am new to R. I am trying to generate states a

Re: [R] Code Help

2013-12-01 Thread Rolf Turner
On 12/02/13 03:04, jeet chandvaniya wrote: Hi, sir i want help to develop code for outlier detection in r language, so help me for this. I recall that Monty Python did a skit that seems relevant here. The skit involved instructions on how to learn to play the flute and how to solve all the

Re: [R] Code Book from SPSS Data

2013-10-28 Thread Frank Harrell
Not certain about .por but this works with ordinary SPSS files: require(Hmisc) dat <- spss.get(...) # gets variable labels, etc. contents(dat) html(contents(dat), ...) The last command produces a hyperlinked data dictionary, e.g., for each variable the number of levels is given and you click o

Re: [R] Code Book from SPSS Data

2013-10-28 Thread Gesmann, Markus
ebook(dat) names(dat) description(dat) I hope this helps. Markus -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Maclean Sent: 26 October 2013 21:37 To: r-help@r-project.org Subject: Re: [R] Code Book from SPSS Data I do not

Re: [R] Code Book from SPSS Data

2013-10-27 Thread jwd
On Sun, 27 Oct 2013 14:37:27 -0700 (PDT) Peter Maclean wrote: It's not fully clear what you need, but, as I very vaguely recall, the code book in SPSS provided labels for what are called levels in "factors" in R, which are categorical variables. Try: "??categorical" at the prompt for starters.

Re: [R] Code Book from SPSS Data

2013-10-27 Thread Peter Maclean
I am trying again. I do not have SPSS and I would like to create a code book in a data frame format using R. I am reading the SPSS file using "memisc package". The script is: #Data for 2012 available at http://www.ark.ac.uk/nilt/datasets/ #Also attached ibrary(memisc) ## change the working direct

Re: [R] Code Book from SPSS Data

2013-10-27 Thread Barry Rowlingson
On Sat, Oct 26, 2013 at 9:37 PM, Peter Maclean wrote: > I do not have SPSS and I would like to create a code book in a data frame > format using R. > #How could I extract a codebook (without Summary statistics for printing)? This isn't that clear because I don't think 'codebook' is something w

Re: [R] Code overloading PC

2013-05-22 Thread Kristi Glover
ld I go 'Matlab' for this big data set? thanks > Date: Wed, 22 May 2013 15:56:18 +0100 > From: ruipbarra...@sapo.pt > To: kristi.glo...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] Code overloading PC > > Hello, > > In predict.glm, there's no

Re: [R] Code overloading PC

2013-05-22 Thread Rui Barradas
Hello, In predict.glm, there's no argument 'data', it's 'newdata'. As for your problem, maybe try doing one prediction at a time, write the results to file, then the next. Hope this helps, Rui Barradas Em 22-05-2013 15:20, Kristi Glover escreveu: Hi R user, I was trying to develop a model (

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread David Winsemius
On Jan 15, 2013, at 8:16 AM, Benjamin Gillespie wrote: Hi all, Thanks in advance for any help. I have a vector "b": b=c(1,1,1,2,3,4,3,2,1,1,1,1,1,2,3,4,5,4,3.5,3,2,1,1,1) Imagine b is river flow throughout time. I would like some code that will generate the following information: number o

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread Rui Barradas
Hello, Continuing Jessica's code, to get the maximum of each group just use b <- c(1,1,1,2,3,4,3,2,1,1,1,1,1,2,3,4,5,4,3.5,3,2,1,1,1) r <- rle(b > 1) groups <- rep(1:length(r$lengths),r$lengths) tapply(b, groups, FUN = max) # To get just the groups where b > 1, mx <- tapply(b, groups, FUN = m

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread Benjamin Gillespie
Thanks everyone, I've used the code Will supplied - this worked well. Thanks to all the others who contributed. Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ ___

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread Jessica Streicher
Maybe rle can help a little here rle(b>1) Run Length Encoding lengths: int [1:5] 3 5 5 8 3 values : logi [1:5] FALSE TRUE FALSE TRUE FALSE r<-rle(b>1) r$lengths[r$values] [1] 5 8 # started for the maximum but need to go home now, sorry. Will continue tomorrow if noone else finishes it. g

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread Jose Iparraguirre
Hi Ben I'm not sure whether I understood correctly, but is it something like this? > sum(ifelse(b==2,1,0)) [1] 4 > sum(ifelse(b==3,1,0)) [1] 4 > sum(ifelse(b>=2,1,0)) [1] 13 > sum(ifelse(b>2,1,0)) [1] 9 Etc... José José Iparraguirre Chief Economist Age UK -Original Message- From: r-h

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread William Dunlap
I don't completely understand the question, but if you are looking for the lengths of the runs of values greater than 1 then rle() would help: > b <- c(1,1,1,2,3,4,3,2,1,1,1,1,1,2,3,4,5,4,3.5,3,2,1,1,1) > r <- rle(b>1) > r Run Length Encoding lengths: int [1:5] 3 5 5 8 3 values : l

Re: [R] Code to fetch summary info from vector

2013-01-15 Thread Stephen Sefick
I don't know if I understand what you want. What are the periods? I suspect this is a time series. What have you tried that didn't work? kind regards, Stephen On 01/15/2013 10:16 AM, Benjamin Gillespie wrote: Hi all, Thanks in advance for any help. I have a vector "b": b=c(1,1,1,2,3,4,3,

Re: [R] code to convert 3D geographical coordinates to Cartesian?

2012-12-31 Thread Tom Roche
summary: I'm looking for packaged, tested code to convert geographical coordinates (e.g., longitude, latitude, elevation) to Cartesian coordinates (x,y,z) in 3-space. I know of R code for 2-space and for spherical <-> Cartesian. This can be extended (I attach a quick kludge extending pracma::sph2c

Re: [R] code to convert 3D geographical coordinates to Cartesian?

2012-12-31 Thread David Winsemius
On Dec 30, 2012, at 8:14 PM, Tom Roche wrote: https://stat.ethz.ch/pipermail/r-help/2012-December/332658.html Is there packaged code to convert geographical coordinates (e.g., longitude, latitude, elevation) to Cartesian coordinates in 3-space? ... Net: the task seems straightforward enough

Re: [R] code to convert 3D geographical coordinates to Cartesian?

2012-12-30 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2012-December/332658.html >> Is there packaged code to convert geographical coordinates (e.g., >> longitude, latitude, elevation) to Cartesian coordinates in 3-space? ... >> Net: the task seems straightforward enough, but there's certainly >> scope for error,

Re: [R] code to convert 3D geographical coordinates to Cartesian?

2012-12-30 Thread Bert Gunter
Have you checked the spatial stats task view on CRAN? http://cran.r-project.org/web/views/Spatial.html -- Bert On Sun, Dec 30, 2012 at 6:49 PM, Tom Roche wrote: > > Is there packaged code to convert geographical coordinates (e.g., > longitude, latitude, elevation) to Cartesian coordinates in 3

Re: [R] Code works standalone, yet same code fails when part of package

2012-12-17 Thread Martin Morgan
Hi Mick -- On 12/17/2012 02:01 PM, WATSON Mick wrote: Hi I'm missing something here but I cannot figure out what. What I can see is that the same code works when I load it via source(...) yet fails when I execute it after loading the package I have built (which includes the code. Below is a

Re: [R] code optimisation problem

2012-11-28 Thread Suzen, Mehmet
nal Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf >> Of cbe...@tajo.ucsd.edu >> Sent: Tuesday, November 27, 2012 4:53 PM >> To: r-h...@stat.math.ethz.ch >> Subject: Re: [R] code optimisation problem >>

Re: [R] code optimisation problem

2012-11-27 Thread William Dunlap
ay, November 27, 2012 4:53 PM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] code optimisation problem > > Rui Barradas writes: > > > Hello, > > > > Package 'compiler' is good at optimizing for loops. Try the following. > > > > Or vectori

Re: [R] code optimisation problem

2012-11-27 Thread cberry
Rui Barradas writes: > Hello, > > Package 'compiler' is good at optimizing for loops. Try the following. > Or vectorize the function > system.time(f1(x,10)) user system elapsed 5.010.005.00 > system.time(f1.c(x,10)) user system elapsed 1.920.001.91 > f2 <- func

Re: [R] code optimisation problem

2012-11-27 Thread Rui Barradas
Hello, Package 'compiler' is good at optimizing for loops. Try the following. #install.packages('compiler') library(compiler) f1.c <- cmpfun(f1) N <- 1e6 x <- rnorm(N) system.time(f1(x, 10)) user system elapsed 6.770.066.83 system.time(f1.c(x, 10)) user system elapsed 2.5

Re: [R] Code works, but not as function.

2012-11-15 Thread Peter Langfelder
On Thu, Nov 15, 2012 at 5:48 PM, Benjamin Ward (ENV) wrote: > Hi, > > I have some values in a list format generated by the following: > Path_Number <- 0010 > ID.Path <- formatC(0001:Path_Number, width=4, flag=0) # Make vector of ID's. > No_of_Effectors <- sample(1:550, length(ID.Path), replace=TRU

Re: [R] code ok in unix & R2.6 , fails in windows & R 2.12

2012-10-16 Thread Jellevanloon
Hi, I'm experiencing the same problems.. Installed the package DRM yestarday.. first couple of runs it worked.. I closed down R and now I want to do the same code again and I get the error: Error in drm(TotDmShoot ~ DAP, data = DATA, fct = gompGrowth.2()) : Cluster not specified. Use e.g. y ~

Re: [R] code coverter r to C

2012-07-26 Thread R. Michael Weylandt
Various abortive attempts have been tried, but no -- nothing of production quality. [To my knowledge] Michael On Jul 26, 2012, at 3:37 PM, suman kumar wrote: > Hi all, is there a package for converting R code into C code? > Thanks. > Suman > > > > -- > View this message in context: > http

Re: [R] Code scatter plot data from matrix with 3rd column

2012-07-03 Thread John Kane
Your data is effectively unreadable. Please use dput() to supply sample data. Here is one way to do what you want for data frames using the ggplot2 package. library(ggplot2) mydata <- data.frame(x = 1:10, y = rnorm(10), z = c(rep(1,4), rep(2, 6))) ggplot(mydata, aes(x, y, colour= as.factor( z)

Re: [R] Code scatter plot data from matrix with 3rd column

2012-07-03 Thread Rui Barradas
Hello, In order to avoid messing up the data, use dput. See below, in the end. As for your question, try this: set.seed(1234) xyz <- data.frame(x=sample(20, 10), y=sample(20, 10), z=sample(0:1, 10, TRUE)) # pch=16 --> solid circle; cex=4 --> 4 fold expansion with(xyz, plot(x, y, col=z+1, pch

Re: [R] code to iterate function apply to matrix

2012-05-16 Thread Uwe Ligges
On 16.05.2012 08:11, umai88 wrote: I got this code below and i want to repeat the loop for 100 times.. And what is the problem? What are you aiming at? Uwe Ligges x<-rnorm(60) mat1<-matrix(x,nrow=15,ncol=4) trim<-numeric(ncol(mat1)) win<-numeric(ncol(mat1)) ssd<-numeric(ncol(mat1)) fo

Re: [R] code for mixed model in R?

2012-02-24 Thread Ben Bolker
jurgen_vercauteren hotmail.com> writes: > I am analysing my data wit a mixed model. I used SAS but I want to redo the > same analysis in R. Here the SAS code and what I wrote in R. It seems to > work but the results are not the same. I don't know how to specify the class > variable in R or specif

Re: [R] code problem with the optim() function

2011-11-28 Thread Jeff Newmiller
This is R-help mailing list, not the do-my-work-for-me mailing list. You need to specify what you expect it to do and where it is going wrong, because wading through a lot of code on a wild goose chase is a waste of anyone else's time.

Re: [R] Code behind the Function

2011-10-18 Thread Duncan Murdoch
On 11-10-18 7:34 AM, Vikram Bahure wrote: Hi, I am a new user in R. I wanted to study the code for some R commands. For example, as I was studying PCA analysis there is a command in R, as "princomp". Normally if we type the command we get the code behind the function, but I am not able to get

Re: [R] Code for The R Book

2011-09-10 Thread John C Frain
Peter, Paul Why not complain to Wiley. Uwe is 100% correct. John On Saturday, 10 September 2011, Uwe Ligges wrote: > > > On 08.09.2011 10:56, Peter Raundal wrote: >> >> Hi Paul, >> >> I'm struggling to find the R code as well on the books website. Did you >> managed to get it and are you willi

Re: [R] Code for The R Book

2011-09-10 Thread Uwe Ligges
On 08.09.2011 10:56, Peter Raundal wrote: Hi Paul, I'm struggling to find the R code as well on the books website. Did you managed to get it and are you willing to share it with me? So time to ask the author who probably does not necessarily read this list. Or just buy another book that is

Re: [R] Code for The R Book

2011-09-08 Thread Peter Raundal
Hi Paul, I'm struggling to find the R code as well on the books website. Did you managed to get it and are you willing to share it with me? BR Peter -- View this message in context: http://r.789695.n4.nabble.com/Code-for-The-R-Book-tp3091596p3798218.html Sent from the R help mailing list archiv

Re: [R] Code is not doing anything

2011-07-24 Thread Dieter Menne
AriGold wrote: > > Hi this is my first post. I am trying to run a simulation for a computer > playing Von Neumann poker and adjusting it's expectation of an opponent's > behavior according to how the opponent plays. > > ... > Debugging length programs is not what this list is supposed to do,

Re: [R] Code Help

2011-07-10 Thread Joshua Wiley
On Sun, Jul 10, 2011 at 12:32 PM, finguy wrote: > Am I missing a Package? I'm not sure why is won't read the functions. Any That is the implication, yes. To find out which one (though one wonders how you got this code without knowing the packages it runs on), you can use the findFn() function fr

Re: [R] code for "permutative" operation

2011-03-14 Thread nblarson
You mean like cumsum()? > a<-1:10 > b<-cumsum(a) > b [1] 1 3 6 10 15 21 28 36 45 55 -Nick Larson -- View this message in context: http://r.789695.n4.nabble.com/code-for-permutative-operation-tp3354839p3354849.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] code for "permutative" operation

2011-03-14 Thread David Winsemius
On Mar 14, 2011, at 4:16 PM, Sascha Vieweg wrote: On 11-03-14 21:09, David Winsemius wrote: On Mar 14, 2011, at 3:52 PM, Sascha Vieweg wrote: Hello, I need some form of a "permutative" operation on a numeric vector x x = (v1, v2, v3, ..., vN) that produces x.r = (v1, v1+2, v1+v2+v3, ... v

  1   2   >