similar to: runs.test in by() statement

Displaying 20 results from an estimated 2000 matches similar to: "runs.test in by() statement"

2011 Jun 01
3
Identifying sequences
Hallo Everybody Consider the following vector a=1:10 b=20:30 c=40:50 x=c(a,b,c) I need a function that can tell me that there are three set of continuos sequences and that the first is from 1:10, the second from 20:30 and the third from 40:50. In other words: a,b, and c. regards Christiaan [[alternative HTML version deleted]]
2013 Oct 16
1
Extract a predictors form constparty object (CHAID output) in R
I have a large dataset (questionnaire results) of mostly categorical variables. I have tested for dependency between the variables using chi-square test. There are an incomprehensible number of dependencies. I used the chaid() function in the CHAID package to detect interactions and separate out (what I hope to be) the underlying structure of these dependencies for each variable. What typically
2011 Jan 21
5
User input in R program
HI Everybody Does anyone know of documentation about different ways of obtaining user input in R. I have used readline() but I wondered is there are sophisticated packages that does things like validate answers or generate selection lists. bets regards Christaan [[alternative HTML version deleted]]
2009 May 14
4
Duplicates and duplicated
Hi everybody. I want to identify not only duplicate number but also the original number that has been duplicated. Example: x=c(1,2,3,4,4,5,6,7,8,9) y=duplicated(x) rbind(x,y) gives: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] x 1 2 3 4 4 5 6 7 8 9 y 0 0 0 0 1 0 0 0 0 0 i.e. the second 4 [,5] is a duplicate. What I want is
2009 Jun 10
2
isolating Hour and minute form date and time
Hi everybody. I have a dataframe that contains a factor with the date information in the format like in the example below: "2009/05/12 11:22:31 AM" I have been able to convert it to POSIXt using strptime Now I want to print only the date as one vector and the time in another vector but they must be real date and time classes so that i can use them in calculations to reconstruct my
2012 Aug 07
2
Passing arguments to a function within a function ...
Hallo Everybody How do you specify arguments for a function used within another function? Here is my problem: I am reconstructing a calculator for the burden of disease due to air pollution from publications and tools published by the WHO. The calculations make use of published dose-response relationships for particular health end-points. This is then applied to populations with known or
2011 Jul 27
2
Use a list to 'transport' a collection of data sets and results
Hi Everybody I need to "transport" some data and results to use another application (Sweave via LyX - where debugging is very difficult) in order to build a report. Is it possible to store a collection of variables of different types (like named integers, matricies, data frames and two lists) all in one list and save it and then simply load it again later and "unpack" the
2011 Aug 03
4
slow computation of functions over large datasets
Hello there, I’m computing the total value of an order from the price of the order items using a “for” loop and the “ifelse” function. I do this on a large dataframe (close to 1m lines). The computation of this function is painfully slow: in 1min only about 90 rows are calculated. The computation time taken for a given number of rows increases with the size of the dataset, see the example with
2008 Mar 04
2
summarizing replicates with multiple treatments
I have a dataframe with several different treatment variables, and would like to calculate the mean and standard deviation of the replicates for each day and treatment variable. It seems like it should be easy, but I've only managed to do it for one treatment at a time using subset and tapply. Here is an example dataset: > `exampledata` <- structure(list(day = c(1L, 1L, 1L, 1L, 1L,
2012 Oct 05
1
avoid <<- in specific case
Hi all, I improved a function drawing horizontal histograms (code below) which uses barplot and works fine. It does,however, need to assign a function to the global environment to later find the actual location on the vertical axis, and not the number of bars used by barplot. Hopefully, running the examples below will illustrate that. As said, it works perfectly fine and does exactly what I
2010 Dec 16
1
Is there a join() function in R ? OR: simulating "Combining ggplot2 and Google Maps" by David Kahle
Hi everybody Im on R version 2.11.1 on Mac OS X I am working through David Kahle's example of using ggplot2 with Rgooglemaps (found here: https://github.com/hadley/ggplot2/wiki/Crime-in-Downtown-Houston,-Texas-:-Combining-ggplot2-and-Google-Maps). Excellent page by the way. I have downloaded the data and the code and want to learn how to do this by first simulating David's results and
2009 Nov 21
1
what do i do to fix missing packages...see error
> exampledata <- rnorm(10000) > summary(exampledata) Min. 1st Qu. Median Mean 3rd Qu. Max. -4.030000 -0.666200 -0.023390 -0.009384 0.664700 4.092000 > desc <- function(mydata) { + require(e1071) + quantls <- quantile(x=mydata, probs=seq(from=0, to=1, by=0.25)) + themean <- mean(mydata) + thesd <- sd(mydata) + kurt <-
2009 Oct 20
1
RPgSQL installation problem
Hi everybody I am trying to install RPsSQL and get the following error message: When I do ./configure form the untarred source directory I get loading cache ./config.cache checking for crypt in -lcrypt... no No crypt function found When I use the Package installer in R I get install.packages("/Users/christiaanpauw/tmp/RPgSQL/", , NULL, type = "source") Warning in
2010 Jan 15
1
Sampling from a Postgres database
Hi Everybody Is there a way in which one can use the RPostgreSQL package to take a sample from a table in Postgres database without having to read the whole table into R regards Christiaan [[alternative HTML version deleted]]
2009 Feb 27
1
Sweave doesn't do csv.get()
Hi Everybody I use R2.8.0 on Mac OS X. I set up LyX 1.6.1 to use Sweave today. I can compile the test file I found on CRAN ( http://cran.r-project.org/contrib/extra/lyx/) without a problem and the output looks very nice. In the test file the following R code is used. <<myFirstChunkInLyX>>= xObs <- 100; xMean <- 10; xVar <- 9 x <- rnorm(n=xObs, mean=xMean, sd=sqrt(xVar))
2011 Jan 20
2
adding text to y-axis per row of panels (lattice)
Dear all, Being a newbie to R, I've trawled through many old posts on this list looking for a solution to my problem, but unfortunately couldn't quite figure it out myself. I'd be very grateful if someone here on this list could perhaps help me out. I have a lattice plot with several panels and would like to add some text next to the y-axis on the right hand side of each row of
2009 Jun 10
1
by and by: using two indices in by() or tapply()
Hi everyone I want to apply a function by two indices. I have a number of surveyors submitting questionnaires. I want to check the time of the first submission for the day for each surveyor and also see a NA is no submission was done on a particular day. This generates a sample of the data:
2009 Feb 12
1
Latex or html output for freq() in prettyR
Hi Everybody I need to create a lot of frequency tables with frequencies and percentages (and cumilative freq and % as well) for a report. freq() in prettyR give more or less what I need. I am trying to export the result of freq() to html but the html doesn't look look the console output. See the following example library(prettyR) library(Hmisc) x <- matrix(sample(1:3, 12,
2004 Jul 22
3
Replace only Capital Letters
Dear All, I have these data: exampledata <- c("This is one item", "This is Another One", "And so is This") I would like to find each occurence of a blank space followed by a Capital Letter and replace it by a blank space, a left curly brace, the respective Capital Letter, and then a right curly brace. I thought the following will do: gsub(pattern = "
2011 Mar 14
1
Math characters in column heading using latex() in Hmisc
Hi Everybody I want to print a latex table containing math characters in the column heading These are the formulae I want to use as column headings. It prints OK from TeX $\sum_{i}\sum_{j}C_{P,i,j,y}\times\mathit{FC}_{i}$, $XU_{alt,y}$, $n$, $\bar{C}_{P,y}$ My plan was to create a character vector with these and later rbind the values to them. When I create the vector like: