Hello,
Inline.
Às 23:29 de 16/12/21, Bert Gunter escreveu:
Not sure what you mean by this:
"But this only works if the vectors xr* are longer than xs*."
The solution I gave doesn't care about this.
a <- rbind(unique(z2),unique(z1))
a[duplicated(a),]
xs1 xs2
## as before
Presumably
Not sure what you mean by this:
"But this only works if the vectors xr* are longer than xs*."
The solution I gave doesn't care about this.
> a <- rbind(unique(z2),unique(z1))
> a[duplicated(a),]
xs1 xs2
## as before
Presumably you are referring to your use of match() (which is how %in%
is
Wow! These are awesome! Thanks so much for the special cases!
Erin
On Thu, Dec 16, 2021 at 3:52 PM Rui Barradas wrote:
> Hello,
>
> And here is another solution, addressing the problem raised by Bert and
> avoiding unique.
>
>
> xr1 <- 8:0
> xr2 <- 0:8
> xs1 <- 9:3
> xs2 <- 4
> cbind(xr1,
Hello,
And here is another solution, addressing the problem raised by Bert and
avoiding unique.
xr1 <- 8:0
xr2 <- 0:8
xs1 <- 9:3
xs2 <- 4
cbind(xr1, xr2)[(xr1 %in% xs1) & (xr2 %in% xs2),]
#xr1 xr2
# 4 4
xr1 <- c(1,2,1)
xr2 <- c(4,5,4)
xs1 <- c(6,6)
xs2 <- c(7,7)
cbind(xr1, xr2)[(xr1
I am not sure Eric's solution is what is wanted:
Consider:
xr1 <- c(1,2,1)
xr2 <- c(4,5,4)
xs1 <- c(6,6)
xs2 <- c(7,7)
> z1 <- cbind(xr1, xr2)
> z2 <- cbind(xs1,xs2)
> z1
xr1 xr2
[1,] 1 4
[2,] 2 5
[3,] 1 4
> z2
xs1 xs2
[1,] 6 7
[2,] 6 7
If what is wanted is to find
> a <- cbind(c(xr1,xs1),c(xr2,xs2))
> a[duplicated(a)]
[1] 4 4
On Thu, Dec 16, 2021 at 10:18 PM Erin Hodgess wrote:
>
> Hello!
>
> I have the following:
>
> cbind(xr1,xr2)
>
> xr1 xr2
>
> [1,] 8 0
>
> [2,] 7 1
>
> [3,] 6 2
>
> [4,] 5 3
>
> [5,] 4 4
>
> [6,] 3
Hello!
I have the following:
cbind(xr1,xr2)
xr1 xr2
[1,] 8 0
[2,] 7 1
[3,] 6 2
[4,] 5 3
[5,] 4 4
[6,] 3 5
[7,] 2 6
[8,] 1 7
[9,] 0 8
> cbind(xs1,xs2)
xs1 xs2
[1,] 9 4
[2,] 8 4
[3,] 7 4
[4,] 6 4
[5,] 5 4
;>
>>
>> "[\x22\x27\x2c\x3f\x5c\x5c\x60]"
>>
>>
>> This seems to be escaping the backslash in the R script rather than in
>> the data - which confuses me.
>>
>>
>> From: Bert Gunter
c\x3f\x5c\x5c\x60]"
>
>
>This seems to be escaping the backslash in the R script rather than in
>the data - which confuses me.
>
>
>From: Bert Gunter
>Sent: Wednesday, 26 August 2020 4:26 AM
>To: Peter Bishop
>Cc: r-help@r-pr
x3f\x5c\x5c\x60]"
This seems to be escaping the backslash in the R script rather than in the data
- which confuses me.
From: Bert Gunter
Sent: Wednesday, 26 August 2020 4:26 AM
To: Peter Bishop
Cc: r-help@r-project.org
Subject: Re: [R] Matching backslash in a ta
1. I am far from an expert on such matters
2. It is unclear to me what your input is -- I assume a file.
The problem, as you indicate, is that R's parser sees "\B" as an incorrect
escape character, so, for example:
> cat("\B")
Error: '\B' is an unrecognized escape in character string starting
In SQL, I'm using R as a way to filter data based on:
- 20 characters in the range to
- excluding , , , , ,
Given a SQL column containing the data:
code
A\BCDEFG
and the T-SQL script:
EXEC [sys].[sp_execute_external_script]
@language=N'R',
On 2020-04-10 19:05 -0500, Ana Marija wrote:
> I am not sure what I am suppose to run
> from your codes. Can you just send me
> lines of codes which I should run?
> (without part where you are loading
> your data frames) (assuming my files
> are as I showed them)
Dear Ana,
try these lines:
I am not sure what I am suppose to run from your codes.
Can you just send me lines of codes which I should run? (without part
where you are loading your data frames)
(assuming my files are as I showed them)
Or the whole idea was to remove sep=" " from everywhere?
On Fri, Apr 10, 2020 at 7:01 PM
On 2020-04-10 18:46 -0500, Ana Marija wrote:
> so if I understand correctly you would just remove sep=" " from my codes?
>
> Thank you so much for working on this.
> Is there is any chance you can change my original code (pasted bellow)
> with changes you think should work?
>
>
so if I understand correctly you would just remove sep=" " from my codes?
Thank you so much for working on this.
Is there is any chance you can change my original code (pasted bellow)
with changes you think should work?
library(SNPRelate)
# get PLINK output
plink.genome <-
On 2020-04-10 17:05 -0500, Ana Marija wrote:
> it didn't work unfortunately with your
> example:
>
> > plink.genome[idx,]
> character(0)
Hi! Perhaps csv formatting are better
suited for these emails ... the two
ibdlist lines I added still matches in
this example, added lookup for kinship
it didn't work unfortunately with your example:
> plink.genome[idx,]
character(0)
here is my whole:
plink.genome <- read.table("plink.genome", header=TRUE)
FID1 IID1 FID2 IID2 RTEZ Z0 Z1 Z2
PI_HAT PHE DST PPC RATIOIBS0IBS1IBS2 HOMHOM
On 2020-04-10 15:38 -0500, Ana Marija wrote:
| Hi,
|
| I have this code:
Dear Ana,
none of the ID tuples in the head
outputs you provided matches, so I added
two lines in ibdlist that matches up;
perhaps if you provided more lines that
would have matched in a pastebin
somewhere ...
Hi,
I have this code:
library(SNPRelate)
# get PLINK output
plink.genome <- read.table("plink.genome", header=TRUE)
> head(plink.genome)
FID1 IID1FID2 IID2 RT EZ Z0 Z1 Z2 PI_HAT PHE DST
1 fam1054 G1054 fam1054 G700 OT 0 0.0045 0.9938 0.0017 0.4986 -1 0.839150
2
Hello,
That's a floating-point issue.
See FAQ 7.31.
See also [1], [2] and the links therein.
[1]
https://stackoverflow.com/questions/9508518/why-are-these-numbers-not-equal
[2] https://stackoverflow.com/questions/588004/is-floating-point-math-broken
Hope this helps,
Rui Barradas
Às 10:00
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible
Here is another approach, just for fun:
library(tidyverse)
library(tokenizers)
anyall <- function(x, # a character vector
terms # a list of character vectors
){
any(map_lgl(terms, function(term) {
all(term %in% x)
}))
}
mutate(th,
Sorry. Typo. The last line should be:
ans$Result <- apply(ans,1,function(r)phrasewords[[r[1]]] %allin%
tweets[[r[2]]])
-- Bert
On Thu, Oct 18, 2018 at 7:04 PM Bert Gunter wrote:
> All (especially Nathan): **Please feel free to ignore this post without
> response.** It just represents a bit
All (especially Nathan): **Please feel free to ignore this post without
response.** It just represents a bit of OCD-ness on my part that may or may
not be of interest to anyone else.
Purpose of this post: To give an alternative considerably simpler and
considerably faster solution to the problem
If you wish to use R, you need to at least understand its basic data
structures and functionality. Expecting that mimickry of code in special
packages will suffice is, I believe, an illusion. If you haven't already
done so, you should go through a basic R tutorial or two (there are many on
the
I do not have your command of base r, Bert. That is a herculean effort! Here’s
what I spent my night putting together:
## Create search terms
## dput(st)
st <- structure(list(word1 = c("technique", "me", "me", "feel", "feel"
), word2 = c("olympic", "abused", "hurt", "hopeless", "alone"
), word3
OK, as no one else has offered a solution, I'll take a whack at it.
Caveats: This is a brute force attempt using R's basic regular expression
engine. It is inelegant and barely tested, so likely to be at best
incomplete and buggy, and at worst, incorrect. But maybe Nathan or someone
else on the
The problem wasn't the data tibbles. You posted in html -- which you were
explictly warned against -- and that corrupted your text (e.g. some quotes
became "smart quotes", which cannot be properly cut and pasted into R).
Bert
On Tue, Oct 16, 2018 at 2:47 PM Nathan Parsons
wrote:
> Argh! Here
Argh! Here are those two example datasets as data frames (not tibbles).
Sorry again. This apparently is just not my day.
th <- structure(list(status_id = c("x1047841705729306624",
"x1046966595610927105",
"x1047094786610552832", "x1046988542818308097", "x1046934493553221632",
Thanks all for your patience. Here’s a second go that is perhaps more
explicative of what it is I am trying to accomplish (and hopefully in plain
text form)...
I’m using the following packages: tidyverse, purrr, tidytext
I have a number of tweets in the following form:
th <-
Thanks a lot, Herve'. This worked!
On 23 July 2017 at 22:19, Hervé Pagès wrote:
> Hi,
>
> On 07/23/2017 11:43 AM, Davide Piffer wrote:
>>
>> I have a df with a vector v. For each element of the vector, I want to
>> know whether the i-2nd element is the same as the ith
You can compare the elements that make sense to compare, and fill in the ones
that don't make sense to compare yourself using the c function.
Hint: no looping or if function are necessary.
v[ seq( 2, length( v ) ] == v[ seq.int( length( v ) - 2 ) ]
--
Sent from my phone. Please excuse my
Hi,
On 07/23/2017 11:43 AM, Davide Piffer wrote:
I have a df with a vector v. For each element of the vector, I want to
know whether the i-2nd element is the same as the ith element. For
example:
given
v=c(A,C,D,C) the result should be:
FALSE,FALSE,FALSE,TRUE.
I attempted something using
No homework. Just a genuine question
On 23 July 2017 at 22:00, Bert Gunter wrote:
> Homework?? There is a no homework policy on this list.
>
> Cheers,
> Bert
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things
Homework?? There is a no homework policy on this list.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sun, Jul 23, 2017 at 11:43 AM, Davide
I have a df with a vector v. For each element of the vector, I want to
know whether the i-2nd element is the same as the ith element. For
example:
given
v=c(A,C,D,C) the result should be:
FALSE,FALSE,FALSE,TRUE.
I attempted something using indexing in a for loop such as (bad,
incorrect example):
merge() may be useful here:
> merge(OriginalData[1:3], TargetValue, by.x="AA1", by.y="AA",
sort=FALSE)[-1]
Value1 Value2 BB Value
1 1 11 B 7
2 3 13 B 7
3 11 21 B 7
4 2 12 B25
5 12 22 B25
6 9 19 B25
7
Like this? (use indexing to avoid explicit loops whenever possible):
## first convert factor columns to character, as David W. suggested
i <- sapply(od,is.factor)
od[i]<- lapply(od[i],as.character)
i <- sapply(tv, is.factor)
tv[i]<- lapply(tv[i],as.character)
## Now use ?match
wh <-
> On May 20, 2017, at 11:23 AM, Christofer Bogaso
> wrote:
>
> Hi again,
>
> Let say I have below 2 data frames.
>
> OriginalData = data.frame('Value1' = 1:12, 'Value2' = 11:22, 'AA1' =
> c('AA4', 'AA3', 'AA4', 'AA1', 'AA2', 'AA1', 'AA6', 'AA6', 'AA3',
> 'AA3',
Hi again,
Let say I have below 2 data frames.
OriginalData = data.frame('Value1' = 1:12, 'Value2' = 11:22, 'AA1' =
c('AA4', 'AA3', 'AA4', 'AA1', 'AA2', 'AA1', 'AA6', 'AA6', 'AA3',
'AA3', 'AA4', 'AA3'), 'Value' = NA)
TargetValue = data.frame('AA' = c('AA1', 'AA2', 'AA3', 'AA4', 'AA5',
'AA6'),
Actually, there was another reason for the function equal() but I
wasn't remembering what.
all.equal doesn't recycle its arguments, just see this example.
equal <- function(x, y, eps = .Machine$double.eps^0.5) abs(x - y) < eps
x <- seq(0, 1, by = 0.2)
x == 0.6
all.equal(x, 0.6)
equal(x, 0.6)
Not exactly, all.equal is much more complete.
It accepts all kinds of objects, not just vectors.
Rui Barradas
Citando Ivan Calandra :
Hi,
Not sure, but it seems that your function equal() is exactly what
all.equal() does, isn't it?
Ivan
--
Ivan Calandra,
Matching 100 to 100.0 or 100.00 or whatever N number of decimales will
always return a TRUE.
The expression your using is correct. A more complete expression would be
kidmomiq[100 == kidmomiq$mom_iq, ].
On Fri, Sep 9, 2016 at 2:01 PM, Matti Viljamaa wrote:
I need to pick
Hi,
Not sure, but it seems that your function equal() is exactly what
all.equal() does, isn't it?
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
Hello,
See FAQ 7.31.
It's irrelevant if you write 100 or 100.0, the values are the same.
The difference would be between 100 (double) and 100L (integer).
To check for equality between floating-point numbers you can use, for
instance, the following function.
equal <- function(x, y, eps =
I need to pick from a dataset those rows that have a double value set to 100.
However since the values in this column are like the following:
[1] 121.11750 89.36188 115.44320 99.44964 92.74571 107.90180
[7] 138.89310 125.14510 81.61953 95.07307 88.57700 94.85971
[13] 88.96280 114.11430
Hi all,
I'm a newbie to R with a question about poLCA. When you run a latent class
analysis in poLCA it generates a value for each respondent giving their
posterior probability of 'belonging' to each latent class. These are stored
as a matrix in the element 'posterior'.
I would like to create a
Thank you all very much!
--
View this message in context:
http://r.789695.n4.nabble.com/matching-strings-in-a-list-tp4709967p4710015.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list -- To
Say I have a list:
[[1]] I like google
[[2]] Hi Google google
[[3]] what's up
and they are tweets. And I want to find out how many tweets mention google
(the answer should be 2).
If I string split and unlist them, then I would get the answer of 3. How do
I make sure I get just 2?
--
View
On Jul 16, 2015, at 12:40 PM, tryingtolearn inshi...@ymail.com wrote:
Say I have a list:
[[1]] I like google
[[2]] Hi Google google
[[3]] what's up
and they are tweets. And I want to find out how many tweets mention google
(the answer should be 2).
If I string split and unlist
Why would you strsplit them? I would think
length(grep(google, unlist(x), ignore.case = TRUE))
should do it.
Best,
Ista
On Thu, Jul 16, 2015 at 1:40 PM, tryingtolearn inshi...@ymail.com wrote:
Say I have a list:
[[1]] I like google
[[2]] Hi Google google
[[3]] what's up
and they are
On Thu, Jul 16, 2015 at 12:40 PM, tryingtolearn inshi...@ymail.com wrote:
Say I have a list:
[[1]] I like google
[[2]] Hi Google google
[[3]] what's up
and they are tweets. And I want to find out how many tweets mention google
(the answer should be 2).
If I string split and unlist them,
On Thu, Jul 16, 2015 at 1:00 PM, John McKown john.archie.mck...@gmail.com
wrote:
On Thu, Jul 16, 2015 at 12:40 PM, tryingtolearn inshi...@ymail.com
wrote:
Say I have a list:
[[1]] I like google
[[2]] Hi Google google
[[3]] what's up
and they are tweets. And I want to find out how many
Dear All,
I have a gene list
Genes - c(ACACA, BAX , BCL2, BID, BAX, MAPK9)
and a list of group of genes
ListGroup - list(group1=c(ACACA ,AHSA1 ,AIMP2, AKR1B1,
AKT1, AKT1S1), group2=c(ANXA1 , AR , ARID1A ,
ATM , BAK1 , BAX ), group3=c(BCL2 ,BCL2L1 ,
BCL2L11
On Oct 20, 2014, at 6:28 AM, Karim Mezhoud wrote:
Genes - c(ACACA, BAX , BCL2, BID, BAX, MAPK9)
and a list of group of genes
ListGroup - list(group1=c(ACACA ,AHSA1 ,AIMP2, AKR1B1,
AKT1, AKT1S1), group2=c(ANXA1 , AR , ARID1A ,
ATM , BAK1 , BAX ),
Hi,
Try ?merge() or ?join() from library(plyr)
#Please provide reproducible example.
set.seed(42)
dat1 - data.frame(Stat_Ana=sample(20:30,10,replace=TRUE))
dat2 - data.frame(Stat_Ana=20:30,Group=LETTERS[1:11])
merge(dat1,dat2,by=Stat_Ana)
library(plyr)
join(dat1,dat2,by=Stat_Ana)
A.K.
I
What is a reliable way to go from a column of a model matrix back to the column
(or columns) of the original data source used to make the model
matrix? I can come up with a method that seems to work, but I don't see
guarantees in the documentation that it will.
In particular, does the order
, 2013 8:36 AM
Subject: Re: [R] matching similar character strings
Dear Arun,
thank you so much! The code you suggest captures what we have in mind.
However, what we are looking for is something a bit more general
(sorry: I realised that maybe this was not so clear from the
beginning
:22 AM
Subject: Re: [R] matching similar character strings
Dear Arun,
please excuse me for this late reply, we had to stop working on this
temporaririly.
Let me reproduce here two examples of rows from F1 and F2 (sorry, but
with dput() I am not able to produce a clear example)
F1_ex
Subject: Re: [R] matching similar character strings
Dear Arun,
please excuse me for this late reply, we had to stop working on this
temporaririly.
Let me reproduce here two examples of rows from F1 and F2 (sorry, but
with dput() I am not able to produce a clear example)
F1_ex
: Re: [R] matching similar character strings
Dear Arun,
please excuse me for this late reply, we had to stop working on this
temporaririly.
Let me reproduce here two examples of rows from F1 and F2 (sorry, but
with dput() I am not able to produce a clear example)
F1_ex
Nome.azienda
:08 AM
Subject: Re: [R] matching similar character strings
dear Arun
thank you very much. Let me explain the problem:
Imagine that a portion of the row in F1 is:
F1
1) Street | J.F. Kennedy | 30
it means that our unit
Hello everybody
I have this problem: I need to match an addresses database F1 with the
information contained in a toponymic database F2.
The format of F1 is given by three columns and 800 rows, with the
columns being:
A1. Street/Road/Avenue
A2. Name
A3. Number
Consider for instance Avenue J.
L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77840-4352
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of A M Lavezzi
Sent: Friday, June 21, 2013 4:56 AM
To: r-help
Subject: [R] matching similar
Hello:
How can one match names containing non-English characters that
appear differently in different but related data files? For example, I
have data on Raúl Grijalva, who represents the third district of Arizona
in the US House of Representatives. This first name appears as Raúl
Build a lookup table for your data.
I think it is a fools errand to think that you can automatically normalize
arbitrary Unicode characters to an ASCII form that everyone will agree on.
BTW: To avoid propagating open joins your data should probably have some kind
of id for the term those
On 13/05/2013 12:05 PM, Spencer Graves wrote:
Hello:
How can one match names containing non-English characters that
appear differently in different but related data files? For example, I
have data on Raúl Grijalva, who represents the third district of Arizona
in the US House of
Hi,
It is not that clear.
If VAR1 is a match between columns AB001A, AB0002A, VAR2 between AB001A, AB362
and VAR3 between AB0002A and AB362:
Also, I assume row8 match would be taken as 1.
dat1- read.table(text=
S.No AB001A AB0002A AB362
1 -/- C/C A/A
Hi,
May be this helps:
As you wanted to match only from row3 onwards to row2, the corresponding values
on row1 and row2 were set to NA.
dat1- read.table(text=
S.No AB001A AB0002A AB362
P1 -/- C/C A/A
P2 C/C C/C A/A
3
Just to add:
If your original dataset have only few columns, then you can try this too:
.
- Original Message -
From: jercrowley [hidden
email]/user/SendEmail.jtp?type=nodenode=4664328i=0
To: [hidden email]/user/SendEmail.jtp?type=nodenode=4664328i=1
Cc:
Sent: Monday, April 15, 2013 5:07 PM
Subject: [R] matching multiple fields from a matrix
I have been trying many ways to match 2
I have been trying many ways to match 2 separate fields in a matrix. Here is
a simplified version of the matrix:
site1 depth1 year1 site2 depth2 year2
10 30 1860NA NA NA
NA NA NA 50 30 1860
Basically I am trying to identify the sites
: jercrowley jcrowl...@mtech.edu
To: r-help@r-project.org
Cc:
Sent: Monday, April 15, 2013 5:07 PM
Subject: [R] matching multiple fields from a matrix
I have been trying many ways to match 2 separate fields in a matrix. Here is
a simplified version of the matrix:
site1 depth1 year1 site2
, 2012 6:19 AM
Subject: [R] matching a string with multiple conditions using grep
Suppose I have a vector [A_cont_1, A_cont_12, B_treat_8,
AB_cont_22, cont_21_Aa], I hope I can extract the strings which include
3 short strings, say A, cont and 2, that is to say, A_cont_12,
AB_cont_22
Suppose I have a vector [A_cont_1, A_cont_12, B_treat_8,
AB_cont_22, cont_21_Aa], I hope I can extract the strings which include
3 short strings, say A, cont and 2, that is to say, A_cont_12,
AB_cont_22 and cont_21_Aa will be extract, using a relatively short
code (using grep?).
Would you
Hello,
Try the following.
wanted - c(A_cont_12, AB_cont_22, cont_21_Aa)
x - c(A_cont_1, A_cont_12, B_treat_8, AB_cont_22, cont_21_Aa)
pattern - c(A, cont, 2)
ix - Reduce(``, lapply(pattern, grepl, x)) # This does the trick
identical(wanted, x[ix])
See ?Reduce.
Hope this helps,
Rui
-grep((A){0,1}.*cont.*2,vec1)
vec1[vec2]
[1] A_cont_12 AB_cont_22 cont_21_Aa
A.K.
- Original Message -
From: Zhipeng Wang wa...@kuhp.kyoto-u.ac.jp
To: r-help@r-project.org
Cc:
Sent: Saturday, June 23, 2012 6:19 AM
Subject: [R] matching a string with multiple conditions using
What is the best way to find out what elements/numbers that are in one
object are not in another.
I came up with this method, but I'm wondering if there is a more efficient
way (and one that doesn't seem so clunky).
#Example
id - c(1,2,3,4,5,6,7,9,10)
example.1 - data.frame(id)
#Second
? setdiff
Michael
On May 11, 2012, at 8:50 AM, James Holland holland.ag...@gmail.com wrote:
What is the best way to find out what elements/numbers that are in one
object are not in another.
I came up with this method, but I'm wondering if there is a more efficient
way (and one that
On Wed, Feb 15, 2012 at 08:12:32PM -0500, Gabor Grothendieck wrote:
On Tue, Feb 14, 2012 at 11:17 PM, Redding, Matthew
matthew.redd...@deedi.qld.gov.au wrote:
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm
On 16-02-2012, at 09:01, Petr Savicky wrote:
Hi.
There were several solutions in this thread. Their speed differs
quite significantly. Here is a comparison.
patrn - 1:4
exmpl - sample(1:4, 1, replace=TRUE)
occur1 - function(patrn, exmpl)
{
m - length(patrn)
n -
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple with R, but
I cannot work out how without
resorting to
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 15/02/12 05:17, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives
on this topic -- but as yet have not found a solution. I'm sure
this is pretty simple with R, but I cannot work out how
this is ugly, but...
l -length(patrn)
l2 -length(exmpl)
out - vector(list)
for(i in 1:(l2-l+1))
{
exmpl[i:(i+l-1)]
patrn==exmpl[i:(i+l-1)]
if(all(patrn==exmpl[i:(i+l-1)]))
{ out[[i]] - i } else { out[[i]] - NA}
}
out - do.call(c, out)
as.numeric(out[which(out!=NA)])
## Cheers and
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 15/02/12 05:17, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives
on this topic -- but as yet have not found a solution. I'm sure
this is pretty simple with R, but I cannot work out how
On 15-02-2012, at 05:17, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple with R, but
I cannot work out how without
resorting to ugly nested loops.
On Wed, Feb 15, 2012 at 10:26:44AM +0100, Berend Hasselman wrote:
On 15-02-2012, at 05:17, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple
On 02/14/2012 11:45 PM, Petr Savicky wrote:
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple with R, but I
On Wed, Feb 15, 2012 at 06:27:01AM -0800, Martin Morgan wrote:
On 02/14/2012 11:45 PM, Petr Savicky wrote:
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on
this topic -- but
as yet have not
On 15-02-2012, at 15:27, Martin Morgan wrote:
On 02/14/2012 11:45 PM, Petr Savicky wrote:
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution.
: Thursday, 16 February 2012 1:35 AM
To: Martin Morgan
Cc: r-help@r-project.org
Subject: Re: [R] matching a sequence in a vector?
On 15-02-2012, at 15:27, Martin Morgan wrote:
On 02/14/2012 11:45 PM, Petr Savicky wrote:
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote:
Hi All
[mailto:r-help-boun...@r-project.org] On Behalf Of Berend Hasselman
Sent: Thursday, 16 February 2012 1:35 AM
To: Martin Morgan
Cc: r-help@r-project.org
Subject: Re: [R] matching a sequence in a vector?
On 15-02-2012, at 15:27, Martin Morgan wrote:
On 02/14/2012 11:45 PM, Petr Savicky wrote
On Tue, Feb 14, 2012 at 11:17 PM, Redding, Matthew
matthew.redd...@deedi.qld.gov.au wrote:
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple with R, but
I cannot work out how without
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple with R, but I
cannot work out how without
resorting to ugly nested loops.
As far as I can tell, grep, match, and %in% are not the
On Wed, Feb 15, 2012 at 02:17:35PM +1000, Redding, Matthew wrote:
Hi All,
I've been trawling through the documentation and listserv archives on this
topic -- but
as yet have not found a solution. I'm sure this is pretty simple with R, but
I cannot work out how without
resorting to
Dear R users,
I have a very simple query.
I am using the following command, which should give me row no. for the
matching colnames. It works well for matching the colnames but if there is
no column matching it gives me outcome as integer(0) which I am not able to
use in further calculation. It
Hi. Here is one approach:
if (length(b)0) data[,-b] else data
Andrija
On Thu, Dec 8, 2011 at 1:25 PM, Vikram Bahure economics.vik...@gmail.comwrote:
Dear R users,
I have a very simple query.
I am using the following command, which should give me row no. for the
matching colnames. It
Here's one that is perhaps a little simpler: simply drop the which and
use logical indexing.
dat - matrix(1:6, 2); colnames(dat) - c(A,B,A)
dat[, colnames(dat) %in% A]
dat[, colnames(dat) %in% B] # Note that you may want drop = FALSE
dat[, colnames(dat) %in% C]
dat[, !(colnames(dat) %in% A)] #
I have a spatial weight file in csv that I want as listw object in R.
The file has the following 3 variables (left to right in the file) -- OID_, NID
and WEIGHTS. NID stands for the neighbors and OID_ as the origins. There are
217 origins with 4 neighbors each.
I have been able to read the csv
1 - 100 of 288 matches
Mail list logo