Displaying 20 results from an estimated 8000 matches similar to: "What does "rbind(iris[,,1], iris[,,2], iris[,,3])" do?"
2006 Apr 13
5
Questions on formula in princomp
I hope this time I'm using the "iris" dataset correctly:
ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
lir <- data.frame(log(ir))
names(lir) <- c("a","b","c","d")
I'm trying to understand the meaning of expressions like "~ a+b+c+d",
used with princomp, e.g.
princomp(~ a+b+c+d, data=lir, cor=T)
By inspection, it
2002 Mar 17
3
apply problem
> data(iris)
# iris3 is first 3 rows of iris
> iris3 <- iris[1:3,]
# z compares row 1 to each row of iris3 and is correctly
computed
> z <- c(F,F,F)
> for(i in seq(z)) z[i] <- identical(iris3[1,],iris3[i,])
> z
[1] TRUE FALSE FALSE
# this should do the same but is incorrect
> apply(iris3,1,function(x)identical(x,iris3[1,]))
1 2 3
FALSE FALSE FALSE
2009 Nov 17
1
Error running lda example: Session Info
>
> library(MASS)
> Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]),
+ Sp = rep(c("s","c","v"), rep(50,3)))
> train <- sample(1:150, 75)
> table(Iris$Sp[train])
c s v
22 23 30
> z <- lda(Sp ~ ., Iris, prior = c(1,1,1)/3, subset = train)
Error in if (targetlist[i] == stringname) { : argument is of length
2012 Dec 10
3
splitting dataset based on variable and re-combining
I have a dataset and I wish to use two different models to predict. Both models are SVM. The reason for two different models is based
on the sex of the observation. I wish to be able to make predictions and have the results be in the same order as my original dataset. To
illustrate I will use iris:
# Take Iris and create a dataframe of just two Species, setosa and versicolor, shuffle them
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
2003 Nov 05
1
save(iris,file=
I tried it using file and it seems to work for saving:
> data(iris)
> con <- file("clipboard","w")
> save(iris,ascii=T,file=con)
> close(con)
> readLines("clipboard")
... lengthy output follows which seems correct ...
but not for loading:
> con <- file("clipboard","r")
> load(con)
Error in load(con) : loading from
2005 Jul 06
1
Help: Mahalanobis distances between 'Species' from iris
Dear R list,
I'm trying to calculate Mahalanobis distances for 'Species' of 'iris' data
as obtained below:
Squared Distance to Species From Species:
Setosa Versicolor Virginica
Setosa 0 89.86419 179.38471
Versicolor 89.86419 0 17.20107
Virginica 179.38471 17.20107 0
This distances above were obtained with proc
2009 Oct 14
1
plot discriminant analysis
I'm confused on how is the right way to plot a discriminant analysis made by
lda function (MASS package).
(I had attached my data fro reproduction). When I plot a lda object :
X <- read.table("data", header=T)
lda_analysis <- lda(formula(X), data=X)
plot(lda_analysis)
#the above plot is completely different to:
plot(predict(lda_analysis)$x,
2003 Nov 05
1
save(iris,file="clipboard",ascii=TRUE)
Is this a bug? I thought that "clipboard" could always be substituted
for a filename when dealing with ASCII files.
> data(iris)
> save(iris,ascii=TRUE,file="clipboard")
Error in file(file, "wb") : `mode' for the clipboard must be `r' or `w'
Also this (where gclip is a utility found at unxutils.sourceforge.net
that copies its standard input to the
2010 Sep 29
2
What's the meaning of "Species ~ ." in IRIS data
I am refering to a function call like this:
>data(iris)
>x <- svmlight(Species ~ ., data = iris)
I tried to see the content of it by typing:
> Species ~ .
but it gives nothing. How can I see it's content ?
- P.Dubois
2012 Feb 29
2
Principal Component Analysis
Dear R buddies,
I’m trying to run Principal Component Analysis, package
princomp: http://stat.ethz.ch/R-manual/R-patched/library/stats/html/princomp.html.
My question is: why do I get different results with pca =
princomp (x, cor = TRUE) and pca = princomp (x, cor = FALSE) even when I
standardize variables in my matrix?
Best regards,
Blaž Simčič
[[alternative HTML version deleted]]
2008 Oct 01
2
Bivariate normal
Package mvtnorm provides dmvnorm, pmvnorm that can be used to compute
Pr(X=x,Y=y) and Pr(X<x,Y<y) for a bivariate normal.
Are there functions that would compute Pr(X<x,Y=y)?
I'm currently using "integrate" with dmvnorm but it is too slow.
2011 Dec 08
1
lda output missing
Hello everyone,
I am working on a linear discriminant analysis and am having issues finding
the full output of my lda. Specifically, there is no reporting of the
Proportion of Trace that is a normal output of the procedure. I'm using a
csv file and everything is reading in correctly. I've looked and looked and
can't figure out why my output is not complete. Is it something simple that
2000 Mar 08
3
Reading data for discriminant analysis
Dear R users,
I want to do discriminant analysis on my data. I have
successfully followed the discriminant analysis in V & R on
the iris data:
> ir <- rbind (iris3[,,1],iris3[,,2],iris3[,,3])
> ir.species <- c(rep("s",50),rep("c",50),rep("v",50))
> a <- lda(log(ir),ir.species)
> a$svd^2/sum(a$svd^2)
[1] 0.996498601 0.003501399
> a.x <-
2006 May 30
1
when dimensionality is larger than the number of observations?
Hi, there:
Can anyone here kindly point some good reference or links on this topic?
Esp. some solutions from BioConductor or R, when dealing with
microarray-like, "fat" data?
thanks,
--
Weiwei Shi, Ph.D
"Did you always know?"
"No, I did not. But I believed..."
---Matrix III
[[alternative HTML version deleted]]
2005 Jul 13
4
Where's iris?
Hi:
Where is the iris data set actually
located in the R 2.1.0 folder (under W XP)?
Is it a text file or it is a binary file?
Ruben
2009 Nov 15
3
Error running lda example from Help File (MASS library )
Hello all,
I'm trying to run lda() from the MASS library but the Help example generates
the
following error:
#Code from example in lda Help file
# Resulting Error
>Error in if (targetlist[i] == stringname) { : argument is of length zero
My Current R Installation:
MacOSX: 10.5.8
R: 2.10.0
--
Gregory Riddick, PhD.
CRTA Research Fellow
National Institutes of Health
National
2005 Feb 02
4
(no subject)
can you recommend a good manual for R that starts with a data set and gives
demonstrations on what can be done using R? I downloadedR Langauage
definition and An introduction to R but haven't found them overly useful.
I'd really like to be able to follow some tutorials using a dataset or many
datasets. The datasets I have available on R are
Data sets in package 'datasets':
2005 Jul 08
5
Help with Mahalanobis
Dear R list,
I'm trying to calculate Mahalanobis distances for 'Species' of 'iris' data
as obtained below:
Squared Distance to Species From Species:
Setosa Versicolor Virginica
Setosa 0 89.86419 179.38471
Versicolor 89.86419 0 17.20107
Virginica 179.38471 17.20107 0
These distances were obtained with proc 'CANDISC'
2009 Sep 02
4
"biplot" graphical options?
Dear R-help fellows
good afternoon.
I am struggling in the attempt to impose some graphical conditions (changing point symbols, colors, etc) to biplot function (I am using it to visualize the results of princomp) but I can't apparently manage to change anything but the axis... and I have been browsing manuals and vignettes without finding any explicit suggestions on how to operate...
Can