Re: [R] Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows

2024-11-30 Thread Christopher W. Ryan via R-help
Sorry, for completeness: library(dplyr) olddata %>% group_by(ID) %>% mutate(first = as.integer(row_number() == 1)) --Chris Ryan Christopher W. Ryan wrote: > Personally, I'd do this in the tidyverse with dplyr and its row_number() > function. > > olddata %>% gro

Re: [R] Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows

2024-11-30 Thread Christopher W. Ryan via R-help
Personally, I'd do this in the tidyverse with dplyr and its row_number() function. olddata %>% group_by(ID) %>% mutate(first = as.integer(row_number() == 1)) --Chris Ryan Sorkin, John wrote: > 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), >

[R] when installing packages for R on Linux, is it better to use my distro's package manager, or install.packages()?

2024-09-28 Thread Christopher W. Ryan
I'm running R (currently 4.4.1) on Linux Mint > sessionInfo() R version 4.4.1 (2024-06-14) Platform: x86_64-pc-linux-gnu Running under: Linux Mint 20.3 ...truncated... To install a new R package, is it better to use Linux Mint's pacakge manager (e.g. synaptic, apt-get, or similar), or to install

Re: [R] how to specify point symbols in the key on a lattice dotplot

2024-09-14 Thread Christopher W. Ryan
9E53101D261BEC070CFF1A0DC8BC50E715A672A0 On Sat, 14 Sep 2024 13:27:23 +0530, Deepayan Sarkar wrote: >On Fri, 13 Sept 2024 at 23:36, Christopher W. Ryan > wrote: >> >> For me, Bert's suggestion produces a plot with two black symbols >> above the plotting region, a circle and a triangle

Re: [R] how to specify point symbols in the key on a lattice dotplot

2024-09-13 Thread Christopher W. Ryan
ransit_time, groups = impact, data = ., >pch = 16:17, >cex = 1.8, > scales = list(cex = 1.4), >key = list(points = list(pch =16:17) )) > >Cheers, >Bert > > >On Fri, Sep 13, 2024 at 9:53 AM Christopher W. Ryan &

Re: [R] how to specify point symbols in the key on a lattice dotplot

2024-09-13 Thread Christopher W. Ryan
the most from their data. www.agencystatistical.com Public GnuPG email encryption key at https://keys.openpgp.org 9E53101D261BEC070CFF1A0DC8BC50E715A672A0 On Fri, 13 Sep 2024 08:29:20 +0100, CALUM POLWART wrote: >Add: > >key = list(points=16:17) > >Into the dotplot section possibly without the

[R] how to specify point symbols in the key on a lattice dotplot

2024-09-13 Thread Christopher W. Ryan
I am making a dotplot with lattice, as follows: dd %>% dotplot( segment ~ transit_time, groups = impact, data = ., as.table = TRUE, pch = 16:17, cex = 1.8, scales = list(cex = 1.4), auto.key = TRUE) impact is a factor

[R] effects() extractor for a quantile reqression object: error message

2024-09-05 Thread Christopher W. Ryan via R-help
I'm using quantreg package version 5.98 of 24 May 2024, in R 4.4.1 on Linux Mint. The online documentation for quantreg says, in part, under the description of the rq.object, "The coefficients, residuals, and effects may be extracted by the generic functions of the same name, rather than by the $

[R] lattice panel layout like cross-tabs, like a 2 x 2 table.

2024-08-30 Thread Christopher W. Ryan via R-help
Years ago, I recall creating lattice plots with two binary factors, call them f1 and f2, as in xyplot(y ~ x | f1 + f2, data = dd) and I made it so the rows had strips on the left with the levels of one factor, and the columns had strips on the top with the levels of the other factor. Sort of lik

[R] unable to get barchart of censored subjects from ggsurvplot() in survminer package, if there is no predcitor

2024-06-17 Thread Christopher W. Ryan via R-help
Hello. Running R 4.2.3 on Windows 10. Using survimer package version survminer_0.4.9 published 2021-03-09. I'm encountering an error with ggsurvplot() in the survminer package. Email to the author/maintainer about 2 weeks ago has not yet resulted in a reply. I seem unable to produce a n.censor.ta

Re: [R] Obtaining a value of pie in a zero inflated model (fm-zinb2)

2024-01-04 Thread Christopher W. Ryan via R-help
Are you referring to the zeroinfl() function in the countreg package? If so, I think predict(fm_zinb2, type = "zero", newdata = some.new.data) will give you pi for each combination of covariate values that you provide in some.new.data where pi is the probability to observe a zero from the point

Re: [R] anyone having trouble accesing CRAN?

