Displaying 20 results from an estimated 5000 matches similar to: "odfWeave - A loop of the "same" data"
2017 Jun 01
0
odfWeave - A loop of the "same" data
On Thu, 1 Jun 2017, POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help wrote:
> Before I go and do this another way - can I check if anyone has a way of
> looping through data in odfWeave (or possibly sweave) to do a repeating
> analysis on subsets of data?
>
> For simplicity lets use mtcars dataset in R to explain. Dataset looks like this:
>
2013 Apr 12
3
Why copying columns of a data.frame becomes numeric?
Dear list,
I want the 1st, 2nd, 5th, and 6th columns of mtcars. After copying them,
the columns become numeric class rather than data frame.
But, when I copy rows, they data frame retains its class. Why is this? I
don't see why copying rows vs columns is so different.
> class(mtcars)
[1] "data.frame"
> head(mtcars)
mpg cyl disp hp drat wt qsec vs
2013 Apr 16
2
efficiently diff two data frames
Dear all,
What is the quickest and most efficient way to diff two data frames,
so as to obtain a vector of indices (or logical) for rows/columns that
differ in the two data frames? For example,
> Xe <- head(mtcars)
> Xf <- head(mtcars)
> Xf[2:4,3:5] <- 55
> all.equal(Xe, Xf)
[1] "Component 3: Mean relative difference: 0.6863118"
[2] "Component 4: Mean relative
2018 May 10
4
the first name of the first column
Dear all;
I need to run heatmap. Because my first column in my data is alphanumeric,
I can not run as.matrix(scale(my_data)). So I need to make my data readable
as in data(mtcars). In *mtcars *data the first column is alphanumeric and
has no name.
Thanks,
Greg
[[alternative HTML version deleted]]
2007 Jun 05
3
read table
Hi,
I'm a novice of R.
I want to read the following table into R:
names mpg cyl disp hp drat
Mazda RX4 21.0 6 160.0 110 3.90
Mazda RX4 Wag 21.0 6 160.0 110 3.90
The command I used is:
> test <- read.table(file.choose(),header=T)
The result is:
Error in read.table(file.choose(), header = T) :
more columns than column names
2003 Aug 07
1
graph for selected lines in stars()
Dear listers,
The following command (derived from the example in the ?stars help page)
works :
data(mtcars)
stars(mtcars[, 1:7])
But the following gives an error:
stars(mtcars[1, 1:7])
Error in s.y[i, ] : incorrect number of dimensions
I was expecting to have the star graph for the first line (Mazda Rx4)
The following give an incorrect graph for the first two cars :
stars(mtcars[1:2, 1:7])
2009 Apr 27
0
VIF's in R using BIGLM
Dear R-help
This is a follow-up to my previous post here:
http://groups.google.com/group/r-help-archive/browse_thread/thread/d9b6f87ce06a9fb7/e9be30a4688f239c?lnk=gst&q=dobomode#e9be30a4688f239c
I am working on developing an open-source automated system for running
batch-regressions on very large datasets. In my previous post, I posed
the question of obtaining VIF's from the output of
2017 Mar 26
1
Documentation of model.frame() and get_all_vars()
Hi everyone,
This is about documentation for the model.frame() page. The
get_all_vars() function (added in R 2.5.0) is a great addition, but
the behavior of its '...' argument is different from that of
model.frame() with which it is documented and this creates ambiguity.
The current docs read:
\item{\dots}{further arguments such as \code{data}, \code{na.action},
\code{subset}. Any
2007 Oct 01
4
how to plot a graph with different pch
I am trying to plot a graph but the points on the graph should be
different symbols and colors. It should represent what is in the legend.
I tried using the points command but this does not work. Is there
another command in R that would allow me to use different symbols and
colors for the points?
Thank you kindly.
data(mtcars)
plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)",
2004 Jan 22
1
stem plot problem with the mtcars data (PR#6453)
Full_Name: Liming Liang
Version: 1.8.1
OS: windows2000 professional
Submission from: (NULL) (67.172.81.139)
I was looking at the variable 'mpg' of the data file 'mtcars' and make a stem
plot, the following is the commend I entered. The stem plot shows the largest
observation is 32.9 but actually in the data the largest observation is 33.9,
here might be a problem.
>
2020 Apr 16
2
suggestion: "." in [lsv]apply()
I'm sure this exists elsewhere, but, as a trade-off, could you achieve
what you want with a separate helper function F(expr) that constructs
the function you want to pass to [lsv]apply()? Something that would
allow you to write:
sapply(split(mtcars, mtcars$cyl), F(summary(lm(mpg ~ wt,.))$r.squared))
Such an F() function would apply elsewhere too.
/Henrik
On Thu, Apr 16, 2020 at 9:30 AM
2020 Apr 16
6
suggestion: "." in [lsv]apply()
Hi,
I would like to make a suggestion for a small syntactic modification of
FUN argument in the family of functions [lsv]apply(). The idea is to
allow one-liner expressions without typing "function(item) {...}" to
surround them. The argument to the anonymous function is simply referred
as ".". Let take an example. With this new feature, the following call
2007 May 12
2
Implicit vs explicit printing and the call stack
Hi everyone,
I've run into a bit of strange problem with implicit vs explicit
printing and the call stack. I've included an example at the bottom of
this email. The basic problem is that I have an S3 object with a
print method. When the object is implicitly printed (ie. typed
directly into the console) the function arguments in the call stack
are exploded out to their actual values,
2012 Nov 04
1
Apply same linear model to subset of dataframe
I have applied the same linear model to several different subsets of a
dataset. I recently read that in R, code should never be repeated. I feel my
code as it currently stands has a lot of repetition, which could be
condensed into fewer lines. I will use the mtcars dataset to replicate what
I have done. My question is: how can I use fewer lines of code (for example
using a for loop, a function or
2010 Nov 30
3
pca analysis: extract rotated scores?
Dear all
I'm unable to find an example of extracting the rotated scores of a
principal components analysis. I can do this easily for the un-rotated
version.
data(mtcars)
.PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars)
unclass(loadings(.PC)) # component loadings
summary(.PC) # proportions of variance
mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of
2020 Apr 16
2
suggestion: "." in [lsv]apply()
Simon,
Thanks for replying. In what follows I won't try to argue (I understood
that you find this a bad idea) but I would like to make clearer some of
your point for me (and may be for others).
Le 16/04/2020 ? 16:48, Simon Urbanek a ?crit?:
> Serguei,
>> On 17/04/2020, at 2:24 AM, Sokol Serguei <sokol at insa-toulouse.fr>
>> wrote: Hi, I would like to make a
2020 Apr 17
2
suggestion: "." in [lsv]apply()
Thanks Simon,
Now, I see better your argument.
Le 16/04/2020 ? 22:48, Simon Urbanek a ?crit?:
> ... I'm not arguing against the principle, I'm arguing about your
> particular proposal as it is inconsistent and not general.
This sounds promising for me. May be in a (new?) future, R core will
come with a correct proposal for this principle?
Meanwhile, to avoid substitute(),
2010 Jun 18
1
ggplot2 boxplot: horizontal, univariate
In ggplot2, I would like to make a boxplot that has the following properties:
(1) Contrary to default, the meaningful axis should be the horizontal axis.
Lattice does this, for instance, by
library(lattice);bwplot(~mtcars$mpg)
(2) It is *univariate*, i.e., of a single vector, say mtcars$mpg. I do not wish to make separate plots for the different values of mtcars$cyl.
(3) Nothing on the
2009 Aug 16
2
bootstrapped correlation confint lower than -1 ?
Dear R users,
Does the results below make any sense? Can the the interval of the
correlation coefficient be between *-1.0185* and -0.8265 at 95%
confidence level?
Liviu
> library(boot)
> data(mtcars)
> with(mtcars, cor.test(mpg, wt, met="spearman"))
Spearman's rank correlation rho
data: mpg and wt
S = 10292, p-value = 1.488e-11
alternative hypothesis: true rho is not
2017 May 09
3
R-3.3.3/R-3.4.0 change in sys.call(sys.parent())
Some formula methods for S3 generic functions use the idiom
returnValue$call <- sys.call(sys.parent())
to show how to recreate the returned object or to use as a label on a
plot. It is often followed by
returnValue$call[[1]] <- quote(myName)
E.g., I see it in packages "latticeExtra" and "leaps", and I suspect it
used in "lattice" as well.
This idiom