Displaying 20 results from an estimated 2000 matches similar to: "R Beginner : Loop and adding row to dataframe"
2004 Jun 29
2
Calculate correctly, but gives an error message
Hi!
I will calculate sum??s in the following way:
E.g.:
a <- rpois(100,20)
b <- rpois(100,5)
x <- data.frame(cbind(a,b))
# the sum??s should be calculated based on a.
attach(x)
sort.nace <- unique(sort(x[,1]))
sum1 <- matrix(ncol=1, nrow=length(sort.nace))
# I calculate the sum of all values of b, which have the same category in a. Eg.:
sum1[1,] <- sum(subset(x,
2006 Feb 27
4
Getting nuts with sortables...
Folks,
It has been a whole day spent on this but I still can''t get my mind
around the most probably very stupid/basic mistake here... First, the
code I use:
<h3>List A</h3>
<ul id="lista" >
<li id="item1"> Item 1</li>
<li id="item2"> Item 2</li>
<li id="item3"> Item 3</li>
</ul>
2013 Mar 15
2
phyper returning zero
Hi,
I am attempting to use phyper to test the significance of two overlapping lists. I keep getting a zero and wondered if that was determining non-significance of my overlap or a p-value too small to calculate?
overlap = 524
lista = 2784
totalpop = 54675
listb = 1296
phyper(overlap, lista, totalpop, listb,lower.tail = FALSE, log.p=F)
[1] 0
If I plug in some different values I get a p-value but
2012 Feb 02
2
contar caracteres de los elementos de un factor
Hola, necesito contar la cantidad de caracteres de cada elemento de un
vector o factor
Por ejemplo si el factor es:
a<-c("jose", "javier", "mariano")
aplicando alguna funcion, el resultado q quiero es
4, para jose
6 para javier
7, para mariano
q es la cantidad de caracteres q tiene cada uno de los elementos del factor
a
probe usando length(a) y me da la
2010 May 05
2
Using statistical test to distinguish two groups
Hi R friends,
I am posting this question even though I know that the nature of it is
closer to general stats than R. Please let me know if you are aware of
a list for general statistical questions:
I am looking for a simple method to distinguish two groups of data in
a long vector of numbers:
list <- c(1,2,3,2,3,2,3,4,3,2,3,4,3,2,400,340,3,2,4,5,6,4,3,6,4,5,3)
I would like to
2010 Dec 02
1
mediana ponderada
Hola alguien sabe una sentencia simple para calcular la mediana ponderada
por una variable?
Gracias
--
"*El peor analfabeto, es el analfabeto político.* Él no ve, no habla, no
participa de los acontecimientos políticos. Él no sabe que el costo de la
vida, el precio del pescado, de la harina, del alquiler, del calzado o del
remedio dependen de las decisiones políticas. *El analfabeto
2012 Jul 24
5
First value in a row
Hi.
This is likely a trivial problem but have not found a solution.
Imagine the following dataframe:
Lat Lon x1 x2 x3
01 10 NA NA .1
01 11 NA .2 .3
01 12 .4 .5 .6
I want to generate another column that consist of the first value in
each row from columns x1 to x3. That is
NewColumn
.1
.2
.4
Any input greatly appreciated,
Thanks,
Camilo
Camilo Mora, Ph.D.
2002 Apr 17
4
union of lists
Hi there,
Given 2 lists of integer vectors, i.e.:
> lista1
$"1"
[1] 1 34 5
$"2"
[1] 2 1
$"3"
[1] 3 10 15
> lista2
$"1"
[1] 1 5
$"2"
[1] 2 1
$"3"
[1] 3 10 29
I want to obtain the union of both, defined
as the union of the vectors, that is
lista.union[[1]] <- union(lista1[[1]],lista2[[1]]):
> lista.union
2011 Feb 25
4
salidas en Power Point
Hola tengo q hacer un trabajo, donde me piden q todas las salidas q haga
sean en Power Point (graficos, tablas, etc). Para eso habia empezado a leer
algo del paquete R2PPT, pero la verdad es q hay cosas q no entiendo de este
paquete.
Queria saber si alguien estuvo trabajando con el y obtuvo buenos resultados
o si han usado otro paquete para hacerlo.
Por ultimo una pregunta: desde Sweave se
2006 Apr 16
0
Sortable
I have 3 sortables, namely lista, listb and listc. Lista being a static list
of items and will be drag n drop to listb and listc. Everytime I drag from
lista to either listb or listc, the items in lista will be removed. Is that
normal? If so, can anyone advice how can I maintain the items in lista so
that I can have duplicate items in listb and listc.
I am using rails for the development.
2018 Apr 09
2
Operation Not Supported error for GETXATTR when VFS plugin "nfs4acl_xattr" is used
Hello Jeremy and Ralph
Thanks for your suggestions.
I compiled samba-4.8.0 and running it instead of samba-4.6.2. I saw the
changes that you mentioned in the latest vfs_nfs4acl_xattr module.
The operation not supported error is gone but it is now failing with access
denied. Here is what I tried:
*[root at test3 ajain]# net conf showshare local[local] path =
/home/ajain/mount
2012 Oct 10
7
multiple t-tests across similar variable names
Hi everyone-
I have a dataset with multiple "pre" and "post" variables I want to compare. The variables are named "apple_pre" or "pre_banana" with the corresponding post variables named "apple_post" or "post_banana". The variables are in no particular order.
apple_pre orange_pre orange_post pre_banana apple_post post_banana
person_1
2009 Dec 17
4
Fishers exact test at < 2.2e-16
In an effort to select the most appropriate number of clusters in a
mixture analysis I am comparing the expected and actual membership of
individuals in various clusters using the Fisher?s exact test. I aim
for the model with the lowest possible p-value, but I frequently get
p-values below 2.2e-16 and therefore does not get exact p-values with
standard Fisher?s exact tests in R.
Does anybody know
2012 Aug 11
3
help counting in data
Hi
>i have this data
> X
[1] 5.79 1579.52 2323.70 68.85 426.07 110.29 108.29 1067.60 17.05
22.66
[11] 21.02 175.88 139.07 144.12 20.46 43.40 194.90 47.30 7.74
0.40
[21] 82.85 9.88 89.29 215.10 1.75 0.79 15.93 3.91 0.27
0.69
[31] 100.58 27.80 13.95 53.24 0.96 4.15 0.19 0.78 8.01
31.75
[41] 7.35 6.50
2012 Jul 10
1
calculating the difference between days?
Hi List,
I have one column of beginning dates and one column of ending dates, I want
to find their difference. And I want to ignore the trailing zeros,
basically everything after the first colon mark.
Begin_date End_date
01JAN2000:00:00:00:000 02FEB2002:00:00:00:000
24MAR2012:00:00:00:000 18MAY2012:00:00:00:000
01OCT2003:00:00:00:000
2008 Sep 17
5
Loop on vector name
[My previous message rejected, therefore I am sending same one with some modification]
I have 3 vectors with object name : dat1, dat2, dat3
Now I want to create a loop, like :
for (i in 1:3)
{
cat(sd(dati))
}
How I can do this in R?
Regards,
2013 Feb 17
6
histogram
HI Elisa,
You could use ?cut()
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2012 Aug 01
3
Date period
Hello
I have dataframe
How to remove dates in hourly time seriesThe example time series likedate
value
2000-01-05 00:00:00 1.0
2000-01-05 01:00:00 1.0
2000-01-05 05:00:00 3.6
2000-01-05 06:00:00 3.6
2000-01-05 07:00:00 2.2
2000-01-05 08:00:00 2.2
2000-01-05 09:00:00 2.2
2000-01-05 10:00:00
2012 Oct 12
3
Columns and rows
Hi,
Could you please advice some easy way to do the following for a dataframe
(header=F) having unequal column- & row- length.
1. Combine/stack/join contents from -
a) multiple rows into one column.
b) multiple columns into one row.
2. Stack contents from multiple columns (or, rows) into one column (or,
row).
Thank you.
Cheers,
Santana
[[alternative HTML
2012 Aug 07
5
summing and combining rows
Hello,
I have a data set that needs to be combined so that rows are summed by a
group based on a certain variable. I'm pretty sure rowsum() or rowsums()
can do this but it's difficult for me to figure out how it will work for
my data based on the examples I've read.
My data are structured like this:
Plot SizeClass Stems
12 Class3 1
12 Class4