Displaying 20 results from an estimated 9000 matches similar to: "an issue about subsetting a vector"
2024 Mar 24
1
an issue about subsetting a vector
As with a lot of things in R, the behaviour is counterintuitive but
(arguably) logical. The key (maybe) is that `a[-x]` does not mean "take
all of the elements of a except those indicated by `x`, but rather,
"negate x, then take all but the negative elements". In other words,
-integer(0) is integer(0) (we multiply *each of the elements of
integer(0)* by -1, but
2012 Jul 15
5
variable (column) in a data frame
To the R help list,
When using a data frame, there is no warning or error message
when I refer to a non-existent variable inside the data frame.
Example:
##----------------------------------------------
a <- c(1,2,3)
b <- c(11,22,33)
df <- data.frame(a,b)
df
## correct: there is a column in df named 'a'
## the sum is correctly performed
sum(df$a==2)
## incorrect: there is
2008 Aug 21
2
barplot with anchored bars
Dear R list members,
How to produce barplots anchored to the x-axis (not floating
above the x-axis) with a box around?
With both following codes, the lower horizontal line of the
box is below the y = 0 line:
# first code
x <- c(1,2,3,4)
barplot(x,yaxs='i')
box()
# second code
x <- c(1,2,3,4)
op <- par(yaxs='i')
barplot(x)
box()
par(op)
The parameter yaxs='i'
2008 Dec 21
1
function prop.trend.test (stats)
To the R-help list,
In the documentation of the prop.trend.test function in the
stats package, no bibliography has been provided which
would allow one to find out the theoretical basis of that
function and/or details of its implementation.
May I suggest that some bibliography be included, as it
generally happens with other statistical functions.
I currently use R 2.8.0 running on Windows XP.
2008 Sep 16
1
plotting on the figure margin
Dear R-list members,
I am trying to put a legend just outside the plotting area
of a graph.
1. Is there some way to plot symbols on the figure margin,
in the same way as function "mtext" can write on the
margin?
2. Is there some way to use the "legend" function (or some
equivalent function) to plot a legend on the figure margin?
3. Any other way to plot either symbols or a
2006 Aug 08
1
parameter yaxs / function hist (graphics)
Dear R users,
The parameters xaxs and yaxs (function par, package graphics)
seem not to work with the function hist (package graphics),
even when the parameters xlim and ylim are defined.
Is there any way to make yaxs="i" and xaxs="i" work properly
with the function hist, mainly to produce histograms that
"touch" the horizontal axis? The R documentation and the
R
2010 Apr 22
1
packages gdata / gtools - installation in R 2.11.0
Dear R-list members,
I have just downloaded R version 2.11.0. Then I installed
package gdata. At the end of the installation, a warning message
said that package gtools could not be found. Package gdata
was, after the installation, included in the "Package Index"
in the help files. Messages during installation (which was made
through the menu Packages / Instal package(s), choosing the
2006 Nov 22
3
saving graphics in jpeg format
Dear R users,
I need to save a graph in jpeg format. After plotting the graph,
when the graphics window is active, in the File menu, the
Save as / Jpeg / 100% quality correctly saves the graph in jpeg format.
But I would like to know, how could I control the resolution (in dpi)
of the saved jpeg file? I need to produce a jpeg at 1200 dpi.
I have tried also the jpeg function in the package
2010 Jul 03
2
logistic regression - glm() - example in Dalgaard's book ISwR
Dear R-list members,
I would like to pose a question about the use and results
of the glm() function for logistic regression calculations.
The question is based on an example provided on p. 229
in P. Dalgaard, Introductory Statistics with R, 2nd. edition,
Springer, 2008. By means of this example, I was trying to
practice the different ways of entering data in glm().
In his book, Dalgaard
2008 Jun 30
4
Problem reading a CSV
Hi,
I have a CSV file where each row has at least 20 columns and some rows have up
to 30 columns of data. When I use the command,
Pathways<-read.table('MetaCycSample3.csv',sep=',',header=FALSE,quote='"')
anything past the 21st column gets kicked down to a new row. How can I fix this?
Thanks,
-Nina
2008 Jul 20
4
drawing segments through points with pch=1
Please excuse me for asking such basic questions:
Here is my code
> y=c(1.21,0.51,0.14,1.62,-0.8,0.72,-1.71,0.84,0.02,-0.12)
> ybar=mean(y)
> ll=length(y);
> ybarv=rep(ybar,ll)
> x=1:ll
> plot(x,ybarv,pch=1)
> segments(x[1],ybar,x[ll],ybar)
What I get is a collection of small circles, with a segment "on top"
of the circles, which is almost what I want. But I
2010 Oct 17
0
R 2.12 How many downloads
A general question- and excuse me if you find it irrelevant
Are you tracking how many people finally download a specific R version by
counting the number of downloads through log/ analytics software like GA
etc?
If so- can we see some numbers
Ajay
Websites-
http://decisionstats.com
http://dudeofdata.com
Linkedin- www.linkedin.com/in/ajayohri
2008 Jul 20
0
coin package (conditional inference / permutation): parameter teststat
Dear R-list members,
This is in fact a question about statistics, not directly
about the R software.
The coin package, for conditional inference through permutation
methods, has as it main function the function independence_test.
One of its parameters is teststat, about which the package
documentation says:
teststat: "a character, the type of test statistic to be applied:
either a
2010 Jul 27
0
gam (package gam) - diagonal of smoother matrix
Dear R-list members,
Once a gam (package gam) model has been fitted with family=poisson,
is there some R function that could extract the diagonal elements
of the smoother matrix S, to be used in a cross-validation for the
selection of the best smoothing parameter, following equation 3.19
on page 48 of the book T.J. Hastie and R.J. Tibshirani, Generalized
Additive Models, Chapman and Hall/CRC,
2009 Feb 24
0
data file - function write.fwf - library gdata
Dear R-list members,
I have a data file with thousands of lines (cases), where each line
contains the values of several variables. I would like to separate
these lines in small groups, with each group followed by a blank
line, to ease the visual inspection of the data in some situations.
I am writing the output files with function write.fwf in library
gdata, for correct column alignment.
Below
2003 Mar 22
0
VIAGEM DANÇANTE AO RIO DE JANEIRO
TURISMO & EVENTOS
Luiz Guilherme 3031-7374 e Marcio Sorriso 9887-9141 S?o Paulo -SP
Em abril, M?rcio Sorriso e Luiz Guilherme promover?o uma inesquec?vel
viagem ? cidade maravilhosa. Ser? mais uma oportunidade para voc?
divertir-se conhecer ou rever lugares maravilhosos, fazer novos amigos e ?
claro, dan?ar e dan?ar... Muito! Voc? n?o pode deixar de participar. Leia
a
2007 May 03
0
unscrible pls
On 5/2/07, r-help-request@stat.math.ethz.ch <
r-help-request@stat.math.ethz.ch> wrote:
>
> Send R-help mailing list submissions to
> r-help@stat.math.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://stat.ethz.ch/mailman/listinfo/r-help
> or, via email, send a message with subject or body 'help' to
>
2007 Dec 09
2
adjusting "levels" after subset a table
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071208/5409f1a7/attachment.pl
2009 Jan 09
5
The R Inferno
"The R Inferno" is now on the Burns Statistics website at
http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
Abstract: If you are using R and you think you're in hell,
this is a map for you.
Also, I've expanded the outline concerning R on the
Burns Statistics 'Links' page. Suggestions (off-list) for
additional items are encouraged.
Patrick Burns
patrick at
2018 Nov 21
2
Subsetting row in single column matrix drops names in resulting vector
Hello here. I'm struggling to understand R's subsetting behavior in couple
of edge cases - subsetting row in a single column matrix and subsetting
column in a single row matrix. I've read R's docs several times and haven't
found answer.
Consider following example:
a = matrix(1:2, nrow = 2, dimnames = list(c("row1", "row2"), c("col1")))
a[1, ]
# 1