Displaying 20 results from an estimated 400 matches similar to: "Resultado de la consola como un tibble"
2020 Oct 18
1
Resultado de la consola como un tibble
Hola,
Bueno, puedes hacer el cálculo de una forma mucho más compacta y rápida.
Esta forma es especialmente recomendable cuando tienes muchas columnas y
muchas filas.
> library(data.table)
> myDT <- as.data.table(mtcars)
> myDTlong <- melt(myDT, measure.vars=1:ncol(myDT))
> myDTlong[ , list(p_value = shapiro.test(value)$p.value, v_stat =
shapiro.test(value)$statistic) , by
2020 Oct 18
0
Resultado de la consola como un tibble
Hola,
No hace falta (en este caso) capturarlo de la consola.
El resultado de la función apply se puede capturar y procesar.
> data("mtcars")
> # Mtcars_matriz <- as.matrix(mtcars)
> res_out <- apply(mtcars, MARGIN =2, FUN = shapiro.test)
>
>
> res_df <- as.data.frame(unlist(res_out))
> res_df$vars <- rownames(res_df)
> rownames(res_df) <- NULL
2016 Apr 28
2
Combinaciones sin repetición...con restricciones
Hola, Carlos.
Primero, muchas gracias por el código. No es exactamente lo que quería,
porque la parte "Detección de presencia de "cual_1" y "cual_2"... no
excluye aquellas combinaciones en las que está presente también el objeto
c, pero me ha servido de base e inspiración para elaborar otro código.
He copiado la primera parte de tu función, para crear todas las
2016 Apr 27
4
Combinaciones sin repetición...con restricciones
Hola, tengo que resolver un problema para el que normalmente utilizaría
excel, pero me gustaría intentar resolverlo con R. Se trata de lo siguiente:
Tengo tres elementos: a, b y c.
Dichos elementos están agrupados en siete objetos, producto de todas las
combinaciones sin repetición posibles:
Objeto 1: a
Objeto 2: b
Objeto 3: c
Objeto 4: a y b
Objeto 5: a y c
Objeto 6: b y c
Objeto 7: a, b y c
2018 Mar 09
3
Contar categorías después de ciertos valores
Hola,
Estoy intentando averiguar cómo contar el número de categorías situadas después de ciertos valores. Por ejemplo, en el siguiente vector:
x <- c(3, "A", "B", 5, "A", 4, 5, "A", "A", 3)
el resultado que quisiera obtener es:
Valor -> Resultado
3 -> 1 A y 1 B
4 -> 0 A y 0 B
5 -> 3 A y 0 B
¿Alguien tiene alguna
2018 Feb 12
4
problema de fechas
hola Patricio, usa:
dplyr::if_else
[[alternative HTML version deleted]]
2020 Sep 20
2
expresiones regulares
Hola a tod en s
?alquien sabria como convertir estas frases con expresiones regulares?
1.3ptd -> 1.3 ptd
1.3ptdm -> 1.3 ptdm
4.4ptdm23j -> 4.4 ptdm 23j
7.716s -> 7.7 16s
1.4hola -> 1.4 hola
1.4hola.hola -> 1.4 hola.hola
5.5v6 -> 5.5 v6
5.5v6sdp -> 5.5 v6 sdp
5.5v10sdp -> 5.5 v10 sdp
de forma que esta frase
"hola 1.3ptd 1.3ptdm 4.4ptdm23j 7.716s 1.4hola pepe
2013 Mar 20
2
Pattern match
Hello again, in the help page of grep() function, it is written that
pattern:
character string containing a regular expression (or character string
for fixed = TRUE) to be matched in the given character vector. Coerced
by as.character to a character string if possible. If a character
vector of length 2 or more is supplied, the first element is used with
a warning. Missing values are allowed
2011 Jun 14
1
Invalid Regular Expression
I'm working with some data, and am trying to generate it in the following
format.
state city zipcode
I like pizza 0 0 0
I live in Denver 0 1 0
All the fun stuff is in Alaska 1 0 0
he lives in 66062
2007 Jan 19
1
naive bayes help
Hello
I have a rather simple code and for some reason it produces an error
message. If someone can tell me why and how to fix it, I would be very
greatful. Thank you in advance.
##### create data
set.seed(10)
n <- 200 # number of training points
n.test <- 200 # number of test points
p<-2 # dimension of input space
z <-
2011 Nov 29
2
aggregate syntax for grouped column means
I am calculating the mean of each column grouped by the variable 'id'.
I do this using aggregate, data.table, and plyr. My aggregate results
do not match the other two, and I am trying to figure out what is
incorrect with my syntax. Any suggestions? Thanks.
Here is the data.
myData <- structure(list(var1 = c(31.59, 32.21, 31.78, 31.34, 31.61, 31.61,
30.59, 30.84, 30.98, 30.79, 30.79,
2019 Oct 25
2
Duda de como contar casos por Programa.
Hola,
Tengo un tabla de datos con pacientes asistidos, para los cuáles tengo
variables como dni, género, programa de atención etc. Hay pacientes que
atendieron en más de un programa por lo cuál se repiten en la tabla. Lo que
quiero es poder contar con una matriz que me permita identificar la
cantidad de pacientes que coinciden entre programas.
Va un ejemplo:
[image: image.png]
Intenté de
2010 Aug 09
2
coef(summary) and plyr
Dear all,
I?m having trouble getting a list of regression variables back into a dataframe.
mydf <- data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))
mydf$fac<-factor(sample((0:2),replace=T,100))
mydf$y<- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)
dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))->dl
here I?d like to use
ldply(dl,coef(summary)) or something
2010 Jan 19
1
Model frame when LHS is cbind (PR#14189)
The model frame shows the response and predictors in a data frame with
nicely labelled columns:
fm <- lm(wt~qsec+log(hp)+sqrt(disp), data=mtcars)
model.frame(fm) # ok
When the left hand side consists of more than one response, those response
variables still look good, inside a matrix:
fm <- lm(cbind(qsec,hp,disp)~wt, data=mtcars)
model.frame(fm)[[1]] # ok
A problem arises when
2009 Jul 23
2
param:qsec in ggplot2
Hii
i have been trying to do a scatter plot with ggplot2, like the plot 6 here
(http://had.co.nz/ggplot2/geom_point.html) .. where the points size vary
with values
> p + geom_point(aes <http://had.co.nz/ggplot2/aes.html>(size = qsec))
but am not sure how to setup the parameter - qsec
could anyone please give some pointers on how to define that
thanks
Mo.
[[alternative HTML
2011 Oct 03
4
Question about ggplot2 and stat_smooth
I'm interested in creating a graphic -like- this:
c <- ggplot(mtcars, aes(qsec, wt))
c + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2,
alpha = 0.2)
but I need to show 2 sets of bands (with different shading) using 5%,
25%, 75%, 95% limits that I specify and where the heavy blue line is the
median. I don't understand how to do this with
2011 Aug 31
1
formatting a 6 million row data set; creating a censoring variable
List,
Consider the following data.
gender mygroup id
1 F A 1
2 F B 2
3 F B 2
4 F B 2
5 F C 2
6 F C 2
7 F C 2
8 F D 2
9 F D 2
10 F D 2
11 F D 2
12 F D 2
13 F D 2
14 M A 3
15 M A 3
16 M A 3
17
2016 Apr 14
4
Bug in by() function which works for some FUN argument and does not work for others
Dear Sirs,
I am Professor at Indira Gandhi Krishi Vishwavidyalaya, Raipur,
Chhattisgarh, India.
While taking classes, I found the *by() *function producing following error
when I use FUN=mean or median and some other functions, however,
FUN=summary works.
Given below is the output of the example I used on a built-in dataset
"mtcars", along with error message reproduced herewith:
>
2017 Apr 11
3
Uso reiterado de la funcion seq
Hola a todos,
Escribo debido a una duda en la aplicacion de la funcion seq en cada uno de los "n" componentes de un vector "x". Hasta donde yo se, dicha funcion no permite el uso de vectores.
En consecuencia, y como primera aproximacion a lo que deseo hacer, he construido un bucle que retorne una lista de "n" vectores (de distinta longitud), donde cada uno de estos
2010 Aug 14
1
is it possible to map 2 plots(c and d) in a single output plot?
is it possible to map 2 plots(c and d) in a single output plot?
library(ggplot2)
c <- ggplot(mtcars, aes(qsec, wt))
d <- ggplot (mtcars, aes(qsec, wt))
c + stat_smooth(fill="darkgrey", colour="blue", size=2, alpha = 0.2)
d + stat_smooth(fill="darkgrey", colour="red", size=2, alpha = 0.2)
--
View this message in context: