similar to: Odd behaviour in within.list() when deleting 2+ variables

Displaying 20 results from an estimated 10000 matches similar to: "Odd behaviour in within.list() when deleting 2+ variables"

2017 Jun 26
2
Odd behaviour in within.list() when deleting 2+ variables
>>>>> peter dalgaard <pdalgd at gmail.com> >>>>> on Mon, 26 Jun 2017 13:43:28 +0200 writes: > This seems to be due to changes made by Martin Maechler in > 2008. Presumably this fixed something, but it escapes my > memory. Yes: The change set (svn -c46441) also contains the following NEWS entry BUG FIXES o
2008 Sep 25
2
Equivalent of 'first.var' or 'last.var' from SAS in R?
Hi, I want to sort a data frame by multiple columns and then take the first record in each unique level of the "by" group I used to sort the data frame. Does someone have an example of how to do this? Thanks, Matt -- It is from the wellspring of our despair and the places that we are broken that we come to repair the world. -- Murray Waas
2005 Jul 01
2
Simple indexing conundrum
My apologies in advance for my thickness but I can't seem to solve the following, seemingly simple, data manipulation problem: I have a data frame that contains multiple factors and multiple continuous 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
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
2017 Jun 26
0
Odd behaviour in within.list() when deleting 2+ variables
This seems to be due to changes made by Martin Maechler in 2008. Presumably this fixed something, but it escapes my memory. However, it seems to have broken the equivalence between within.list and within.data.frame, so now within.list <- within.data.frame does not suffice. The crux of the matter seems to be that both the following constructions work for data frames > aq <-
2017 Jun 26
0
Odd behaviour in within.list() when deleting 2+ variables
> On 26 Jun 2017, at 19:04 , Martin Maechler <maechler at stat.math.ethz.ch> wrote: > >>>>>> peter dalgaard <pdalgd at gmail.com> >>>>>> on Mon, 26 Jun 2017 13:43:28 +0200 writes: > >> This seems to be due to changes made by Martin Maechler in >> 2008. Presumably this fixed something, but it escapes my >> memory. >
2017 Jun 26
1
Odd behaviour in within.list() when deleting 2+ variables
>>>>> "PD" == Peter Dalgaard <pdalgd at gmail.com> >>>>> on Mon, 26 Jun 2017 20:12:38 +0200 writes: >> On 26 Jun 2017, at 19:04 , Martin Maechler >> <maechler at stat.math.ethz.ch> wrote: >> >>>>>>> peter dalgaard <pdalgd at gmail.com> on Mon, 26 Jun
2011 Dec 23
2
cast in reshape and reshape2
> library(reshape2) > x = melt(airquality, id=c('month', 'day')) With reshape I can cast with multiple functions: > library(reshape) > cast(x, month+variable~., c(mean,sd)) month variable mean sd 1 5 ozone 23.615385 22.224449 2 5 solar.r 181.296296 115.075499 3 5 wind 11.622581 3.531450 4 5 temp 65.548387
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. Thanking you in advance for your
2011 Jan 18
3
tips for looping over a category for beginner
hello, I am very new to R. My current data set is a mix of values and categories. It is a geoscience data set, with values per rock sample. Case in point, each sample belongs to a lithology class, and each sample has several physical property measurements (density, porosity...). I want to be able to plot these physical properties for all samples in each lithology class. this is how i'm doing
2008 Feb 12
3
fun.aggregate=mean in reshape
Hi all, We are facing a problem while introducing ourselves to Reshape package use. Melt seems to work fine, but cast fails when we use mean as fun.aggregate. As you see here, length and sum work fine, but mean throws this same error whatever dataset we use. > cast(aqm, month ~ variable, length) month ozone solar.r wind temp 1 5 26 27 31 31 2 6 9 30 30
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 number of rows: 153, 1 I can't decipher what
2018 Apr 22
3
How to dynamically add variables to a dataframe
Hi, I am a bit rusty with R programming and do not seem to find a solution to add a number of variables to my existing dataframe. Basically I need to add n=dim(d1)[1] variables to my d0 dataframe and I would like them to be named V1, V2, V3, ... , V[dim(d1)[1]) When running the following code: for (t in 1:dim(d1)[1]){ d0$V[t] <- 0 } all I get is a V variable populated with zeros... I am
2019 Jun 04
1
Trivial error in documentation
This must have been there for a while> In the datasets package, the help for airquality says: A data frame with 154 observations on 6 variables. But: > 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
2008 Dec 02
4
Bug in "transform"?
Dear useRs, Here is a weird behavior of transform function: mtcars1<-matcars transform(mtcars1,t1=3,t2=4) Error in data.frame(`_data`, e[!matched]) : arguments imply differing number of rows: 32, 1 instead, this works: mtcars1$t1<-0 transform(mtcars1,t1=3,t2=4) also works if applied in turn: transform(mtcars1,t1=3) transform(mtcars1,t2=4) I often need to use this
2017 Jun 21
0
selecting dataframe columns based on substring of col name(s)
> On Jun 21, 2017, at 9:11 AM, Evan Cooch <evan.cooch at gmail.com> wrote: > > Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): > > d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) > > What I haven't been able to
2000 Jan 14
1
Error in dist command
Can anybody tell me why I get the following error: Error in dist(airquality) : NA/NaN/Inf in foreign function call (arg 1) Thanks, Casper Frederiksen -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the
2008 Aug 27
1
convert princomp output to equation for plane?
I want to fit something like: z = b0 + b1*x + b2*y Since x, y,and z all have measurement errors attached, the proper way to do the fit is with principal components analysis, and to use the first component (called loadings in princomp output). My dumb question is: how do I convert the princomp output to equation coefficients in the format above? I guess another dumb question would be: how about
2017 Jun 21
4
selecting dataframe columns based on substring of col name(s)
Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) What I haven't been able to suss out is how to efficiently 'extract/manipulate/play with' columns from the data frame, making use
2010 Feb 11
4
Access variables by string
Dear all, I have two probably very easy questions: (1) Is there a way to access certain variables by their string-based name representation? Example: numbers <- c("one", "two", "three") varname <- "numbers" print(varname[2]) (2) I need this functionality for a customized na.exclude() function that I am building, which should only exclude rows