similar to: Create counter variable for subsets without a loop

Displaying 20 results from an estimated 6000 matches similar to: "Create counter variable for subsets without a loop"

2008 Jan 12
2
Lattice equivalent of par(mfrow = )
Dear r-helpers, Does anyone have a straightforward example of putting together three unrelated (expect for a common y-axis) xyplot() figures in what would be in base graphics a par(mfrow = c(1, 3)) arrangement? _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102
2013 Apr 09
4
Converting matrix to data frame without losing an assigned dimname
Hello All, Would like to be able to convert a matrix to a dataframe without losing an assigned dimname. Here is an example that should illustrate what I'm talking about. tableData <- state.x77[c(7, 38, 20, 46), c(7, 1, 8)] names(dimnames(tableData)) <- c("State", "") tableData State Frost Population Area Connecticut 139 3100 4862
2009 Apr 05
1
problem with lattice tiff or bitmap: character size and color
Hi all, I am trying to make tiff files of lattice plots at a resolution greater than 300 dpi required by a journal (PLoS ONE). I have tried both the tiff and bitmap functions. tiff keeps panel colors but reduces axes and tick labels so they are nearly invisible. bitmap maintains correct label size but only produces greyscale. Regular plots work fine with tiff; the problem is only with lattice
2011 Mar 09
1
state.x77 dataset
I tried: > data(state.x77) Warning message: In data(state.x77) : data set 'state.x77' not found data(iris) seems to work fine, but the other state datasets (which I haven’t every tried before) don’t seem to be available on my windows 7 running R 2.12.2 installation. ?state brings up the state help page page which suggest the dataset should still be there. In help there still seems to
2012 Jan 19
1
question re. package playwith not able to run command getting error message that I'm attempting to use non function
Hello, I managed to install playwith package and all its prerequisites. My R version is R 2.14: R version 2.14.1 (2011-12-22) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) All my packages were updated, and recently installed. When I attempt to use the command playwith I get the following error message: >
2009 Feb 11
1
2 different colors for 2 groups of lines using xyplot
Hi All, I am trying to use xyplot to plot several lines in one panel with red color for a group of lines, say 3 lines and blue color for another group of lines, say 4. I know this can be easily done using regular plot function. But i could not figure out how to do this in xyplot. Any help would be greatly appreciated. Xuesong [[alternative HTML version
2010 Apr 25
3
Noobie question on aggregate tapply and by
I have a 43MB dataframe ( 5 variables) and I'm trying to summarize subsets of the data. I've RTFM ( not very clear) and looked at a variety of samples but cant seem to figure out how to make these functions work. A sample of what I want to do would be this: ids<-seq(1,50) years<-c(rep(5,10),rep(6,10),rep(7,10),rep(8,20))
2009 Mar 24
1
Is aggregate() function changing?
Hi R developers and debian users: Finally I found how to work with aggregate() function on the last patched version fo R. I you use this command it fails: aggregate(state.x77, list(Region = state.region), mean) But if you modify it in this way, it works!: aggregate(state.x77, list(Region = state.region), function(x) mean(x) ) Is it necesary to change the example? What is changing in
2009 Mar 24
1
Is aggregate() function changing?
Hi R developers and debian users: Finally I found how to work with aggregate() function on the last patched version fo R. I you use this command it fails: aggregate(state.x77, list(Region = state.region), mean) But if you modify it in this way, it works!: aggregate(state.x77, list(Region = state.region), function(x) mean(x) ) Is it necesary to change the example? What is changing in
2003 Jun 26
1
xyplot
I am doing group wise plots by using the following commands; it shows errors that I do not know how to fix it. Please help. xyplot(within.2.special.care ~ agecat| mco.cms.ind, neuro, panel = function(x,y){ + panel.grid() + panel.xyplot(x,y) + panel.loess(x,y, span =1)}) Error: couldn't find function "xyplot" [[alternative HTML version deleted]]
2011 Jun 19
1
Accessor functions in lattice graphics
I know about the current.row, current.column, and panel.number functions that are useful within panel functions written for lattice. Are there easy ways to obtain the names of the conditioning variables (those appearing after |) and their values for the current panel? Thanks Frank ----- Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context:
2011 Jan 26
1
text labels in Trellis plot
Dear all, I need to generate plots in which the points of the plot are replaced by text labels, such as "dog" and "cat". The usual way of specifying the plotting symbol with pch works only if the labels are single characters, as far as I know. So, plot(runif(3), pch=c("A", "B", "C")) will work OK, but plot(runif(3), pch=c("dog",
2011 Sep 27
4
Question concerning Box.test
Hi everyone, I've got a question concerning the function Box.test for testing autocorrelation in my data. My data consist of (daily) returns of several stocks over time (first row=time, all other rows=stock returns). I intend to perform a Box-Ljung test for my returns (for each stock). Since I have about 3000 stocks in my list, I'm not able to perform the test individually for each
2009 Dec 01
3
paste name in for loop?
Hello, I am trying to create subsets of grouped data (by area size), and use the area size as part of the output name. The code below works for area (xout) 1 and 50, the other files are given NA for an area. A simple example: xout <- c(1,5,10,25,50,100) for(i in xout) { print(paste("Areal_Ppt_",xout[i],"sqmi.txt", sep="")) } [1] "Areal_Ppt_1sqmi.txt"
2007 Aug 16
4
Linear models over large datasets
I'd like to fit linear models on very large datasets. My data frames are about 2000000 rows x 200 columns of doubles and I am using an 64 bit build of R. I've googled about this extensively and went over the "R Data Import/Export" guide. My primary issue is although my data represented in ascii form is 4Gb in size (therefore much smaller considered in binary), R consumes about
2009 Mar 24
1
aggregate() example fails]
Hi R users and developers on debian platforms. I compile the R version 2.8.1 Patched (2009-03-18 r48193) on my UBUNTU linux distribution. But when I ask for the aggregate example it fails. What am I missing? example(aggregate) aggrgt> ## Compute the averages for the variables in 'state.x77',grouped aggrgt> ## according to the region (Northeast, South, North Central,West) that
2007 Aug 21
2
divided scatter plots
I have a data set which contains two columns. The first column is a list of countries, and the second column contains their political risk ratings. I would like to create one large plot that contains 5 different sections, each with a scatter plot. To clarify, I have divided the countries into 5 groups. For each group (continent), I would like to have the name of the continent on the x-axis, and
2001 Dec 27
1
scale in stars() is not as documented (PR#1230)
R 1.4.0 ?stars has scale: logical flag: if `TRUE', the columns of the data matrix are scaled independently so that the maximum value in each column is 1 and the minimum is 0. If `FALSE', the presumption is that the data have been scaled by some other algorithm to the range [0,1]. but the code has if (scale) { x <- sweep(x, 2,
2005 Oct 14
2
run many linear regressions against the same independent variables in batch
R function lm(response ~ term) allows me to run a linear regression on a single response vector. For example, I have recent one year historical prices for a stock and S&P index. I can run regression of the stock prices (as response vector) against the S&P index prices (as term vector). Now assume I have 1000 stocks to run the above regressions (against the same S&P index prices).
2007 Oct 09
2
Help with gamm errors
Dear All Hopefully someone out there can point out what I am missing! I have a (large, several hundred) dataset of gardens in which over two years the presence/absence of a particular bird species is noted each week. I have good reason to believe there is a difference between the two years in the weekly proportion of gardens and would like to assess this, before going on to look in more detail at