2023-11-15 Thread Christopher W. Ryan via R-help
Ah, thanks all. Guess I missed the message before they started the maintenance. --Chris Ivan Krylov wrote: > On Wed, 15 Nov 2023 14:13:00 -0500 > "Christopher W. Ryan via R-help" wrote: > >> Anyone seeing similar? > > Same for me. > > While it worked, C

[R] anyone having trouble accesing CRAN?

2023-11-15 Thread Christopher W. Ryan via R-help
at https://cran.r-project.org/ I get this error message: = Secure Connection Failed An error occurred during a connection to cran.r-project.org. PR_END_OF_FILE_ERROR Error code: PR_END_OF_FILE_ERROR The page you are trying to view cannot be shown because the authenticity

Re: [R] make a lattice dotplot with symbol size proportional to a variable in the plotted dataframe

2023-11-08 Thread Christopher W. Ryan via R-help
Very helpful, Deepayan, and educational. Thank you. What does NSE stand for? Thanks, Chris Deepayan Sarkar wrote: > > --Chris Ryan __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Sum data according to date in sequence

2023-11-02 Thread Christopher W. Ryan via R-help
date appears to be a character variable, and R is treating it as such. str(dt1) might give you some insight. Or the dplyr equivalent glimpse(dt1) I think R did what you asked, but if you want to be able to order records by date, in temporal order, you need to tell R that it is a date: library

Re: [R] Amazing AI

2022-12-19 Thread Christopher W. Ryan via R-help
In clinical medicine, the question the patient asks rarely represents their main concern. Most of what I've done in my career, and most of what I've taught, is about how to have the back-and-forth dynamic dialoq with the patient, to help them formulate what's really on their mind, and make sure I u

Re: [R] Circular Graph Recommendation Request

2022-05-29 Thread Christopher W. Ryan via R-help
If the units of analysis are real spatial regions (e.g. states), how about a cartogram? https://gisgeography.com/cartogram-maps/ An R package (I have no experience with it) https://cran.r-project.org/web/packages/cartogram/index.html The advantage of a cartogram is that it is a single graphic,

Re: [R] [External Email] Re: how to rename variables by lopping off first 3 characters

2022-03-14 Thread Christopher W Ryan via R-help
"The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Mon, Mar 14, 2022 at 9:27 AM Christopher W Ryan via R-help > wrote: > > > >

[R] the opposite of pluck() in purrr

2021-11-18 Thread Christopher W. Ryan via R-help
I've just learned about pluck() and chuck() in the purrr package. Very cool! As I understand it, they both will return one element of a list, either by name or by [[]] index, or even "first" or "last" I was hoping to find a way to return all *but* one specified element of a list. Speaking loosel

Re: [R] [External Email] Re: how to make the far right section of a smoother line look different from the rest of that line?

2021-11-16 Thread Christopher W Ryan via R-help
rouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Nov 16, 2021 at 7:45 AM Christopher W Ryan via R-help < > r-help@r-pro

[R] how to make the far right section of a smoother line look different from the rest of that line?

