Displaying 20 results from an estimated 10000 matches similar to: "Combining the components of a character vector"
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
2002 Dec 20
2
vectorizing test for equality
Dear R Help,
I am trying to create a boolean vector that is TRUE whenever a
particular value occurs in a numeric vector, and FALSE otherwise. For
example, suppose that
> y <- c(5, 2, 4, 3, 1)
> y
[1] 5 2 4 3 1
and suppose that I want to find where 3 occurs in y. Then, the following
yields the solution:
> y == 3
[1] FALSE FALSE FALSE TRUE FALSE
My problem arises when the
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
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 ~
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 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
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 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
2016 Apr 20
0
Data reshaping with conditions
Hi sri,
As your problem involves a few logical steps, I found it easier to
approach it in a stepwise way. Perhaps there are more elegant ways to
accomplish this.
svdat<-read.table(text="Count id name type
117 335 sally A
19 335 sally A
167 335 sally B
18 340 susan A
56 340 susan A
22 340 susan B
53 340 susan B
135 351 lee A
114 351 lee A
84 351 lee A
80 351 lee A
19 351 lee A
8 351 lee A
2016 Apr 20
2
Data reshaping with conditions
Dear All,
I am trying to reshape the data with some conditions. A small part of the
data looks like below. Like this there will be more data with repeating ID.
Count id name type
117 335 sally A
19 335 sally A
167 335 sally B
18 340 susan A
56 340 susan A
22 340 susan B
53 340 susan B
135 351 lee A
114 351 lee A
84 351 lee A
80 351 lee A
19 351 lee A
8 351 lee A
21 351 lee A
88 351 lee B
111 351
2016 Apr 21
2
Data reshaping with conditions
Hi Jim,
Thanks for your time. But somehow this code did not help me to achieve my
expected output.
Problems: 1) x, y are coming as logical rather than values as I mentioned
in my post
2) The values that I get for Max A and Max B not correct
3) It looks like a pretty big data, but I just need to
concatenate the values with a comma, the final output will be a character
2002 Sep 24
4
extracting elements from summary(aov object)
Hello. When one types "summary(fit)", where fit is an object from a call
to aov(), one gets an ANOVA table. I want to save just one element of this
summary. How does one extract this?
As an example, here is my output from a split plot ANOVA:
> summary(out)$"Error: soil.cores$block:soil.cores$treatment"
Df Sum Sq Mean Sq F value Pr(>F)
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
2003 Jan 27
1
more info - NT_STATUS_ACCESS_DENIED opening remote file
Thanks to those who had suggestions on my last post, but none of those seems to have worked. I have narrowed down the problem a bit though, seems users can't write to a share that is not their primary group. For example: Bob's primary group is Bob and secondary group is Sally. Bob can write to the Bob group share but not the Sally group share. Anymore thoughts/suggestions. Thanks
2010 Jan 10
1
scatterplot matrix with ggplot2
#I would like to use the below data to make a scatter plot matrix with
#code similar to that below the data
#conceptually this is the right approach I think
#thanks in advance
melt.gg <- structure(list(stream = c("Bonham Lower", "Bonham Lower",
"Bonham Lower",
"Bonham Lower", "Bonham Lower", "Bonham Lower", "Bonham Lower",
2009 Mar 11
3
Converting a dataframe to a matrix
If I have a dataframe which is organized like this:
name color likes?
1 sally red 0
2 sally blue 1
3 sally green 1
4 jake red 0
5 jake blue 1
6 jake green 1
7 tom red 1
8 tom blue 0
9 tom green 0
And I want to create a matrix in the form:
red blue green
sally 0 1 1
jake 0 1 1
tom 1 0 0
Are there any built-in
2012 Apr 28
2
Segmentation Fault when Starting domUs
Hello everyone,
I just put together a brand new system, and I''m getting the following
when I try to start a domU:
> [ 1902.049066] xend[12924]: segfault at b9ff6cd8 ip 00007f36c474afe1 sp 00007f36b9ff6af8 error 4 in libxenguest.so.4.0.0[7f36c4730000+24000]
This is on an AMD CPU with the AVX instructions, and I already have
this in my grub.cfg:
> multiboot /xen-4.1.2.gz