search for: airquality

Displaying 20 results from an estimated 148 matches for "airquality".

2009 May 26
2
Problem accessing "row number" from subset on a dataframe
I would like to use the "row number" information returned from performing a subset command on a dataframe. For example, I would like to automatically delete some rows from a dataframe if they match a criteria. Here is my example below. data(airquality) names(airquality) subset(airquality, airquality$Month == 6) Now how do I delete the row numbers returned automatically? I know I can type airquality_mod<-airquality[-c(32:60)] However, I would like to check the row information and then use it to delete the stuff out of the dataframe. Th...
2009 Aug 04
5
Stacked plots with common x-axis and different y-axis
Is there a place that shows how to create two plots that are stacked on top of each other where they share a common x-axis scale, but have differnt y-axis scale? Say have the following data: airquality Stack plot(airquality$Day, airquality$Wind) on top of plot(airquality$Day, airquality$Temp). I am interested in stacking the two on top of each other with no seam, or plotting the two lines with two different y-axis scales on the same plot. Thanks for any feedback and insights.
2008 Dec 23
3
Using transform to add a date column to a dataframe
I would like to add a column to the airquality dataset that contains the date 1950-01-01 in each row. This method does not appear to work: > attach(airquality) > data1 <- transform(airquality,Date=as.Date("1950-01-01")) Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L, 23L, 19L, : arguments imply differing...
2006 Feb 05
2
a generic 'attach'?
Is there any reason why 'attach' is not generic in R? I notice that it is in another system, for example, and I can see some applications if it were so in R. Bill Venables. Bill Venables, CMIS, CSIRO Laboratories, PO Box 120, Cleveland, Qld. 4163 AUSTRALIA
2007 Apr 01
1
Non-unique column names in data frames
...brought to my attention that R permits non-unique column names in data frames -- e.g., via assignment to names() or colnames(). This behaviour is consistent with the help files (as I discovered), but it's not consistent with the behaviour of rownames() and row.names(). For example, row.names(airquality) <- rep("a", nrow(airquality)) generates an error, but names(airquality) <- rep("a", ncol(airquality)) or even names(airquality) <- rep("", ncol(airquality)) do not. I figure that there must be some rationale for this difference, but I can't thi...
2012 Feb 23
1
Sexpr not getting expanded in Sweave
An Sweave file, 'test.Rnw': \documentclass{article} \title{Sweave minimal} \author{MK} \begin{document} \maketitle We try Sweave: <<1>>= data(airquality) summary(airquality) x <- airquality[1, 1] @ I try Sexpr: \Sexpr{x} We plot: \begin{center} <<2, fig=TRUE, echo=FALSE >>= boxplot(Ozone ~ Month, data = airquality) @ \end{center} \end{document} I check the sessionInfo: > sessionInfo() R version 2.14.1 (2011-12-22) Platform: x...
2013 Jul 23
1
cbind error with check.names
Here is an example where?cbind?fails with an error when?check.names=TRUE?is set. data(airquality) airQualityBind =cbind(airquality,airquality,check.names =TRUE) ?I understand that?cbind?is a call to?data.frame?and the following works: airQualityBind =data.frame(airquality,airquality,check.names =TRUE) but I would like to understand why?cbind?throws an error. I asked this question on SO here...
2005 Jul 01
2
Simple indexing conundrum
...ntinuous response variables, but duplicates of some factor combinations. The duplicates contain bad data, so I would like to eliminate the duplicates. I would like to retain the entire rows identified by the maximum value of one particular continuous response variable. For instance, >data(airquality) > str(airquality) `data.frame': 153 obs. of 6 variables: $ Ozone : int 41 36 12 18 NA 28 23 19 8 NA ... $ Solar.R: int 190 118 149 313 NA NA 299 99 19 194 ... $ Wind : num 7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ... $ Temp : int 67 72 74 62 56 66 65 59 61 69 ... $...
2002 Sep 05
1
rcorr in Hmisc
Dear list, I get the following message when I use rcorr in library "Hmisc" ------------------------------------------------------ > rcorr(lskPox0t30, type=c("spearman")) Error in "[<-.data.frame"(*tmp*, is.na(x), value = 1e+30) : matrix subscripts not allowed in replacement ------------------------------------------------------ I do not understand
1999 Aug 24
3
Error in get(x, envir, mode, inherits)
Dear R list, members of my course have encountered the following error message: > slm <- lm(price ~ engsize, autoframe) Error in get(x, envir, mode, inherits) : variable "FUN" was not found [more context is given in the fuller listing below]. Once the error is encountered it seems to persist; for example early in one session: > summary(blin.fit) Call: lm(formula = Response
2007 Sep 16
1
Identifying objects from a data set
Hello Given the following data for a data set called airquality. To identify the nature of the objects from the data set airquality example "Ozone" would it be best to use the command is. like is.character(airquality$Ozone) ....... I tried attributes(airquality$Ozone) but it came up null. Would there be a better way to identify these objects. Thanki...
2008 May 05
4
Column renaming
Dear all, Is there a less cumbersome way to rename a column by name (as opposed to index) than -- names( X)[ names[ X] == "bob"]<-"sue" ? A semi-related question: how does one get the index of a column by name, something along the lines of col.index( X, "sue") ? Chip Barnaby --------------------------------------------------------- Chip Barnaby
2008 Mar 24
2
Newbie help with Sweave
...ticle} \title{Sweave Example 1} \author{Friedrich Leisch} \usepackage{C:/PROGRA~1/R/R-26~1.2/share/texmf/Sweave} \begin{document} \maketitle In this example we embed parts of the examples from the \texttt{kruskal.test} help page into a \LaTeX{} document: \begin{Schunk} \begin{Sinput} > data(airquality) > library(ctest) > kruskal.test(Ozone ~ Month, data = airquality) \end{Sinput} \begin{Soutput} Kruskal-Wallis rank sum test data: Ozone by Month Kruskal-Wallis chi-squared = 29.2666, df = 4, p-value = 6.901e-06 \end{Soutput} \end{Schunk} which shows that the location parameter of the Ozo...
1998 Feb 16
1
R-beta: Various R Questions and Comments
A non-text attachment was scrubbed... Name: not available Type: text Size: 5982 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19980216/81b069c2/attachment.pl
2017 Jun 26
2
Odd behaviour in within.list() when deleting 2+ variables
...so we will have them now. I've hade an idea that seems to work and even simplify the code.... will get back to the issue later in the evening. Martin > The crux of the matter seems to be that both the following > constructions work for data frames >> aq <- head(airquality) >> names(aq) > [1] "Ozone" "Solar.R" "Wind" "Temp" "Month" "Day" >> aq[c("Wind","Temp")] <- NULL >> aq > Ozone Solar.R Month Day > 1 41 190...
2004 Sep 19
1
Nnet: Returning the response
...llo list. Maybe this is a simple question but I can't find the answer anywhere. With lm I use the parameter y=TRUE to have the response returned in $y. Of course, namely because of NA's in the data frame, this might not include all the values in the original column. For example: > data(airquality) > length(airquality$Day) [1] 153 > my.lm <- lm(Day~.,data=airquality,y=TRUE) > length(my.lm$y) [1] 111 When using nnet, is there a way to have the response returned in a similar way? Thanks in advance, Rui Dantas [[alternative HTML version deleted]]
2017 Jun 26
2
Odd behaviour in within.list() when deleting 2+ variables
The behaviour of within() with list input changes if you delete 2 or more variables, compared to deleting one: l <- list(x=1, y=2, z=3) within(l, { rm(z) }) #$x #[1] 1 # #$y #[1] 2 within(l, { rm(y) rm(z) }) #$x #[1] 1 # #$y #NULL # #$z #NULL When 2 or more variables are deleted, the list entries are instead set to NULL. Is this intended?
2017 Dec 19
1
lm considers removed predictors when finding complete cases
Dear R-devel list, I realized that removing a predictor in lm through the "-"'s operator in formula() does not affect the complete cases that are considered. A minimal example is: summary(lm(Wind ~ ., data = airquality)) # 42 observations deleted due to missingness summary(lm(Wind ~ . - Ozone, data = airquality)) # still 42 observations deleted due to missingness, even if only 7 are # missing for the response and the rest of the predictors summary(lm(Wind ~ ., data = subset(airquality, select = -Ozone))) # 7 ob...
2010 Nov 11
4
Troubleshooting sweave
...http://www.statistik.lmu.de/~leisch/Sweave/ \documentclass[a4paper]{article} \title{Sweave Example 1} \author{Friedrich Leisch} \begin{document} \maketitle In this example we embed parts of the examples from the \texttt{kruskal.test} help page into a \LaTeX{} document: <<>>= data(airquality) library(ctest) kruskal.test(Ozone ~ Month, data = airquality) @ which shows that the location parameter of the Ozone distribution varies significantly from month to month. Finally we include a boxplot of the data: \begin{center} <<fig=TRUE,echo=FALSE>>= boxplot(Ozone ~ Month, data = a...
2010 Jan 24
2
How to define degree=1 in mgcv
Hi, all I have a question on mgcv and ns. Now I want to compare the results from glm, gam and ns. Take a simple model y~x for example. glm1 = glm(y~x, data=data1) gam1 = gam(y~s(x), data=data1) ns1 = glm(y~ns(x),data=data1) In order to confirm the result from glm1 is consistent to those from gam1 and ns1, I want to define degree=1 in mgcv and ns. I am wondering if there is somebody can give me