2021-11-16 Thread Christopher W Ryan via R-help
eclrs.3 %>% mutate(start.week = floor_date(realCollectionDate, unit = "week")) %>% group_by(start.week, k12) %>% summarise(n = n(), pctpos = 100 * mean(realResult)) %>% xyplot(pctpos ~ start.week | k12, col = "red", data = ., layout = c(1,2), ylab = "percent of test results positive", xlab = "spec

Re: [R] [External Email] Live Online Training for High School Teachers and Students

2021-11-04 Thread Christopher W Ryan via R-help
Tracy-- I enjoy doing this sort of thing. Over the years I've done two full-day "introduction to R" workshops for high school students. The workshops also inevitably get into software-agnostic, basic issues about how to think about data, and how to measure, record, and store it---which is all pret

Re: [R] [External Email] Group by and add a constant value based on a condition dply

2021-05-26 Thread Christopher W Ryan via R-help
Is the grouping beforehand necessary? Could you simply, "for all the dates that are "4.01.2020" and have the "Value" greater than zero add 5 to the "Value" "? I may be missing something. --Chris Ryan On Wed, May 26, 2021 at 11:53 AM Elahe chalabi via R-help < r-help@r-project.org> wrote: > Hi

Re: [R] [External Email] how to generate this kind of graph

2020-07-23 Thread Christopher W Ryan
You might like the beeswarm package. --Chris Ryan SUNY Upstate Medical University and Broome County Health Department On Thu, Jul 23, 2020 at 1:15 AM array chip via R-help wrote: > > Hello everyone, > > I saw this scatterplots from a paper and thought it looked very nice: > > > https://drive.go

[R] challenging data merging/joining problem

2020-07-05 Thread Christopher W. Ryan
I've been conducting relatively simple COVID-19 surveillance for our jurisdiction. We get data on lab test results automatically, and then interview patients to obtain other information, like clinical details. We had been recording all data in our long-time data system (call it dataSystemA). But as

Re: [R] [External Email] R Software Risk Analysis

2020-06-18 Thread Christopher W. Ryan
I use R every day with pretty sensitive data in my county health department. Of course, this is for manipulation and analysis of data pulled from their sources, not for interacting directly with, or updating, patient records in any clinically operational sense. As others have said, the structure an

Re: [R] [External Email] Re: [External] Re: access for free more than 500 essential Springer Nature textbooks

2020-05-22 Thread Christopher W. Ryan
Am I interpreting this offer correctly, that it is for libraries to obtain access to the e-books for free? It does not seem to me that an invididual can download one--am I missing that part? Thanks --Chris Ryan Mark Leeds wrote: > Abby: here's an easier link for seeing what you might like. > >

[R] CRAN library down? - UPDATE

2020-05-02 Thread Christopher W. Ryan
The message at that URL reads: CRAN mirror restricted to UC Berkeley The CRAN mirror at UC Berkeley's College of Natural Resources is no longer available to off campus users and has been removed from the CRAN mirror list. The load on our server was too much. Berkeley folks can continue to access

Re: [R] [External Email] Re: arranging multiple lattice graphs on a page

2020-04-02 Thread Christopher W. Ryan
aving an open mind is that people keep coming along >and sticking things into it." >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > >On Thu, Apr 2, 2020 at 2:23 PM Christopher W. Ryan > wrote: >> >> I would like to place two se

[R] arranging multiple lattice graphs on a page

2020-04-02 Thread Christopher W. Ryan
I would like to place two separate plots, one above the other, something like this (MWE for illustration): library(lattice) data(iris) layout(matrix(c(1,2), 2, 1, byrow = TRUE)) with(iris, (plot(Sepal.Length ~ Petal.Length))) with(iris, (plot(Sepal.Length ~ Petal.Width))) but with lattice, so one

Re: [R] [External Email] Re: incomplete reading of a large csv file

2020-02-21 Thread Christopher W. Ryan
> On 21.02.2020 20:10, Christopher W. Ryan wrote: >> sessionInfo at end of message. >> >> I have data that I was given as an Excel .xlsx file. It contains 96266 >> lines and 24 columns. I opened it in OpenOffice.org and saved it in .csv >> format, using the pip

[R] incomplete reading of a large csv file

2020-02-21 Thread Christopher W. Ryan
sessionInfo at end of message. I have data that I was given as an Excel .xlsx file. It contains 96266 lines and 24 columns. I opened it in OpenOffice.org and saved it in .csv format, using the pipe character as a field separator. This produced a file with 96266 lines. When I read it into R thusly

Re: [R] [External Email] Help to do this exercise

2020-02-10 Thread Christopher W Ryan
Homework questions are generally frowned upon on R-help List. It is best to discuss those questions with your instructor. --Chris Ryan SUNY Upstate Medical University Clinical Campus at Binghamton On Mon, Feb 10, 2020 at 9:39 AM hương phạm wrote: > N1 Consider the database "LakeHuron" , contain

[R] how to change format of dates in a tibble

2019-12-18 Thread Christopher W Ryan
I'm not understanding how the tidyverse handles date formats. output of sessionInfo() at the end of my message. dateRanges <- structure(list(apptType = structure(1:2, .Label = c("initial visit", "start of treatment visit"), class = "factor"), minMadeRequestDates = structure(c(18124, 18115), class

Re: [R] help about codes from probability

2019-11-07 Thread Christopher W. Ryan
Is this homework for a class? If so, it would be better to ask your professor for guidance. R-help List frowns on homework questions. Chris Ryan On November 7, 2019 2:46:32 AM EST, Sadia Seddiqi wrote: >Could you help me how I can solve run this code in R-labUnions > >1-You are picking flowers

[R] how to place a rug on only the x-axis in a scatterplot with lattice

2019-11-05 Thread Christopher W Ryan
The following produces a scatterplot with rugs on both the vertical and horizontal axes. library(dplyr) library(stringr) library(lattice) library(latticeExtra) ## . xyplot(scheduleInterval ~ calledForApptDate, data = dd.2, xlab = "Date patient called for appointment", ylab = "Days in the futur

[R] getting summary statistics easily with dplyr

2019-11-05 Thread Christopher W Ryan
I'm trying to modernize my way of thinking, and my coding, into the dplyr/tidyverse way of doing things. To get basic summary statistics on a variable in a dataframe, with the output also being a dataframe. I previously would do something like this, using other packages: library(doBy) doBy.output

[R] reading in csv files, some of which have column names and some of which don't

2019-08-13 Thread Christopher W Ryan
Alas, we spend so much time and energy on data wrangling . . . . I'm given a collection of csv files to work with---"found data". They arose via saving Excel files to csv format. They all have the same column structure, except that some were saved with column names and some were not. I have a cod

Re: [R] help

2019-07-16 Thread Christopher W Ryan
You will get the best help if you: 1. post email in plain text, not html 2. post the command/code you issued and the result/error that was returned 3. Information about your operating system sometimes helps. --Chris Ryan Binghamton, NY, US On Tue, Jul 16, 2019 at 3:36 PM Sujaya wrote: > Respec

Re: [R] Help installing netReg

2019-04-15 Thread Christopher W. Ryan
Sorry, was typing on my phone. Not "compy." "Computer." I was asking whether you were working on your own, standalone, computer, or whether perhaps this was an institutional, networked, machine, on which you don't have write permissions that you need. --Chris Ryan Spencer Brackett wrote: > Mr

Re: [R] R maintains old values

2018-07-03 Thread Christopher W Ryan
This TV series might have some advice on that. https://www.imdb.com/title/tt2543312/ --Chris Ryan On Tue, Jul 3, 2018 at 9:25 AM, J C Nash wrote: > . . . Now, to add to the controversy, how do you set a computer on fire? > > JN > > [[alternative HTML version deleted]] ___

Re: [R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Christopher W. Ryan
Richard-- Nice. If I understand your code correctly, in the line ddm <- matrix("", (n+2) %/% nc, nc) I could instead use ddm <- matrix("", (n + nc - 1) %/% nc, nc) for generalizability, as I may have to increase nc as the list of words grows ever longer. Thanks everyone. Several good suggesti

[R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Christopher W Ryan
I'm writing code for a recurring report, using an R --> Sweave --> pdflatex workflow. It includes a character vector of short words that I would like to display compactly, in columns on a page, rather than one word per line, which would waste a lot of space. The vector of words will increase unpred

Re: [R] How would I color points conditional on their value in a plot of a time series

2018-05-01 Thread Christopher W Ryan
ck", "red")) > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Tue, May 1, 2018 at 1:17 PM, Christopher W Ryan > wrote: > >> How would I color points conditional on their value in a plot of a time >> series. Something like this: >

[R] How would I color points conditional on their value in a plot of a time series

2018-05-01 Thread Christopher W Ryan
How would I color points conditional on their value in a plot of a time series. Something like this: ## demonstration data ttt <- ts(rpois(12, lambda = 8), start = c(2000, 1), freq = 4) ttt plot(ttt, type = "p") ## doesn't work--all points the same color plot(ttt, type = "p", col = ifelse(ttt <

Re: [R] Reasons to Use R in a Public Administrations and Ideas for a Short Training

2018-04-19 Thread Christopher W Ryan
A few years ago I gave two 5-hour workshops about R to a class of US high school students in a somewhat-accelerated science research class (so these were already science-motivated kids). They had been using mainly Excel, and some SPSS for which the school had a license. Overall they seemed to lik

Re: [R] Data cleaning & Data preparation, what do R users want?

2017-11-29 Thread Christopher W. Ryan
Great question. What do I want? I want my co-workers to stop using Excel spreadsheets for data entry, storage, and sharing! I want them to understand the value of data discipline. But alas . . . . I work in a county health department in the US. Between dplyr, stringr, grep, grepl, and the base R r

Re: [R] Help

2017-06-20 Thread Christopher W Ryan
Leonardo-- R-help can be a very useful resource. Some suggestions to use it well: 1. use an informative subject line, not "help" 2. include a "minimal working example:" a *little* data, the code that, with those data, reproduces your problem, and the error message that resulted. As to your parti

Re: [R] How to Transform a Factor Variable into a Date

2017-06-19 Thread Christopher W Ryan
A couple thoughts: 1. converting factors into dates often requires that they be converted to character first. 2. you don't really have dates; you have just months and years 3. therefore perhaps the as.yearmon() function in the zoo package could help library(zoo) my.factor <- factor("Feb 2017")

Re: [R] about fitting a regression line

2017-06-15 Thread Christopher W Ryan
Rather than just posting your error message, it helps immensely to post the code that produced the error--indeed with some small sample data that reproduces the problem. x <- rnorm(40) y <- 0.6 * x + rnorm(40, sd = 0.3) plot(y ~ x) model <- lm(y ~ cos(x)) summary(model) plot(y ~ cos(x)) abline(mod

[R] trouble with starting date in sts and disProg objects in the surveillance package

2016-12-27 Thread Christopher W Ryan
I create a data frame, then, using package surveillance version 1.3, I convert it to a surveillance time series (sts) object and then to a disProg object. But in the plot of the disProg object, the dates seem to be mislabelled? Grateful for any advice. --Chris Ryan Broome County Health Departmen

Re: [R] dplyr or plyr or both?

2016-09-15 Thread Christopher W. Ryan
have the impression that it is also possible to library dplyr after plyr, but it is better to remove plyr! This is a serious problem that has been reported before, but not solved (in dplyr 0.5.0 and plyr 1.8.4) Frams 2016-09-15 16:09 GMT+02:00 Christopher W Ryan mailto:cr...@binghamton.edu>&

[R] dplyr or plyr or both?

2016-09-15 Thread Christopher W Ryan
I've set myself the task of learning about these packages, and about tidy data concepts. What is the relationship between plyr and dplyr? Does the latter replace the former (meaning I can concentrate on learning the latter)? Or is there ever a need to use functions from both (meaning I should lea

Re: [R] what happened to inside-r? [possibly OT]

2016-08-01 Thread Christopher W Ryan
pages nowhere to be found. Alas! But thanks anyway. --Chris On Fri, Jul 29, 2016 at 3:54 PM, David Winsemius wrote: > Been off the grid for the last year? MS bought Revolution R. > > > Sent from my iPhone > >> On Jul 29, 2016, at 11:30 AM, Christopher W. Ryan >> wrot

[R] I'm getting confused with notation and terminology in output from weibull parametric survival model from survreg()

2016-07-29 Thread Christopher W. Ryan
I'm trying to run a Weibull parametric survival model for recurrent event data, with subject-specific frailties, using survreg() in the survival package, and I'm having trouble understanding the output and its notation, and how that translates to some of the books I am using as references (DF M

[R] what happened to inside-r? [possibly OT]

2016-07-29 Thread Christopher W. Ryan
This might be a bit off-topic, but up until recently (a day or so ago?) I loved using inside-r.org as a quick and easy way to access help pages on R commands. Took me to what I needed without any fuss. Now that URL redirects to the "Microsoft R Application Network"? Looks to be something relat

Re: [R] R code, heat wave statistics

2016-07-18 Thread Christopher W Ryan
I think much depends on how you define heat wave. --Chris Ryan Broome County Health Department Binghamton, NY USA On Mon, Jul 18, 2016 at 6:16 AM, Damjan / wrote: > Dar all, > > I have a txt file with 4 column data about daily maximum temperature for > some years. > > I need to find the number o

Re: [R] Documenting data

2016-06-30 Thread Christopher W Ryan
changes on the objects in R. Have you looked into various "reproducible research" systems for R, like Sweave or knitr?  They allow you to include analysis code and text of a manuscript or report all together in one file. Christopher W. Ryan sent from my phone with BlueMail On Ju

Re: [R] anonymizing subject identifiers for survival analysis

2016-05-17 Thread Christopher W. Ryan
Excellent, thanks. Much simpler. --Chris Christopher W. Ryan, MD, MS cryanatbinghamtondotedu https://www.linkedin.com/in/ryancw Early success is a terrible teacher. You’re essentially being rewarded for a lack of preparation, so when you find yourself in a situation where you must prepare, you

Re: [R] What is the easiest way to turn a dataframe into a barplot?

2016-05-13 Thread Christopher W. Ryan
Here is one way: dd <- data.frame(var1=c("string1", "string2", "string3"), var2=c(3,7,4)) dd with(dd, barplot(var2, names.arg=var1)) --Chris Ryan Binghamton, NY yoursurrogate...@gmail.com wrote: > Hello, I can't post my code since it's on a work computer. > > But basically, I have a dataframe t

[R] anonymizing subject identifiers for survival analysis

2016-05-13 Thread Christopher W Ryan
I would like to conduct a survival analysis, examining a subject's time to *next* appearance in a database, after their first appearance. It is a database of dated events. I need to obfuscate or anonymize or mask the subject identifiers (a combination of name and birthdate). And obviously any give

Re: [R] detecting any element in a vector of strings, appearing anywhere in any of several character variables in a dataframe

2015-07-13 Thread Christopher W Ryan
er. Both Bert's and Jeff's (eventual) solution protect against > partial (rather than full-word) matches, while mine doesn't (though it could > easily be modified to do that). > > Best, > John > >> -Original Message- >> From: Christopher W Ryan [

Re: [R] detecting any element in a vector of strings, appearing anywhere in any of several character variables in a dataframe

2015-07-10 Thread Christopher W Ryan
rds" on whitespace. >>>>>Then the matching is vectorized with the any( %in% ... ) call. >>>>> >>>>>Cheers, >>>>>Bert >>>>>Bert Gunter >>>>> >>>>>"Data is not information. Information is not knowledge. And knowledge >>>>&

[R] detecting any element in a vector of strings, appearing anywhere in any of several character variables in a dataframe

2015-07-09 Thread Christopher W. Ryan
Running R 3.1.1 on windows 7 I want to identify as a case any record in a dataframe that contains any of several keywords in any of several variables. Example: # create a dataframe with 4 variables and 10 records v2 <- c("white bird", "blue bird", "green turtle", "quick brown fox", "big black do

[R] detecting any element in a vector of strings, appearing anywhere in any of several character variables in a dataframe

2015-07-09 Thread Christopher W Ryan
Running R 3.1.1 on windows 7 I want to identify as a case any record in a dataframe that contains any of several keywords in any of several variables. Example: # create a dataframe with 4 variables and 10 records v2 <- c("white bird", "blue bird", "green turtle", "quick brown fox", "big black do

Re: [R] plotting the one-dimensional density of events in time

2015-03-09 Thread Christopher W. Ryan
Tom and Bill-- Thanks! Both excellent solutions. --Chris Christopher W. Ryan, MD, MS cryanatbinghamtondotedu Early success is a terrible teacher. You’re essentially being rewarded for a lack of preparation, so when you find yourself in a situation where you must prepare, you can’t do it. You

[R] plotting the one-dimensional density of events in time

2015-03-06 Thread Christopher W. Ryan
umeric(dd)) # But horizontal axis label is not very informative # would prefer labeling the start of each month plot(density(as.numeric(dd)), axes=FALSE) library(zoo) new.axis <- as.yearmon(dd) # but then what? This is where I get stuck--adding back a sensible axis Grateful for any guid

Re: [R] Best Beginner Books?

2014-10-01 Thread Christopher W Ryan
I would recommend these for the absolute beginner with R: "A Beginner's Guide to R" by Zuur and "Data Manipulation with R" by Spector I have not seen this, but if their pattern holds, this one coming out from Highland Statistics will also probably be useful for a newcomer: A Beginner's Guide to

[R] package loadable in R 3.1.1 Rterm but not in emacs/ESS

2014-09-26 Thread Christopher W Ryan
I'm running R on Windows 7. Clean install on a brand new computer yesterday. I installed Protext then R then Vincent Goulet's emacs with ESS, in that order. I then installed some R packages, in the R terminal window. Among them was car Today I opened emacs, hit M-x R to start an R session, and

Re: [R] empty density plot for point pattern in spatstat

2014-07-02 Thread Christopher W Ryan
gt; Hi Chris, > > Try the form: plot(dens, useRaster=FALSE, ribargs=list(useRaster=FALSE)) > > > > Pablo > > > 2014-06-20 15:58 GMT-05:00 Christopher W Ryan : > >> I'm back in the office with the machine that was giving me trouble. >> >> # fresh st

Re: [R] empty density plot for point pattern in spatstat

2014-06-20 Thread Christopher W Ryan
I'm back in the office with the machine that was giving me trouble. # fresh start-up of R 3.1.0, installed on the my machine's hard drive, #under Windows XP Service Pack 3. # spatstat version 1.37-0 library(spatstat) data(redwood) dens <- density(redwood) str(dens) # everything looks to be in ord

Re: [R] empty density plot for point pattern in spatstat

2014-06-18 Thread Christopher W. Ryan
ure it out. > > regards > Adrian > > > Prof Adrian Baddeley FAA > University of Western Australia > ____ > From: Pablo Ramón [para...@utpl.edu.ec] > Sent: Wednesday, 18 June 2014 9:36 PM > To: Rolf Turner > Cc: Christophe

Re: [R] empty density plot for point pattern in spatstat

2014-06-17 Thread Christopher W Ryan
h just the figure border # and a thin vertical box for the color ramp # but no color ramp in it Any other ideas? I'd be much obliged. Thanks. --Chris Ryan On Tue, May 20, 2014 at 4:31 PM, Christopher W Ryan wrote

[R] empty density plot for point pattern in spatstat

2014-05-20 Thread Christopher W Ryan
I'm running R-3.0.3 on Windows XP Professional on an institutional PC. (My freedom to update to a more recent version of R is limited, although I might be able to prevail upon the powers that be, if that would solve the problem.) I installed spatstat via install.packages() and received version 1.3

Re: [R] demonstrating R in introductory class using point-and-click software

2014-01-17 Thread Christopher W. Ryan
the course of their training, could be averse to writing code. --Chris Christopher W. Ryan, MD, MS SUNY Upstate Medical University Clinical Campus at Binghamton 425 Robinson Street, Binghamton, NY 13904 cryanatbinghamtondotedu "Once we recognize that we do not err out of laziness, st

Re: [R] Hello R user!

2013-12-17 Thread Christopher W Ryan
Here is a simple example (without the proportional size bubbles--you've been given some references on that) using the lattice package: # one dataframe holds the data from both "sources" I call them. # they would be data from your two separate dataframes, # that you call graph1 and graph2 dd <- dat

[R] a better method than a long expression with many OR clauses

2013-12-17 Thread Christopher W Ryan
dd <- data.frame(longVariableName1=sample(1:4, 10, replace=TRUE), longVariableName2=sample(1:4, 10, replace=TRUE)) dd # define who is a case and who is not transform(dd, case=(longVariableName1==3 | longVariableName2==3)) But in reality I have 9 of those longVariableName variables, all of this pat

Re: [R] Hello R user!

2013-12-17 Thread Christopher W Ryan
What do you mean by "merge" them into one? Make both graphs appear on the same page of a document? Make a single figure containing both graphs? Plot data from both dataframes on the same set of axes? --Chris Ryan On Tue, Dec 17, 2013 at 12:33 PM, bibek sharma wrote: > Hello R user, > > I have

Re: [R] R for a stats intro for undergrads in the US?

2013-11-17 Thread Christopher W. Ryan
I would recommend it. I have no experience teaching statistics to psychology students, but I have done a sequence of hands-on workshops introducing R to a class of high school students who were engaged in a three-year-long science research class. My presentations were not discipline-specific, and w

[R] making a wider, shorter, 4-column table instead of the narrower, longer, 2-column table I get with tm, Hmisc, and Sweave

2013-09-19 Thread Christopher W. Ryan
oughly halfway down. But is there a way to do this programmatically in the Rnw file? All I can think of is using two separate chunks to generate two separate tables, one for elements 1:(length(word.freq)/2) of word.freq and one for the remaining elements. Is there a better way? Thanks. --Chris -- Chr

Re: [R] read.dta()

2013-09-05 Thread Christopher W. Ryan
I don't know about 3.0.1, but the 2.15.x that I'm still using requires the foreign package--that's where the read.dta command resides. library(foreign) --Chris Ryan SUNY Upstate Medical University Binghamton, NY USA Debasish Roy wrote: > I've been using R 3.0.1 version. I tried to read a file

Re: [R] Hist with Dates

2013-01-15 Thread Christopher W Ryan
If all you want is frequencies, could you use table()? dd <- c("2001-01-02", "2001-01-02", "2001-01-02", "2001-01-02", "2001-01-02", "2001-01-02", "2001-01-02", "2001-01-02", "2001-01-02", "2001-01-03", "2001-01-03", "2001-01-03", "2001-01-03", "2001-01-03", "2001-01-03", "2001-01-03", "2001-01-0

[R] follow up on teaching R to high school students

2013-01-02 Thread Christopher W. Ryan
en I realized I could play around with the program." (Of course, any less-than-positive comments, the students (or their teacher) may have kept to themselves out of courtesy to me!) A post-workshop survey of the students has just begun, basically asking them if they have downloaded R on their o

Re: [R] Plot txt

2012-05-23 Thread Christopher W. Ryan
Dear Trying: after g <- read.table("ip.txt") enter str(g) You will see that g is a dataframe with one variable, called V1. V1 contains the data you want to plot. So type plot(g$V1, type="l") or with(g, plot(V1, type="l")) or, if you prefer to attach g: attach(g) plot(V1, type="l") --

Re: [R] "Conditional" average

2012-04-25 Thread Christopher W. Ryan
I think this will accomplish what you describe: dd <- data.frame(id=c(1:6), age76=c(25, 27, 30, 82, 20, 25), Wage76=c(102456, 15432, 12340, 6, 2, 15000), Grade76=c(12, 15, 16, 88, 16, 12), Black=c(1, 0, 1, 0, 1, 1), imigrt=c(0, 1, 1, 0, 1, 1)) dd dd.sub <- subset(dd, Grade76 %in% c(12,15,1

Re: [R] "Conditional" average

2012-04-24 Thread Christopher W. Ryan
Kebrab67-- It's difficult to answer in the absence of a small bit of representative data, and more information about it. How is age76 recorded, as numerical years or in categories (age ranges?) And what are years (you didn't mention them as a variable in your data.) That being said, perhaps

Re: [R] introducing R to high school students

2012-04-22 Thread Christopher W. Ryan
I have to agree that Excel is a poor tool for "serious scientific and engineering data analysis" (love the phrase.) I too have spent way too much time beating Excel files into submission, with workarounds and manipulations, just to be able to do anything useful with them. I'm told that one can

Re: [R] introducing R to high school students

2012-04-18 Thread Christopher W. Ryan
curious: given your preference for hand-drawn graphs for learners (a very good point), why is Excel "fine" but R not? At any rate, I should probably migrate this thread over to the Teaching SIG listserve, which I didn't know about before. Thanks again. --Chris Christopher W. Ryan,

[R] introducing R to high school students

2012-04-17 Thread Christopher W Ryan
I participate peripherally on a listserve for middle- and high-school science teachers. Sometimes questions about graphing or data analysis come up. I never miss an opportunity to advocate for R. However, the teachers are often skeptical that their students would be able to issue commands or write

Re: [R] question on simple graph

2012-01-31 Thread Christopher W. Ryan
Without knowing more about what you are trying to accomplish, and what you have tried so far (code) it's difficult to say. But I'll venture this: are you sure you need a graph? Seems like a table might suffice. BT <- sample(1:5, 50, replace=TRUE) RA <- sample(1:5, 50, replace=TRUE) table(BT) ta

Re: [R] having trouble extracting week from chron object

2011-08-30 Thread Christopher W Ryan
d base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] chron_2.3-42 Thanks. --Chris Ryan On Tue, Aug 30, 2011 at 1:54 PM, David Winsemius wrote: > > On Aug 30, 2011, at 1:36 PM, Christopher W Ryan wrote: > >> Running R 2.13

[R] having trouble extracting week from chron object

2011-08-30 Thread Christopher W Ryan
Running R 2.13.1 on Windows XP. I would like to get week of the year (1-52) for each date. library(chron) dts <- dates(c("02/27/92", "02/27/92", "01/14/92","02/28/92", "02/01/92")) dts dts.chron <- as.chron(dts) dts.chron class(dts.chron) # all of these component extractions work: months(dts.chron

Re: [R] About GAM in R, Need YOUR HELP!

2011-06-20 Thread Christopher W Ryan
If you use the mgcv package for GAMs, I found this book very helpful: Wood, SN Generalized additive models: An introduction with R CRC Press, 2006 ISBN-13: 9781584884743 --Chris Ryan SUNY Upstate Medical University On Mon, Jun 20, 2011 at 1:25 AM, pigpigmeow wrote: > I'm beginner in R! I have

[R] specifying scales in lattice xyplot makes the lines disappear?

2011-05-10 Thread Christopher W Ryan
I have a dataframe concerning manner of death from death certificates, from 2005 to 2009 inclusive, with the following structure: > str(MannerYoung.plot.data) 'data.frame': 245 obs. of 4 variables: $ year : Factor w/ 5 levels "2005","2006",..: 1 2 3 4 5 1 2 3 4 5 ... $ manner :

Re: [R] adding vertical segments to an xyplot in lattice

2011-03-23 Thread Christopher W. Ryan
Peter-- That's it exactly! Thanks. --Chris Christopher W. Ryan, MD SUNY Upstate Medical University Clinical Campus at Binghamton 425 Robinson Street, Binghamton, NY 13904 cryanatbinghamtondotedu "Observation is a more powerful force than you could possibly reckon. The invi

[R] adding vertical segments to an xyplot in lattice

2011-03-22 Thread Christopher W Ryan
I have a dataframe that looks like this: > str(chr) 'data.frame': 84 obs. of 7 variables: $ county: Factor w/ 3 levels "Broome","Nassau",..: 3 3 3 3 3 3 3 3 3 3 ... $ item : Factor w/ 28 levels "Access to healthy foods",..: 21 19 20 18 16 3 2 6 17 8 ... $ value : num 8644 15 3.5 3.9 7.7 .

[R] trouble with \textless in Hmisc latex() on a drop1 object

2010-10-21 Thread Christopher W Ryan
Yes, it's homework . . . delete now if desired . . . but I think it is an interesting problem. Running R 2.11.1, LaTeX on WinXP, via Sweave. A drop1() object from a glm() produces, as part of its output, a string that looks like this: The trouble I run into is that running latex() on a drop1(

[R] multiple car scatterplots on one graph--sorry for duplicate post--already solved

2010-10-14 Thread Christopher W Ryan
Apologies for the duplicate post. I'm caught between different misbehaving email clients on different computers at the moment. Didn't see my original post, nor Greg's reply, nor any evidence in my "sent" folder that my original message ever went out. I've got them now. --Chris Ryan On Thu, Oct 14

[R] multiple car scatterplots on one graph

2010-10-14 Thread Christopher W Ryan
R version 2.11.1 on WinXP How do I get 3 scatterplots with marginal boxplots (from the car package) onto a single plot? I have a data frame called bank > dim(bank) [1] 46 5 head(bank) x1x2 x3 x4 pop 1 -0.45 -0.41 1.09 0.45 0 2 -0.56 -0.31 1.51 0.16 0 3 0.06 0.02 1.01 0.40

Re: [R] R editor in ubuntu!

2010-10-05 Thread Christopher W Ryan
As an alternative to emacs-ess, you could try gedit with the R plugin. --Chris Ryan I am looking for an editor to be able to execute commands into R in Linux ubuntu. Is there any suggestion? [[alternative HTML version deleted]] __ R-help

  1   2   >