Or consider a different approach to the problem... figure out which regex
patterns fit the data.
# test series ... I think your ANAAAN was supposed to be ANANAN
zipcode <- c("22942-0173", "32601", "N9Y2E6", "S7V 1J9", "0022942-0173",
"32-601", "NN9Y2E6", "S7V 1J9")
# test series in data frame
Not sure if this adds much to Ken Knoblauch previous suggestion. But:
Subject<-c(1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4)
Day<-c(1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6)
Activity<-c(2,3,4,3,7,4,5,8,2,8,4,6,2,5,3,8,9,5,6,3,4,5,6,7)
EventA<-c("Yes",NA,"Yes",NA,NA,NA,"Yes",NA,NA,NA,
At 21:15 07/01/2014, =?ISO-8859-9?Q?sevda_datl=FD?= wrote:
Hello,
I am a master student in Educational Measurement and Evaluation, my thesis
subject is "comparison of estimation methods used for confirmatory factor
analysis". For my thesis study, I need to generate datas that provides some
featu
Hi,
You may also try:
library(gsubfn)
library(plyr)
dat1 <- data.frame(zipcode=zipcode, pattern=
gsubfn(".",as.list(mapply(assign,c(LETTERS,letters,0:9),rep(c("A","N"),c(52,10,zipcode)
)
dat2 <- data.frame(country=rep(c("US","Canada"),each=2),pattern=
c("N-","N","ANAAAN", "ANA N
Hi experts
I want to read an excel file in an R-script and send the inputs to another
script to more process
the first file for reading the data is (First.R):
wb <- loadWorkbook("adress")
dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=strow,
endRow=endrow, startCol=spalte, endCol=spalt
Hi,
It is not clear about the final output.
You may try:
uniqYrs <- sort(as.numeric(unique(unlist(years
res <-t(sapply(years, function(x) uniqYrs %in% as.numeric(x)))*1
colnames(res) <- uniqYrs
head(res)
# 2000 2001 2003 2004 2005 2006 2007 2008 2009 2010 2011
#1 0 0 0 1 0
Dear R-help!
I have encountered strange behaviour (that is, far-off filtering, smoothing
and forecast distributions under certain conditions) in the `dlm` package by
Giovanni Petris.
Here is an example:
I use the annual hotel bookings time series data, which I model using a
second order polinomi
My question is how I can fit linear relative rate models (= excess relative
risk models, ERR) using R. In radiation epidemiology, ERR models are used to
analyze dose-response relationships for event rate data and have the following
form [1]:
lambda = lambda0(z, alpha) * (1 + ERR(x, beta))
* l
Dear all,
I have this list
years <- list(c("2004", "2007"), c("2010", "2005"), c("2009", "2001"),
c("2006", "2000", "2004", "2009"), c("2006", "2000"), c("2006", "2000"),
c("2005", "2007"), c("2005", "2007"), c("2001", "2006"),
c("2005", "2001", "2008"), c("2005", "2001", "2008"),
Is the following a bug?
##(R version 3.0.2 (2013-09-25)
## Platform: i386-w64-mingw32/i386 (32-bit))
d <- data.frame(a=rep(letters[1:3],4:6))
rle(d$a)
##Error in rle(d$a) : 'x' must be an atomic vector
is.atomic(d$a)
##[1] TRUE
rle(c(d$a))
## Run Length Encoding
## lengths: int [1:3] 4 5 6
#
Hi,
In that case,
Try:
res1 <- do.call(rbind,lapply(years, function(x)
c(as.numeric(x),rep(NA,max(sapply(years,length)-length(x))
A.K.
Hi,
Thanks a lot for your answer.
Each vector is a location, i.e. I want each vector in a different row. What
I'd like to do is, in each vector, get the ye
On 08/01/2014 16:23, Bert Gunter wrote:
Is the following a bug?
##(R version 3.0.2 (2013-09-25)
## Platform: i386-w64-mingw32/i386 (32-bit))
d <- data.frame(a=rep(letters[1:3],4:6))
rle(d$a)
##Error in rle(d$a) : 'x' must be an atomic vector
is.atomic(d$a)
##[1] TRUE
But
> is.vector(d$a)
Thank you Brian for your clear and informative answer. I was
(obviously!) unaware of this and appreciate the response.
Best,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilb
If you need an rle for factor data (or lists, or anything for
which match(), unique(), and x[i] act in a coherent way), try the
following. It is based on the S+, all-S code, version of rle.
(It does not work on data.frames because unique is row oriented
and match is column oriented for data.frame
Thanks Bill:
Personally, I don't need it. Once Brian made me aware of the
underlying issue, I can handle it.
Cheers,
Bert
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Wel
On 08/01/2014 11:27 AM, Baro wrote:
Hi experts
I want to read an excel file in an R-script and send the inputs to another
script to more process
the first file for reading the data is (First.R):
wb <- loadWorkbook("adress")
dat <-readWorksheet(wb, sheet=getSheets(wb)[1], startRow=strow,
endRow
Another way:
a = c(1,NA,NA,4,3,NA,NA,NA,NA,5)
# find position of the non-NAs in the vector
pos = which(!is.na(a))
# this calculates the length by taking the differences between the
non-NA positions.
diff(pos)-1
#get the max
max(diff(pos)-1)
Richard
On Tue, Jan 7, 2014 at 7:36 PM, arun wrote:
Use
binwidth = 1
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 1/6/14 4:36 PM, "Peter Maclean" wrote:
>With these toy data, how can I remove unused empty space between the bars?
>
>#Toy data
>x1 <- as.data.frame(rep(1:3
I would fit a Poisson model to the dose-response data with offsets for the
baseline expecteds.
Sent from my iPhone
> On Jan 8, 2014, at 10:49 AM, "Wollschlaeger, Daniel"
> wrote:
>
> My question is how I can fit linear relative rate models (= excess relative
> risk models, ERR) using R. In r
Hi,
I have a data set involving 25 Questions (Q1, Q2, ... , Q25), 100
Disciplina and 5 series. The variables are:
ALUNO DISCIPLINA SERIE TURMA Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 ... Q25
I want to create tables associating each of the 25 questions to the
Disciplina.
Something like:
tab1 = table(DISCIPLINA
Wouldn't it make sense to be able to use rle() on factor/ordered too?
For instance:
rle2 <- function (x) {
if (!is.factor(x)) return(rle(x))
## Special case for factor and ordered
res <- rle(as.integer(x))
## Change $values into factor or ordered with correct levels
if
Hi,
If missing values are in the beginning
a <- c(NA,NA,NA,NA,1,NA,NA,2)
diff(which(!is.na(a)))-1
#[1] 2
rl <- rle(is.na(a))
max(rl$lengths[rl$values])
#[1] 4
A.K.
On Wednesday, January 8, 2014 12:56 PM, Richard Kwock
wrote:
Another way:
a = c(1,NA,NA,4,3,NA,NA,NA,NA,5)
# find positi
Hey Arun,
That's a good point. You'd first need a non-NA element in the first
element (such as a 0) in order for that to work, which you can get
around by adding a 0 to the first element of the vector.
a1 <- c(NA,NA,NA,NA,1,NA,NA,2)
a2 <- c(1,NA,NA,NA,NA,1,NA,NA,2)
diff(which(!is.na(c(0,a1-1
Patrick,
Thanks for providing reproducible code!
I think the main problem was that the extremes= argument in the
color.scale() function wants a range (a vector of length 2), and you were
providing with more than that, length(lut) is 10.
In the process of tracking this down, I made a bunch of min
Hi Jean,
Thanks a ton for the help. I think Im almost there, but there is still
something weird about my stuff.
I have been able to understand the color.scale() function. Now, I am trying to
plot a key for the corresponding colors. The function is called ColorBar, which
apparently works - the
If I understand you correctly, that is exactly the approach taken by Atkinson &
Therneau: They get the baseline rates from published rate tables from the
general population, multiply them by the appropriate person-time from their
data to get expected counts, and use this as offset.
Unfortunatel
Thanks a lot for your answer.
What I really want is a data.frame like this (I am just building it myself):
years
[1] [2] [3][4]
[1] 2004 2007 NANA
[2] 2010 2005 NANA
[3] 2009 2001 NANA
[4] 2006 2000 2004 2009
[5]2006
It worked, thank you very much indeed :)
Kind regards
--
View this message in context:
http://r.789695.n4.nabble.com/Converting-list-with-different-vector-lengths-into-a-dataframe-or-export-it-as-csv-tp4683259p4683269.html
Sent from the R help mailing list archive at Nabble.com.
_
Hello,
I'm working with a 22 GB datasets with ~100 million observations and ~40
variables. It's store in SQLite and I use the RSQLite package to load it
into memory. Loading the full population, even for only a few variables,
can be very slow and I was wondering if there are best practices for how
Hi Jean,
Thanks for the great help. Indeed, it seems that that helps a bit. However, I
included a ‘control’ column made of ones.
> fake <- cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), runif(6,
> 0, 2), runif(6, 0, 2), runif(6, 0, 2))
However, the color doesn’t correspond to that
Hi, I noticed that when I install/update packages, the installation folder is
C:/User/My Document/R, not in C:/Program Files/R. R itself was still in Program
Files folder. Don't know how this has happened. It used to work
ok.Any clues or how to correct the problem is
appreciated!ThanksJohnhttp:
Hi Richard,
I would slightly modify the code for cases like:
a3 <- c(NA,1,3,NA,NA)
fun1 <- function(x) max(diff(which(!is.na(c(0,x,length(x)-1)
fun2 <- function(x) {rl <- rle(is.na(x)); max(with(rl,lengths[values]))}
all.equal(fun1(a3),fun2(a3))
#[1] TRUE
A.K.
On Wednesday, January 8,
Hi Silvano
I cannot use the data and function as the data is not available to me
for the xtable part using data from xtable try as an example to see if it
fits your needs
data(tli)
head(tli)
for(j in 1:5){ xx <- xtable(tli[1:6,]); caption(xx) <- paste("Table", j);
print(xx); if(j < 5) cat("\n\
http://overview.mail.yahoo.com?.src=iOS";>Sent from Yahoo
Mail for iPhone
[[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-projec
http://overview.mail.yahoo.com?.src=iOS";>Sent from Yahoo
Mail for iPhone
[[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-projec
On Jan 8, 2014, at 3:22 PM, Wollschlaeger, Daniel wrote:
If I understand you correctly, that is exactly the approach taken by
Atkinson & Therneau: They get the baseline rates from published rate
tables from the general population, multiply them by the appropriate
person-time from their dat
Dear R experts,
I want to use numerical methods to solve a complex problem. Here is a very
simple example that gives an idea of what I would like to do. This example
could be solved by hand, but I am interested in finding a numerical
solution in R.
Let's say that I have the following equation:
Please change your email settings to post in plain text... at least for this
mailing list. See the Posting Guide mentioned at the bottom of this message for
more list usage tips.
The fact that updates are going to your Documents directory means you don't
have to switch to administrator privileg
38 matches
Mail list logo