Displaying 20 results from an estimated 1000 matches similar to: "vectorizing test for equality"
2003 Apr 02
19
Combining the components of a character vector
Dear Help,
Suppose I have a character vector.
x <- c("Bob", "loves", "Sally")
I want to combine it into a single string: "Bob loves Sally" .
paste(x) yields:
paste(x)
[1] "Bob" "loves" "Sally"
The following function combines the character vector into a string in the
way that I want, but it seems somewhat inelegant.
2002 Apr 23
3
Subsetting by a logical condition and NA's
I have run into a general problem with subsetting of which the following
is a simple example. Suppose that
x <- c(5, NA, 7, 5, NA, 3)
y <- c(1, 2, 3, 4, 5, 6)
I want to extract the values of y for which x = 5, but y[x==5] yields
> y[x==5]
[1] 1 NA 4 NA
I find that y[!is.na(x) & x==5] yields the desired result:
> y[!is.na(x) & x==5]
[1] 1 4
but I am wondering whether
2003 Mar 22
1
extracting the names of the dataframe and variables in aov or lm
Dear R Users,
I want to write a function that applies to the dataframe and variables
that were used in a previous call to lm or aov. In order to do this, I
need to write a function that applies to the output of lm or aov, and
yields the names of the dataframe and variables that were used in the lm
or aov analysis.
For example, suppose that I give the command:
aov.out <- aov( Rt ~
2006 Feb 24
2
converting character matrix to a dataframe
Dear R-Help,
Suppose I have a character matrix, e.g.,
(ch.mat <- matrix(c('a','s','*','f','w','*','k','*','*','f','i','o'),
ncol=3))
When I convert 'ch.mat' to a dataframe, the columns are converted to
factors:
(d1 <- data.frame(ch.mat))
mode(d1[,1])
is.factor(d1[,1])
To prevent
2001 Oct 31
3
t.test
Dear R-users,
I am learning to use R 1.3.1 on a Pentium running Windows '98. I'm
puzzled that several statistical procedures, t.test and chisq.test, do not
appear to be available on R version 1.3.1. For example, if I type
"t.test", I get the reply, "Object "t.test" not found". Is there a
package that I have to load in order to have access to these
2002 Dec 22
4
pasting "\" into character strings
Dear R-Help,
I'm using R version 1.6.0 on a Windows computer. I am trying to create
a function that, among other things, constructs strings that refer to
Windows files, e.g., I might want to construct a string like
'c:\work\part1.txt'. I have found that the following does not work.
> paste("c:", "\", "work", "\", "part1.txt",
2002 Apr 19
4
Multidimensional scaling
A student of mine wants to use R to do some nonmetric multidimensional
scaling. According to the R FAQ, there's a package called pcurve that
computes multidimensional scaling solutions, but I was not able to locate
it the contrib page (I am a Windows user with R version 1.4.1). Can
anyone tell me whether it is possible to do nonmetric multidimensional
scaling with R, and if so, how?
John
2003 Feb 07
2
My remark on libraries
Hi R community,
These days, I am writing some functions to work with 2-ways frequency
tables ; you know all this tuff about measures of association: Chisq and
derived (phi, cramer's v), tau b, tau c, somer's d and so on.
So I consider all those functions could be gathered in a single R file, as
they are coherent and dealing with the same problem / objective (analysis
of crosstables).
2002 Oct 02
4
Introduction of NA:s
Hello,
I wonder if someone could help me with the following: I have generated 10 000 values from rnorm and now I want to randomly replace 500 of those with NA. The problem is that values indexed between 6-10,16-20,26-30.... only should be considered for replacement. Any suggestions?
Patrik Waldmann
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing
2002 Oct 10
2
Environment variables under Windows
Greetings,
I have a question pertaining to the concept of "environment variables"
that is mentioned in the R documentation for "Startup" and also in the
discussion of the Windows configuration of R in the recent book "An
Introduction to R" authored by Venables, Smith, and the R Development Core
Team (referred to as VS in this message).
The Startup documentation and
2003 Oct 14
0
Job notice at the University of Washington
UNIVERSITY OF WASHINGTON
FACULTY POSITION IN QUANTITATIVE PSYCHOLOGY
The Department of Psychology seeks to fill a position in Quantitative
Psychology at the tenure-track assistant professor level. In exceptional
circumstances, appointment at the Associate Professor or Professor level
may be considered for candidates who offer extraordinary opportunities to
further the University's
2002 Apr 23
0
Summary: Multidimensional scaling
I sent a query to R-Help about the availability of nonmetric
multidimensional scaling (MDS) algorithms in R. I would like to thank
Tony Rossini, Jonathan Baron, Sundar Dorai-Raj, and Brian Ripley for
helpful replies. The gist of the replies is that isoMDS in the MASS
library provides Kruskal's method for nonmetric MDS, sammon in the MASS
library provides Sammon's nonlinear mapping method
2004 Apr 05
0
studentized deleted residuals and NA's
Dear R-Help,
I am using the studres function from the MASS package to compute
studentized deleted residuals in a oneway anova. I'm having trouble
interpreting the results in situations where a factor level has only one
observation. Sometimes studres yields an NaN and sometimes it produces a
numeric value for cases where a factor level has only one observation. I
would think it should
2002 Aug 06
1
Using Tcl/Tk on Windows
Hello,
I would like to try Tcl/Tk library on Windows.
I installed ActiveTCL 8.3.4.3 and add the environment variable TCL_LIBRARY
linking to the directory of installation.
When I load the Tcl/Tk package, I have the following error:
+--------------------------------------------------------------+
Error in firstlib(which.lib.loc, package) :
Can't find a usable init.tcl in the
2002 Oct 17
0
RE: R2HTML package for R 1.6
Does this help on our backtest reporting?
Regards,
Gordon Morrison
Global Head of Quantitative Research
> * + 44 20 7653 7642
> Mob: + 44 7867 801951
> fax: + 44 20 7645 7442
> * mailto:gordon.morrison at commerzbankib.com
> web: http://www.cbksec.com/research/quant
> * Commerzbank Securities
> 60 Gracechurch Street
> London EC3V 0HR, U.K.
>
2002 Oct 15
0
R2HTML package for R 1.6
Hello R communauty,
I have submitted to CRAN the package R2HTML.
The purpose of this package is twice:
- provide base HTML exportation functions. Basically, you will use them
exactly as a print function (or a cat(...file=)). Thus, making dynamic HTML
reports is possible.
- making live HTML output with frames and command, which is very usefull
for teaching purpose, as the student can keep a
2003 Mar 28
0
the chi-square test for trend / Correction
Hi (again),
Please find here a correction of the function I send previously
---------------------------------------------------------
tableChisqMH=function(x)
{
n=sum(x)
G2=(n-1)*(tablepearson(x)$estimate^2)
dll=1
p.value=1-pchisq(G2,dll)
out=list(estimate=G2,dll=dll,p.value=p.value,dim=dim(x),name="Mantel-Haenszel
Chi-square")
return(out)
}
2004 Jan 20
3
Changing workspace from within an R session
Hello R-users,
is it possible to navigate from one workspace to the other from within an R
session or does one has to close R and restart it from the directory where
resides the desired workspace?
For example from Splus I have this little function, see at the end, which I
used all the time to navigate between valid Splus directories. I find this
particularly usefull when I develop new
2002 Dec 11
1
residuals: lm and glm
Dear list members,
I would like to know the difference in outputs and calculation processes
between residuals.glm(object, type="response") and residuals.lm(object).
For above-ground biomass estimation of trees, I estimated parameters of
an allometric equation (ln y = b0 + b1*ln x) using glm as follows:
fm <- glm(Ws~log(Wb), family=quasi(link="log",
2003 Dec 18
3
Summaries
Hello UseRs:
Excuses for my english.
I have a dataset with 65000 records and I'd like to make a summary where I
can view all the values (with the number of times that it repeats) that
there are each column of my dataset.
I tried with summary( ), str( ), but nothing gives me the result that I am
loking for.
Thank you very much.