I have to compute characteristic roots for 100s of U.S.counties. I got
help using " lapply". I prefer using MAP and PURR if that is possible. I am
using them to compute linear regressions.
Here is my test problem and the output. I would appreciate any help.
Thanks
V.K.Chetty
test.dat<-
I want to use map and purr functions to compute eigen values for 3000
matrices. Each matrix has 2 rows and 2 columns. The following code does not
work.
test.dat<- tibble(ID=c(1,2),a=c(1,1),b=c(1,1),c=c(2,2),d=c(4,3))
test.out<-test.dat %>% nest(-ID) %>% mutate(fit = purrr::map(data,~
function(x)
Hi Experts,
The following codes work when the return value is a scalar.
But I like to get the whole vector instead of one element of the vector x
using map as a data frame instead getting one element of the vector using
of map_dbl.
In other words, I would like a data frame with one row for each
I use solve(A,b) inside my function, myfun2; it works fine when I return
one value or a list.
I want use the return values in ggplot as below: ggplot(data.frame(
x=c(0.1,0.8)),aes(x=x))+stat_function(fun=myfun.2,geom="line")
I get a blank graph. Would greatly appreciate help! Thanks.
Here are my
HI,
I use solve(A,b) inside my function, myfun2; it works fine when I return
one value or a list.
I want use the return values in ggplot as below: ggplot(data.frame(
x=c(0.1,0.8)),aes(x=x))+stat_function(fun=myfun.2,geom="line")
I get a blank graph. Would greatly appreciate help! Thanks.
--
Hi,
The following call does not work:
dfhosp=dat.2.wide.sub %>% group_by(HOSP_NRD)%>%
do(fitHosp=lm(log(y)~ log(x)+I(log(x)^2)+NCHRONIC+AGE+sex ,data=.))
Error in `$<-.data.frame`(`*tmp*`, "sex", value = integer(0)) :
replacement has 0 rows, data has 25174
When I use "sex" as a binary
Hi,
I have dates as follows:
1/4/2006 0:00:00 AM
It is a factor at present.
How do I find out the day of the week from this? How do I convert to Julian
date format?
Thanks.
Chetty
--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails:
HI,
I have to work with data objects. I have trouble. I would like to convert
date to a integer of Julian dates omitting hours, minutes etc. I tried as.
Date and also as.POSIXlt, ct etc.
Please help me to compute the following difference. I get an NA for
output.
1/14/2006 0:00:00 AM -1/9/2006
Hi,
When I import an excel CSV file, large numbers such as 43988014.3 is
imported as 43988014, leaving out the decimal .4. How to import keeping
the fraction?
Thanks.
Chetty
--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails:
Hi,
This happens when I read in large numbers;
as.numeric(4398801.3)
[1] 4398801
as.numeric(439880.3)
[1] 439880.3
Please help to read in numbers with more than 8 characters!
Thanks.
Chetty
--
Professor of Family
Hi,
I am trying to make a dot plot in increasing order of the values. It does
not work. How do I do it? Here are the codes I used. I am also attaching the
data. I use lattice library.
Thanks.
Chetty
--
Hi ,
Name
rate
HEALTHALLIANCE HOSPITALS, INC -1.06211747
MOUNT AUBURN HOSPITAL 0.50960291
STURDY MEMORIAL HOSPITAL2.64233232
LAWRENCE GENERAL HOSPITAL
Hi,
Please help to correct my error in the following. I want to plot the values
of 'x in increasing order.
---
library(lattice)
Name-c(A,B,C)
x-c(15,20,10)
test-data.frame(Name,x)
dotplot(Name~x,test)
dotplot(reorder(Name,x)~x,test)
reorder has no effect!
Thanks.
Hi,Can I use reorder function with barchart as in dotchart? Here are some
codes which do not work for me. Thanks
Chetty
___
a1c.cast$bmi.cat.reordered[a1c.cast$eth!=Other]
-with(a1c.cast[a1c.cast$eth!=Other,],reorder(bmi.cat.ordered[a1c.cast$eth!=Other],
BP.FN.RATE,median
Hi,In Lattice graphs, can I use reorder function in a barchart as in the
case of dotchart? Or it can be used only with dotcharts?
Thanks
Chetty
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: chett...@gmail.com,vche...@bu.edu
[[alternative HTML
Hi,I am using the amazing package 'plyr. I have one problem. I would
appreciate help to fix the following error: Thanks.
__
library(plyr)
data(baseball)
summarise(baseball,
+ duration = max(year) - min(year),
+ nteams = length(unique(team)))
Error: could not find
Hi , I have created a parallel coordinate plot using rrgobi. I like to make
a powerpoint slide. I am not able to copy and paste. Is there any way to do
this? Thanks for any help.
Chetty
--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails:
Hi,I would like to fill the dots in this graph. I would appreciate help to
do that if possible. If fill is not possible, can I make it bright? I do NOT
want to increase the size.
__
dotplot(hu.event~fitted.adj.cat,data=risk.benefit.cast,groups=treat,
auto.key=list(space=right))
I would appreciate any help for the following question. How to increase the
font size of labels for the x and y axes in the following code?
-
xyplot(lbxglu~lbxgh|eth,reg.dat.5, panel = p, col = 1:2,
par.strip.text = list(cex = 1.25,col=brown),
Hi,I would like to reshape the following wide data set to long form. I
would appreciate help with the correct code for reshape. I tried a few
unsuccessfully.
Thanks.
Chetty
__
dat.1
GrpX0X3 X6 X12
Hi ,When I try to load the 'mgcv package, often, but not always, get this
error message. What am I doing wrong? I even tried reinstalling a few times.
__
This is mgcv 1.4-1.1
Error in runif(1) :
.Random.seed is not an integer vector but of type 'list'
Error : .onAttach failed in
Hi,I would like add a horizontal line at 126 (col=red) and a vertical line
at 6.5 ( col= blue) in each panel .How should I use the panel.abline
function in the following code I am using:
--
library(lattice)
with(reg.dat.5,coplot(lbxglu~lbxgh|eth,panel=panel.smooth,xlab=ABC,
Hi,In SPlus, I use the function 'cluster' with GLM to adjust for correlated
errors within a cluster ( e.g. cluster(ID)) as a covariate. Is there a
similar function in R to use with GLM ? I am new to R. Thanks.
V.K. Chetty
--
Professor of Family Medicine
Boston University
Tel: 617-414-6221,
23 matches
Mail list logo