Hi all
Both \\b and $ do the job. Thanks.
> x<-c("abc","def","rst","xyz","age","age2")
> x
[1] "abc" "def" "rst" "xyz" "age" "age2"
> grep("age2\\b",x)
[1] 6
> grep("age\\b",x)
[1] 5
> grep("age2$",x)
[1] 6
> grep("age$",x)
[1]
From: Jim Lemon
Date: Wed, May 4, 2016 at 2:19 AM
Subject: Re:
Hi All,
Hi Carl,
I am not sure if this is useful to you, but I followed your conversation
and thought of you when I read this:
for (i in 1:ncol(dataset)) {
if(class(dataset) == "character|numeric|factor|or whatsoever") {
dataset[, i] <- as.factor(dataset[, i])
}
}
Source: Zumel, Nina / M
This is actually a bit subtle -- you need to carefully read the Help
pages to see what's happening. Here's the explanation to the best of
my understanding (corrections happily accepted if I've got it wrong!).
First, let's simplify:
> z <- data.frame(a = 1:2, b = list(a = letters[1:2], b = letters
> On May 3, 2016, at 4:13 PM, Yasir Suhail wrote:
>
> Dear R developers and users,
>
> Consider the object :
>
>> a <- data.frame(a=c(1,2), b=c(2,3), c=c("a,b","c,d"), stringsAsFactors = F)
>> a$c <- strsplit(a$c, ",")
>
> Re-assignment works fine for columns 1 and 2, but fails for column 3.
Hi Steven,
grep uses regex... so you can use this:
-grep("age$",x): it says: match "a", then "g", then "e" and stop. The "$"
menas until here and no more.
> grep("age$",x)
[1] 5
2016-05-04 1:02 GMT-05:00 Jim Lemon :
> Hi Steven,
> If this is just a one-off, you could do this:
>
> grepl("age",
Hi Steven,
If this is just a one-off, you could do this:
grepl("age",x) & nchar(x)<4
returning a logical vector containing TRUE for "age" but not "age2"
Jim
On Wed, May 4, 2016 at 3:45 PM, Steven Yen wrote:
> Dear all
> In the grep command below, is there a way to identify only "age" and
> no
Dear all
In the grep command below, is there a way to identify only "age" and
not "age2"? In other words, I like to greb "age" and "age2"
separately, one at a time. Thanks.
x<-c("abc","def","rst","xyz","age","age2")
x
[1] "abc" "def" "rst" "xyz" "age" "age2"
grep("age2",x)
[1] 6
grep("age
Hello,
I have the following code:
http://pastebin.ca/3590201
What I'm trying to do is to create a hash map where the key is two
characters and
that maps to a structure of some information. The problem with the above
example
is that the first two keys match to the first instance of c('hello', 0),
> On May 3, 2016, at 4:13 PM, Yasir Suhail wrote:
>
> Dear R developers and users,
>
> Consider the object :
>
>> a <- data.frame(a=c(1,2), b=c(2,3), c=c("a,b","c,d"), stringsAsFactors = F)
>> a$c <- strsplit(a$c, ",")
You are the one who should "consider the object". Look at what strsplit(a$
Hi Yasil,
If you look at what happens to a[,3] after the "strsplit" it is easy:
> a[,3]
[1] "a,b" "c,d"
Here a[,3] is two strings
a$c <- strsplit(a$c, ",")
> a[,3]
[[1]]
[1] "a" "b"
[[2]]
[1] "c" "d"
Now a[,3] is a two element list. What R probably did was to take the
first component of a[,3]
Thanks for remembering me to cc him!
Thomas Lumley is the package maintainer, and he frequently answers
questions in this list, but it is obviously hard for anyone to keep up
with so many emails.
Att,
Leonardo Ferreira Fontenelle
http://lattes.cnpq.br/9234772336296638
Em Ter 3 mai. 2016, às 21
Dear R developers and users,
Consider the object :
> a <- data.frame(a=c(1,2), b=c(2,3), c=c("a,b","c,d"), stringsAsFactors = F)
> a$c <- strsplit(a$c, ",")
Re-assignment works fine for columns 1 and 2, but fails for column 3. If a
is a valid object, the assignment should work.
> a[,1] <- a[,1]
Your question is a mixture of statistical and implementation (package) issues.
This isn't really the right forum for "what is the statistically-correct
answer" questions, and as to whether the package is correct or you are using it
right would require someone familiar with that particular CONTRI
On 30/04/2016 1:48 PM, T.Riedle wrote:
Dear R users,
I am trying to generate a 3D surface plot given the inflator formula in the
attached file.
Now, I want to create a 3D plot showing how Delta changes with the values of
Abs(B) and sigma. The other variables in the formula are constant. Delta
Is there something I could do to improve my chances of getting an
answer?
Leonardo Ferreira Fontenelle
http://lattes.cnpq.br/9234772336296638
Em Sex 29 abr. 2016, às 23:40, Leonardo Ferreira Fontenelle escreveu:
> Hello!
>
> I'd like to create an assets-based economic indicator using data from a
There are some packages that add labels or other attributes (units) to
columns of data frames and have methods to display the labels, units,
etc. One of these packages is Hmisc, see the label and unit
functions. I believe that there are other packages as well. This may
provide what the original
Good day,
I was performing a power analysis of articles published in a journal of
management using the pwr package in R. However, it seemed to be impossible to
compute power for small, medium and large Effect Size for multiple ordinal
logistic regression output. I have tried using G*power, but i
On 05/03/2016 06:05 AM, Jeff Newmiller wrote:
Isn't that just an inefficient way to do
"age" == x
Yep, it's an inefficient way to do which(x == "age").
H.
?
--
Hervé Pagès
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fa
The following base R code does roughly what Bert suggests. It does
no checking that the data is in the format you describe. The
split-by-cumsum
trick is a handy idiom.
# lines <- readLines(yourFile), or, for this example:
lines <- c("#One","X Y Z","1 2 3","4 5 6","",
"#Two", "X Y
See if you can use is.nan() to figure out which values of B, Bmax, ...,
cause
the result to be NaN (not a number). One possibility is if B were always
negative so abs(B)/max(B) could be negative: (negative)^(non-integer power)
is NaN.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, May 3, 2
One approach would be to use ?readLines to read the lines into a
character vector. You could then use indexing to remove all the blank
and header (lines beginning with "image") lines. You can now find the
indices of where the separate data blocks begin (they all begin with
"#", right?) and then seq
> On May 3, 2016, at 3:54 AM, T.Riedle wrote:
>
> Something is wrong here. The formula
>
> pmin(psi/VaR,exp(((abs(B)/Bmax)^w2)*log((psi/VaR),2.718182)))
>
>
> provides a time series. Nevertheless, the returned values are incorrect and
> it produces NANs.
The only thing we can conclude at th
Dear R Users,
Poznan University of Economics and Business, Poznan University of Life Sciences
and Polish R Users groups are organising international conference European R
Users Meeting (eRum 2016)!
eRum 2016 will take place between October 12th and 14th, and we already have
confirmed invited s
Dear all,
I have a .txt file which contains multiple tables and I would like to read
these tables separately in order to create graphs for each one.
The tables are separated by a blank line, have a variable number of lines,
fixed nr. Of rows, have a header and a comment above the header (#) which
Isn't that just an inefficient way to do
"age" == x
?
--
Sent from my phone. Please excuse my brevity.
On May 3, 2016 3:57:05 AM PDT, Ivan Calandra
wrote:
>What about?
>
>grep("^age$", x)
>
>Ivan
>
>--
>Ivan Calandra, PhD
>Scientific Mediator
>University of Reims Champagne-Ardenne
>GEGENAA -
Oh, and regarding the moderator approval, I guess it's because you're a
new user to the list.
Ivan
--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.
What about?
grep("^age$", x)
Ivan
--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calan...@univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://
Something is wrong here. The formula
pmin(psi/VaR,exp(((abs(B)/Bmax)^w2)*log((psi/VaR),2.718182)))
provides a time series. Nevertheless, the returned values are incorrect and it
produces NANs.
From: William Dunlap
Sent: 02 May 2016 20:04
To: T.Riedle
Cc: r-h
Dear all
In the grep command below, is there a way to identify only "age" and
not "age2"? Thanks.
> x<-c("abc","def","rst","xyz","age","age2")
> x
[1] "abc" "def" "rst" "xyz" "age" "age2"
> grep("age2",x)
[1] 6
> grep("age",x) # I need to grab "age" only, not "age2"
[1] 5 6
Also, I post mess
The build system rolled up R-3.3.0.tar.gz (codename "Supposedly Educational")
this morning.
The list below details the changes in this release.
You can get the source code from
http://cran.r-project.org/src/base/R-3/R-3.3.0.tar.gz
or wait for it to be mirrored at a CRAN site nearer to you.
Bi
Not sure this is what you need or the best way to do it, but you could
do something along these lines:
#first create a file name that depends on which file names already
exist. The big thing here is list.files() but you probably need to adapt
the rest to your needs:
fileNumber <- list.files(p
I'm not sure what you are trying to do...
Have you checked what the output of d[c("b","c")] is? And what about the
output of identical(d[c("b","c")],c(4,10)) ? As is, I don't see the
point of going through identical(). Maybe you're looking for which() or
"%in%"?
If you just want to subset th
32 matches
Mail list logo