similar to: Lattice xyplots plots with multiple lines per cell

Displaying 20 results from an estimated 6000 matches similar to: "Lattice xyplots plots with multiple lines per cell"

2012 Aug 15
3
Subsetting with missing data
Simply put, I want to subset the data frame 'a' where 'y=0'. > a <- as.data.frame(cbind(x=1:10, y=c(1,0,NA,1,0,NA,NA,1,1,0))) > a x y 1 1 1 2 2 0 3 3 NA 4 4 1 5 5 0 6 6 NA 7 7 NA 8 8 1 9 9 1 10 10 0 > names(a) [1] "x" "y" > table(a$y) 0 1 3 4 > table(a$y, useNA="always") 0 1 <NA> 3 4
2010 May 26
3
Counting indexes
Hallo! I have a vector of ID's like so, id <- c(1,2,2,3,3,3,4,5,5) I would like to create a [start,stop] pair of vectors that index the first and last observation per ID. For the ID list above, it would look like 1 1 2 3 4 6 7 7 8 9 I haven't worked with indexes/data manipulation much in R, so any pointers would be helpful. Many thanks! ~~~~~~~~~~~~~~~~~~~ -Robin Jeffries Dr.P.H.
2010 Jun 28
2
Lattice and Beamer
Two things I think are some of the best developments in statistics and production are the lattice package and the beamer class for presentation in Latex. One thing I have not become very good at is properly sizing my visuals to look good in a presentation. For instance, I have the following code that creates a nice plot (sorry, cannot provide reproducible data).
2002 Nov 05
1
add1 in glm
I'm having a bit of difficulty using the stepwise model-building tools in a glm context. Here, for example is one problem I have had using add1, where the abbreviation "." does not work as I expected it to do. I someone could point me towards some examples involving the interactive building of glm models I would be grateful. The data set that I am using is the
2008 Sep 24
4
rowSums()
Say I have the following data: testDat <- data.frame(A = c(1,NA,3), B = c(NA, NA, 3)) > testDat A B 1 1 NA 2 NA NA 3 3 3 rowsums() with na.rm=TRUE generates the following, which is not desired: > rowSums(testDat[, c('A', 'B')], na.rm=T) [1] 1 0 6 rowsums() with na.rm=F generates the following, which is also not desired: > rowSums(testDat[, c('A',
2009 Dec 10
2
different randomForest performance for same data
Hello, I came across a problem when building a randomForest model. Maybe someone can help me. I have a training- and a testdataset with a discrete response and ten predictors (numeric and factor variables). The two datasets are similar in terms of number of predictor, name of variables and datatype of variables (factor, numeric) except that only one predictor has got 20 levels in the training
2010 Oct 10
2
GC verbose=false still showing report
I must be reading the help file for gc() wrong. I thought it said that gc(verbose=FALSE) will run the garbage collection without printing the Ncells/Vcells summary. However, this is what I get: gc(verbose = FALSE) used (Mb) gc trigger (Mb) max used (Mb) Ncells 267097 14.3 531268 28.4 531268 28.4 Vcells 429302 3.3 20829406 159.0 55923977 426.7 I'm embedding this in an
2007 Feb 09
2
plotting derived values not raw
I am trying to plot the mean and standard error of three separate conditions. For various reasons, I do not have access to the raw data from which the mean and error were derived and would like to make error bar plots utilizing only the actual mean and standard error values. Is there a way to do this in R? Thanks for any help in advance. james [[alternative HTML version deleted]]
2011 Jan 17
1
Replacing rows in a data frame
R-helpers, Below is a simple example of some output that I am getting while trying to work with a data frame in R 2.12.1 for Mac. ----- > testdat <- data.frame(matrix(ncol=10, nrow=10)) > colnames(testdat) <- c('a','b','c','d','e','f','g','h','i','j') > testdat[seq(1,10,3),] <-
2010 Sep 29
2
repeat a function
I have R randomly sampling my array made up of 2 columns of data. Here is my code randomly sampling 5 different rows from my dataset to create a new dataset of 8 rows of data: testdat<-growth[sample(5,8,replace=T),] Now I want to tell R to repeat this function 50 times and give me the output. I have been searching the internet and have been unable to figure this out. Any advice
2010 Sep 29
2
resampling issue
I am trying to get R to resample my dataset of two columns of age and length data for fish. I got it to work, but it is not resampling every replicate. Instead, it resamples my data once and then repeated it 5 times. Here is my dataset of 9 fish samples with an age and length for each one: Age Length 2 200 5 450 6 600 7 702 8 798 5 453 4 399 1 120 2 202 Here is my code which resamples my
2010 Apr 25
1
Obvious reason for not looping twice?
Is there an obvious reason why this won't loop to i=2 and beyond? There are many combinations of *st* & *vc* that don't exist in svc. For example, when s=1 there's only an entry at v=1. That's fine, the entry can stay 0. lookup.svc <- array(0,dim=c(length(unique(svc$st)),length(unique(svc$vc))), dimnames=list(unique(svc$st), unique(svc$vc))) for (i in
2010 May 08
1
Source.R file from cmd line
I want to set up a windows system task that will run a .R script at pre-specified times. Can someone please help with the command line syntax that I would assign to the task? I know that i can open a command prompt, type R, and then source the file, but I don't know how to pass multiple line arguments to the command line in a system task. Thanks, ~~~~~~~~~~~~~~~~~~~ -Robin Jeffries Dr.P.H.
2007 May 14
2
lmer function
Does anyone know if the lmer function of lme4 works fine for unbalanced designs? I have the examination results of 1000 pupils on three subjects, one score every term. So, I have three scores for English (one for every term), three scores for maths etc. However, not everybody was examined in maths, not everybody was examined in English etc, but everybody was in effect examined on four subjects. I
2011 Feb 15
3
expected behavior when parsing lines with special characters
Say I have a tab-delimited table I want to read into R. What should I expect to happen if some of the entries contain the character " ' "? I thought it would read the file fine, but that is not what happens. Instead, all the values in between two " ' "s get read into one field, and things are just seriously messed up. Is this a bug, and besides removing the offending
2010 May 24
1
sparse matrices in lme4
I read somewhere (help list, documentation) that the random effects in lme4 uses sparse matrix "technology". I'd like to confirm with others that I can't use a sparse matrix as a fixed effect? I'm getting an "Invalid type (S4) " error. Thanks. ~~~~~~~~~~~~~~~~~~~ -Robin Jeffries Dr.P.H. Candidate in Biostatistics UCLA School of Public Health rjeffries@ucla.edu
2011 Mar 12
1
Column order in stacking/unstacking
Dear R users, I'm having some problems with the stack() and unstack() functions, and wondered if you could help. I have a large data frame (400 rows x 2000 columns), which I need to reduce to a single column of values (and therefore 800000 rows), so that I can use it in other operations (e.g., generating predictions from a GLM object). However, the problem I'm having can be reproduced
2008 Mar 06
3
1-pnorm values in a table
Hi, I've read in a csv file (test.csv) which gives me the following table: Hin1 Hin2 Hin3 Hin4 Hin5 Hin6 HAI1 9534.83 4001.74 157.16 3736.93 484.60 59.25 HAI2 13272.48 1519.88 36.35 33.64 46.68 82.11 HAI3 12587.71 5686.94 656.62 572.29 351.60 136.91 HAI4 15240.81 10031.57 426.73 275.29 561.30 302.38 HAI5 15878.32 10517.14 18.93 22.00 16.91
2007 Jun 07
1
MITOOLS: Error in eval(expr, envir, enclos) : invalid 'envir' argument
R-users & helpers: I am using Amelia, mitools and cmprsk to fit cumulative incidence curves to multiply imputed datasets. The error message that I get "Error in eval(expr, envir, enclos) : invalid 'envir' argument" occurs when I try to fit models to the 50 imputed datasets using the "with.imputationList" function of mitools. The problem seems to occur
2008 May 30
1
Get all X iterations in optim output when controls(trace=6)
Hi, I would like to get all X iterations in optim output in matrix form. I know about the follow approach: sink("reportOptim") optim( ......., control=list( trace=6,..........) ) sink() all_iterOptim <- readLines("reportOptim") unlink("reportOptim") all_iterOptim <- all_iterOptim[ grep( '^X', all_iterOptim ) ] ### TODO: the rest !!! :-) But it is very