similar to: bug (?) in [.data.frame with matrix-like indexing

Displaying 20 results from an estimated 10000 matches similar to: "bug (?) in [.data.frame with matrix-like indexing"

2007 Jul 12
1
[[.data frame and row names
Hi, I'm wondering why indexing a data frame by row name doesn't work with [[. It works with [: > sw <- swiss[1:5,1:2] > sw["Moutier", "Agriculture"] [1] 36.5 but not with [[: > sw[["Moutier", "Agriculture"]] Error in .subset2(.subset2(x, ..2), ..1) : subscript out of bounds The problem is really with the row name (and not
2015 Oct 05
2
authorship and citation
As a fourth option, I wonder if the first author could fork the package? Presumably, appropriately cited, a fork is permitted by the license under which it was released. Then the original package, by both authors, still exists (and a final version could point to the new one) and the new package, citing the previous version appropriately, is by a single author. The page of CRAN's policies
2010 Nov 18
3
problems subsetting
Dear all, I have searched the forums for an answer - and there is plenty of questions along the same line - but none of the paproaches shown worked to my problem: I have a data frame that I get from a csv: summarystats<-as.data.frame(read.csv(file=f_summary)); where I have the columns Dataset, Class, Type, Category,.. Problem1: I want to find a subset of this frame, based on values in
2011 Feb 24
1
Creating objects (data.frames) with names stored in character vector
Hello, I'm fairly new to R. I'm a chemist, not a programmer so please bear with me. I have a large data.frame that I want to break down (subset) into smaller data.frames for analysis. I would like to give the data.frames descriptive names which I have stored in a character vector. My original thought was that I want the subsets to show up as individual objects, but haveing them stored
2008 Jul 01
1
[.data.frame speedup
Below is a version of [.data.frame that is faster for subscripting rows of large data frames; it avoids calling duplicated(rows) if there is no need to check for duplicate row names, when: i is logical attr(x, "dup.row.names") is not NULL (S+ compatibility) i is numeric and negative i is strictly increasing "[.data.frame" <- function (x, i, j,
2020 Jun 17
2
subset data.frame at C level
Hi, Hope you are well. I was wondering if there is a function at C level that is equivalent to mtcars$carb or .subset2(mtcars, "carb"). If I have the index of the column then the answer would be VECTOR_ELT(df, asInteger(idx)) but I was wondering if there is a way to do it directly from the name of the column without having to loop over columns names to find the index? Thank you Best
2007 Oct 08
1
data.frame's and [2, c(T, F)] in R 2.6.0
In R prior to 2.6.0 with matrizes as well as with data.frames it is possible to do: a[2, c(TRUE, FALSE)] In R 2.6.0 the mixed indexing works only for matrizes. Is this the intention, a bug, or did I get something wrong? Best regards Meinhard Meinhard Ploner Althingstrasse 15 39031 Bruneck P.IVA 0234 058 0212 Tel. +39 340 8937861 www.data-ploner.com [[alternative HTML version
2009 Sep 13
1
Manage an unknown and variable number of data frames
Hi, In the code below I create a small data.frame (dat) and then cut it into different groups using CutList. The lists in CutList allow to me choose whatever columns I want from dat and allow me to cut it into any number of groups by changing the lists. It seems to work OK but when I'm done I have a variable number of data frames what I need to do further operations on and I don't know
2004 Dec 14
1
Multiple options for a package
Hi R-devel, I am facing a situation where the number of options I would like to propose to the user is somewhat big (and could easily increase more and more as I will code up a little more - even coming to a point where an user should be able to implement his own options). What we have to handle options is the couple: options(par=value) and getOption("par") I was aking myselft what
2012 Sep 06
1
use of ddply() within function
Dear all, I am encountering problems with the application of ddply within the body of a self-defined function. The script is the following: moncostcarmoto <- function(costtype){ costaux_result <- data.frame() for (purp in PURPcount){for (per in PERcount){ costcarin =
2012 Apr 21
2
using "factor" to eliminate unused levels without dropping other variables
Hello, I have been banging my head against the wall trying to figure out this seemingly simple problem with no success. I'm hoping that one or some of you can help. Here is the code I am trying to use: #importing data data.file <-read.csv("/file/location", header=TRUE, sep = ",") #selecting a subset of data based on variable "Sample" data.subset1 <-
2010 May 04
2
split() bug? Inconsistent Windows/Linux behavior.
I didn't see anything on this in the bug reports, and a search of the archives had lots of false positives when searching on "split" to be helpful. I don't view this as particularly interesting or useful, but wanted to report it because I stumbled on it (and don't remember ever seeing "invalid permissions" as part of a segfault).? Yes, I realize this is a silly
2015 Oct 05
3
authorship and citation
Dear R developers, This is a rather peculiar question, but nevertheless I would still need an answer for. It is about an R package which I created (namely QCA), and from versions 1.0-0 to 1.1-4 I had a co-author. The co-author recently withdrawn from the package development, but still requires to be left in the authors list and be cited for the package in the CITATION file. Obviously, one could
2009 Oct 12
1
field index given name.
Hi, How do I access the index number of a field given I only know the field name? eg - I want to set the probability of the field 'species' higher than the other fields to use in sampling. > colprob <- array(dim=NCOL(iris)) > for(i in 1:NCOL(iris)){colprob[i]=0.5} > colprob[iris$species] = 1 #this doesn't work > colprob [1] 0.5 0.5 0.5 0.5 0.5 -- View this
2006 Apr 13
3
What does "rbind(iris[,,1], iris[,,2], iris[,,3])" do?
It's in the Venables & Ripley MASS (ed 3) book in the section on principal components. The context is as follows > ir <- rbind(iris[,,1], iris[,,2], iris[,,3]) > ir.species <- factor(c(rep("s",50),rep("c",50),rep("v",50))) (then they use brush(ir) which I guess is not an R function) and then > princomp(log(ir[1:4]),cor=T) (there is no [1:4]
2008 Feb 27
2
multiple plots per page using hist and pdf
Hello, I am puzzled by the behavior of hist() when generating multiple plots per page on the pdf device. In the following example two pdf files are generated. The first results in 4 plots on one pdf page as expected. However, the second, which swaps one of the plot() calls for hist(), results in a 4 page pdf with one plot per page. How might I get the histogram with 3 other scatter
2005 Apr 07
2
axis colors in pairs plot
The following command produces red axis line in a pairs plot: pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c("red", "green3", "blue")[unclass(iris$Species)]) Trying to fool pairs in the following way produces the same plot as above: pairs(iris[1:4], main = "Anderson's Iris Data -- 3
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 Jun 30
2
NaiveBayes fails with one input variable (caret and klarR packages)
Hello, We have a system which creates thousands of regression/classification models and in cases where we have only one input variable NaiveBayes throws an error. Maybe I am mistaken and I shouldn't expect to have a model with only one input variable. We use R version 2.6.0 (2007-10-03). We use caret (v4.1.19), but have tested similar code with klaR (v.0.5.8), because caret relies on
2000 May 11
1
OpenSSH 2.1.0 under Solaris 8 ...
Compiled great, got both my RSA and DSA keys' generated for Protocol 1/2, started up fine ... try to connect and get a bunch of errors: May 11 14:01:47 iris sshd[8578]: error: Couldn't wait for child '/bin/ls -alni' completion: No child processes May 11 14:01:47 iris last message repeated 3 times May 11 14:01:47 iris sshd[8578]: error: Command '/bin/ls -alni': select()