Displaying 20 results from an estimated 3000 matches similar to: "Applying a function on n nearest neighbours"
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    
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
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
2011 Aug 02
1
'data.frame' method for base::rep()
Dear R developers
Would you consider adding a 'data.frame' method for the base::rep
function? The need to replicate a df row-wise can easily arise while
programming, and rep() is unable to handle such a case. See below.
> x <- iris[1, ]
> x
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1          5.1         3.5          1.4         0.2  setosa
> rep(x, 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
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 <-
2017 Oct 28
0
Cannot Compute Box's M (Three Days Trying...)
On 28/10/2017 8:59 AM, Morkus wrote:
> Hey Duncan,
> 
> Hard to debug? That's an understatement. Eyes bleeding....
> 
> In any case, I tried all your suggestions. To get "integer" for the 
> final column, I had to change the code to get integers instead of strings.
The last column in iris is actually a factor.  That's stored as an 
S3-classed integer vector
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  
2017 Oct 29
0
Cannot Compute Box's M (Three Days Trying...)
On 29/10/2017 7:26 AM, Morkus wrote:
> Thanks Duncan. I can't tell you how helpful all your terrific replies 
> have been.
> 
> I think the biggest surprise is that nobody appears to be using Java and 
> R together like I"m trying to do. I suppose it should be a surprise 
> since there are no books on the subject and almost no technical 
> documentation other than a
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         
2017 Oct 28
0
Cannot Compute Box's M (Three Days Trying...)
On 28/10/2017 7:12 AM, Morkus wrote:
> Thanks Duncan. Awesome ideas!
> 
> I think we're getting closer!
> 
> I tried what you suggested and got a possibly better error...
> .
> .
> .
> rConnection.assign("boxMVariable", myDf);
> 
> *String resultBV *= *"str(boxMVariable)"*; *// your suggestion.*
> 
> *RESULTING ERROR:*
> 
>
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,
2011 Jul 21
0
add label attribute to objects?
Dear all
I know that the R way of documenting things is to work on your project
in package development mode, and document each object (such as data
frames) in a *.Rd files. This should work for gurus. What about a
simpler way to document things, geared for mere mortals?
I was thinking of a label() or tag() function that could store and
retrieve an alphanumeric comment for a given object (for
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
2017 Sep 15
0
Regarding Principal Component Analysis result Interpretation
First, see the example at https://isezen.github.io/PCA/
> On 15 Sep 2017, at 13:43, Shylashree U.R <shylashivashree at gmail.com> wrote:
> 
> Dear Sir/Madam,
> 
> I am trying to do PCA analysis with "iris" dataset and trying to interpret
> the result. Dataset contains 150 obs of 5 variables
> 
>    Sepal.Length  Sepal.Width  Petal.Length  Petal.Width 
2017 Sep 15
3
Regarding Principal Component Analysis result Interpretation
Dear Sir/Madam,
I am trying to do PCA analysis with "iris" dataset and trying to interpret
the result. Dataset contains 150 obs of 5 variables
    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
 
2017 Oct 29
2
Cannot Compute Box's M (Three Days Trying...)
Thanks Duncan. I can't tell you how helpful all your terrific replies have been.
I think the biggest surprise is that nobody appears to be using Java and R together like I"m trying to do. I suppose it should be a surprise since there are no books on the subject and almost no technical documentation other than a few sites here and there.
-----
I originally had the "int" as the
2013 Feb 08
3
Border width on symbols plotted with the lattice package
Dear list members,
I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice' 
package to respect the 'lwd' value for specifying the border with for 
*symbols* (for lines it works fine). Example:
-----
# Base graphics works fine (gives a 'fat? circle)
plot(5, cex=10, pch=21, lwd=10)
# But 'xyplot' or 'dotplot' doesn't
2013 Jan 14
1
Tukey HSD plot with lines indicating (non-)significance
Dear list members,
I'm running some tests looking at differences between means for various 
levels of a factor, using Tukey's HSD method.
I would like to plot the data as boxplots or dotplots, with horizontal 
significance lines indicating which groups are statistically 
significantly different, according to Tukey HSD. Here's a nice image 
showing an example of such a graphical
2004 Jun 24
0
tree model with at most one split point per variable
I would like to create a tree model with at most one split point per variable
using tree, rpart or other routine.  Its OK if a variable enters at more
than one node but if it does then all splits for that variable should be
at the same point.  The idea is that I want to be able to summarize the
data as binary factors with the chosen split points.  I don't want to
have three level or more