Displaying 20 results from an estimated 10000 matches similar to: "changing a specific column name"
2010 Jul 29
1
where did the column names go to?
I've just tried to merge 2 data sets thinking they would only keep the common
columns, but noticed the column count was not adding up. I've then
replicated a simple example and got the same thing happening.
q1. why doesn't 'b' have a column name?
q2. when I merge, why does the new column 'y' have all values as 5.1?
Thanks in advance,
Mr. confused
> a <-
2012 Jun 11
1
saving sublist lda object with save.image()
Greetings R experts,
I'm having some difficulty recovering lda objects that I've saved within sublists using the save.image() function. I am running a script that exports a variety of different information as a list, included within that list is an lda object. I then take that list and create a list of that with all the different replications I've run. Unfortunately I've been
2010 Feb 03
1
Calculating subsets "on the fly" with ddply
Hi,
[I sent this to the plyr mailing list (late) last night, but it seems
to be lost in the moderation queue, so here's a shot to the broadeR
community]
Apologies in advance for being more verbose than necessary, but I'm
not even sure how to ask this question in the context of plyr, so ...
here goes.
As meaningless as this might be to do with the `iris` data, the spirit
of it is what
2011 Jul 28
2
not working yet: Re: lattice overlay
Hi Dieter and R community:
I tried both of these three versions with ylim as suggested, none work: I
am getting only single (pch = 16) not overlayed (pch =3) everytime.
*vs 1*
require(lattice)
xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
panel= function(x, y, subscripts) {
panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
panel.lmline(x, y, lty=4, col =
2012 Jul 23
1
duplicated() variation that goes both ways to capture all duplicates
Dear all
The trouble with the current duplicated() function in is that it can
report duplicates while searching fromFirst _or_ fromLast, but not
both ways. Often users will want to identify and extract all the
copies of the item that has duplicates, not only the duplicates
themselves.
To take the example from the man page:
> data(iris)
> iris[duplicated(iris), ] ##duplicates while
2009 Oct 17
1
Easy way to `iris[,-"Petal.Length"]' subsetting?
Dear all
What is the easy way to drop a variable by using its name (and not its
number)? Example:
> data(iris)
> head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all
Is there a simpler method to achieve the following: When I obtain an
empty data.frame after subsetting, I need for it to contain one line
of NAs. Here's a dummy example:
> (.xb <- iris[ iris$Species=='zz', ])
[1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
<0 rows> (or 0-length row.names)
> dim(.xb)
[1] 0 5
> (.xa <-
2005 Mar 21
1
Convert numeric to class
Dear all,
I have a script about iteration classification, like this below
data(iris)
N <- 5
ir.tr.iter <- vector('list',N)
ir.tr <- vector('list',N)
for (j in 1:N) {
ir.tr[[j]] <- rpart(Species ~., data=iris)
ir.tr.iter[j] <- ir.tr[[j]]$frame
result <- list(ir.tr=ir.tr, ir.tr.iter=ir.tr.iter)
}
as.data.frame(as.matrix(ir.tr.iter))
2010 Jun 09
4
question about "mean"
Hi there:
I have a question about generating mean value of a data.frame. Take
iris data for example, if I have a data.frame looking like the following:
---------------------
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4
0.2 setosa
2 4.9 3.0 1.4
0.2
2009 Sep 09
1
change character to factor in data frame
Dear all
I have a simple problem which I thought is easy to solve but what I tried
did not work. I want to change character variables to factor in data
frame. It goes easily from factor to character, but I am stuck in how to
do backwards conversion.
Here is an example
irisf<-iris
irisf[,2]<-factor(irisf[,2]) # create second factor
str(irisf)
'data.frame': 150 obs. of 5
2007 Dec 03
1
cor(data.frame) infelicities
In using cor(data.frame), it is annoying that you have to explicitly
filter out non-numeric columns, and when you don't, the error message
is misleading:
> cor(iris)
Error in cor(iris) : missing observations in cov/cor
In addition: Warning message:
In cor(iris) : NAs introduced by coercion
It would be nicer if stats:::cor() did the equivalent *itself* of the
following for a data.frame:
2013 Apr 16
1
avoid losing data.frame attributes on cbind()
Dear all,
How should I add several variables to a data frame without losing the
attributes of the df? Consider the following:
> require(Hmisc)
> Xa <- iris
> label(Xa, self=T) <- "Some df label"
> str(Xa)
'data.frame': 150 obs. of 5 variables:
$ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
$ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9
2008 May 30
1
robust mlm in R?
I'm looking for something in R to fit a multivariate linear model
robustly, using
an M-estimator or any of the myriad of other robust methods for linear
models
implemented in robustbase or methods based on MCD or MVE covariance
estimation (package rrcov).
E.g., one can fit an mlm for the iris data as:
iris.mod <- lm(cbind(Sepal.Length, Sepal.Width, Petal.Length,
Petal.Width) ~ Species,
2013 Jul 22
1
union of a list of logical values
Dear all,
How can I obtain the union of a list of logical values?
Consider the following:
x <- head(iris)
x[,c(2,4)] <- NA
x[c(2,4),] <- NA
# > x
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1 5.1 NA 1.4 NA setosa
# 2 NA NA NA NA <NA>
# 3 4.7 NA 1.3
2012 Jul 12
1
Results from mixed linear models
Dear list,
I'm quite confused when interpreting results from a mixed linear model.
For example, working on Iris data frame, I want to know the effect of
species on slope of the model "Petal.Length~Sepal.Length"
I write this :
data(iris)
reg01 <- lm(Petal.Length~Sepal.Length + Sepal.Length:Species, data=iris)
summary(reg01)
It gives me a summary table with lm for the first
2006 May 31
2
a problem 'cor' function
Hi list,
One of my co-workers found this problem with 'cor' in his code and I confirm it too (see below). He's using R 2.2.1 under Win 2K and I'm using R 2.3.0 under Win XP.
===========================================
> R.Version()
$platform
[1] "i386-pc-mingw32"
$arch
[1] "i386"
$os
[1] "mingw32"
$system
[1] "i386, mingw32"
$status
2013 Oct 15
1
randomForest: Numeric deviation between 32/64 Windows builds
Dear R Developers
I'm using the great randomForest package (4.6-7) for many projects and recently stumbled upon a problem when I wrote unit tests for one of my projects:
On Windows, there are small numeric deviations when using the 32- / 64-bit version of R, which doesn't seem to be a problem on Linux or Mac.
R64 on Windows produces the same results as R64/R32 on Linux or Mac:
>
2005 Sep 16
6
How do I get the row indices?
Hi,
I was wondering if it's possible to get the row
numbers from a filtering. Here's an example:
# give me the rows with sepal.length == 6.2
iris[(iris[,1]==6.2),]
# output
Sepal.Length Sepal.Width Petal.Length Petal.Width
Species
69 6.2 2.2 4.5 1.5
versicolor
98 6.2 2.9 4.3 1.3
versicolor
127 6.2
2012 Jul 31
1
kernlab kpca predict
Hi!
The kernlab function kpca() mentions that new observations can be transformed by using predict. Theres also an example in the documentation, but as you can see i am getting an error there (As i do with my own data). I'm not sure whats wrong at the moment. I haven't any predict functions written by myself in the workspace either. I've tested it with using the matrix version and the
2005 Apr 27
4
How to add some of data in the first place dataset
Dear R-help,
First I apologize if my question is quite simple.
I need add some of data in the first place my dataset, how can I do that.
I have tried with rbind, but I did not succes.
0.1 3.6 0.4 0.9 rose
4.1 4.0 1.2 1.2 rose
4.4 3.2 1.9 0.5 rose
4.6 1.1 1.1 0.2 rose
For example,