Displaying 20 results from an estimated 10000 matches similar to: "How to count the number of occurence?"
2010 Mar 23
3
If else statements
Hi everyone!
May I request again for your help?
I need to make some codes using if else statements...
Can I do an "if-else statement" inside an "if-else statement"? Is this the
correct form of writing it?
Thank you.=)
Example:
for (v in 1:6) {
for (i in 2:200) {
if (v==1)
(if max(x*v-y*v)>1 break())
if (v==2)
(if max(x*v-y*v)>1.8 break())
if (v==3)
(if
2010 Mar 23
2
Create NA
Hi,
How can I create an NA?
for example, i have this program but it has errors
> x=scan()
1: 1 2 3 4 5
6:
Read 5 items
> "na"*x
Error in "na" * x : non-numeric argument to binary operator
what should I multiply x so that I will get an NA? And I really need to
multiply that with my x vector.
I need this output: (na,na,na,na,na)
Thank you for your time and help!=)
--
2010 Mar 23
3
Summing with NA
Hi all,
May I request for your help if you have time and if you have an idea on how
to do this. I want to add three vectors... And my goal is to obtain the sum
of the vectors, ignoring the vector of "na"...
Here is what i did in R.. I'm adding the three vectors, e,z,k, and my
objective is to get an answer = -23.
I tried putting the na.omit but it did not work. Thanks.
> z
[1]
2005 Nov 27
4
Counting the occurence of each unique "charecter string"
LS,
I would really like to know how to count the frequency/occurrence of chachters inside a dataset. I am working with extreemly large datasets of forest inventory data with a large variety of different species inside it.
Each row inside the dataframe represents one individual tree and the simplified dataframe looks something like this:
num species dbh
1 sp1
2005 Nov 27
4
Counting the occurence of each unique "charecter string"
LS,
I would really like to know how to count the frequency/occurrence of chachters inside a dataset. I am working with extreemly large datasets of forest inventory data with a large variety of different species inside it.
Each row inside the dataframe represents one individual tree and the simplified dataframe looks something like this:
num species dbh
1 sp1
2005 Jan 21
2
Need help to transform data into co-occurence matix
Dear R experts,
I have the data in the following fomat(from some kind of card sorting process)
ID Category Card numbers
1 1 1,2,5
1 2 3,4
2 1 1,2
2 2 3
2 3 4,5
I want to transform this data into two co-occurence matrix (one for each ID)
-- For ID 1
1 2 3 4 5
1 1 1 0 0 1
2 1 1 0 0 1
3 0 0 1 1 0
4 0 0 1 1 0
5 1
2010 Mar 31
6
ODD and EVEN numbers
Hi,
anyone here who knows how to determine if an integer is "odd" or "even" in
R?
Thanks.
tj
--
View this message in context: http://n4.nabble.com/ODD-and-EVEN-numbers-tp1747032p1747032.html
Sent from the R help mailing list archive at Nabble.com.
2008 Jul 26
4
parametric bootstrap
Hi
I am trying to find a parametric bootstrap confidence interval and when I used the boot function I get zero bias and zero st.error? What could be my mistake?
Thank you and take care.
Laila
[[alternative HTML version deleted]]
2010 Oct 14
1
rbind ing matrices and resetting column numbers
Sorry for the verbose example. I want to row bind two matrices, and all works except I want the column labelled "row" to be sequential in the new matrix, shown as "mat3" here, i.e. needs to be 1:6 and not 1:3 repeated twice. Any suggestions?
Thanks
J
> colnm1 <- c("row","ti","counti")
> colnm2 <-
2012 Mar 16
3
Cosinor
Hola, ¿qué tal?:
Tengo la siguiente duda:
Para el caso del Cosinor Simple:
Y = M + A * cos(2*pi*t/T + phi) + error
Cuando T conocido, podemos asumir:
Y = M + beta * X1 + gamma * X2 + error,
siendo X1 = cos(2*pi*t/T) y X2 = sin(2*pi*t/T)
En este caso (Cosinor simple) el modelado lo llevo a cabo del siguiente modo:
lm( y ~ X1 + X2)
Para el caso de componentes múltiples:
Y = M + ?Aj *
2007 May 11
1
Cannot use an escape character in regexp
Given the string
> mystr <- "(Preconsuntivo del giorno gas 10 maggio
2007)Tj"
I'm trying to detect and eliminate the string ")Tj" at the
very end of mystr by means of
gsub(rx2,"",mystr) BUT preparing the
matching regexp string a warning pops up
> rx2 <- "\)Tj$"
Warning
messages:
1: '\)' is an unrecognized escape in a
2006 Jul 24
3
unique, but keep LAST occurence
?unique says
Value:
An object of the same type of 'x'. but if an element is equal to
one with a smaller index, it is removed.
However, I need to keep the one with the LARGEST index.
Can someone please show me the light?
I thought about reversing the row order twice, but I couldn't get it to work right
(My data frame has 125000 rows and 7 columns,
and I'm
2007 May 09
5
Reading a web page in pdf format
Each day the daily balance in the following link
http://www.
snamretegas.it/italiano/business/gas/bilancio/pdf/bilancio.pdf
is
updated.
I would like to set up an R procedure to be run daily in a
server able to read the figures in a couple of lines only
("Industriale" and "Termoelettrico", towards the end of the balance)
and put the data in a table.
Is that possible? If
2011 Jan 13
1
Repeating value occurence
How can achieve this in R using seq, or rep function
c(-1,0,1,0,-1,0,1,0,-1,0)
The range value is between-1 and 1, and I want it such that there could be
n number of points between -1 and 1
Anyone? Please help Thanks
Rusty
[[alternative HTML version deleted]]
2008 Jun 27
3
For loop
Hi,
Could you please let me know to use a list in a for loop here geneset is a
loop.I am trying to match the names of the list with 1st row of the output.
result<- list()
for(i in 1:length(output)
{
result[[i]] <- geneset(which(geneset %n% output[,1]))
}
Kindly help me out
--
View this message in context: http://www.nabble.com/For-loop-tp18163665p18163665.html
Sent from the R
2005 Feb 21
2
character occurence within a string
Hello,
I'm looking for a function that counts the occurences of a given character within a string.
f('|','ab|c|d') => 2
More precisely, I need to complete a vector of strings to ensure that all elements have the same count of a "separator":
a|b|c
a
|a|b|c|d
=>
a|b|c||
a||||
|a|b|c|d
I guess that scan makes use of an internal function that would do
2006 Jul 06
5
Building a standalone application with RoR
Hello,
I have to code a small application for a car repair shop running under
Windows (98 SE but may be my client could upgrade to 2000) and using RoR
is my definite choise !
The app will be powered by WebRick (which is enough powerfull for a
small app used by only ONE user at a time)
My questions are targeted to the best database to use... I had a look to
SQLite and Firebird but support
2008 May 03
1
recode involving a count rule
Hello, R-helpers.
I have a data frame below called df. I want to add a variable c, based on
the following logic:
if df$a < 5 then the first two times this condition is met place a 1 in c,
the next two times this condition is met place a 2 in c and when the
condition is not met let c equal df$b. The result would look like, dfnew,
shown below.
a <- rep(c(3,5,7), 4)
b <- rep(c(NA,1,2),
2006 Jun 17
4
Simple tutorial weirdness
Sorry - working on a simple tutorial but something is throwing me
here. I''m supposed to get a Time.now() print to the page but it''s not
working and I can''t figure out why.
No errors are thrown my the page shows:
Howdy, world! My name is Stuart Felenstein.
This was verified at .
So no time stamp showing. I went into IRB , did a Time.now() and it''s
working
2009 Mar 30
3
[PATCH 0/3] v2: mbr: Ctrl-key press forces load from first hard disk
Version 2 of these patches includes optimisations suggested by H Peter
Alvin to save bytes:
* Use memory-mapped I/O register to read keyboard shift flags
* Don't reload DX from memory; move immediate byte to register
Tested using mbr.bin.
TJ (3):
mbr: Ctrl-key press forces load from first hard disk
gptmbr: Ctrl-key press forces load from first hard disk
isohdpfx: Ctrl-key press