Displaying 20 results from an estimated 400 matches similar to: "Printing a variable in a loop"
2010 May 20
2
multiple 2 by 2 crosstabulations?
Hello,
I have a dataframe (var_1, var_2, ..., var_n) and I would like to export summary statistics to Latex in the form of a table. I want specific summary statistics by crossing numerous variables 2x2 AT ONCE. In each cell I would like sometimes to have the median (Q1 - Q3), or frequency and proportion, etc. CrossTable, xtab, etc... do not allow for multiple 2 by 2 crosstabulation. The table
2008 Apr 15
1
glm syntax question
Hello,
I'm new to R and have a very basic syntax question for the
functionglm. I am using the function glm() to do a regression on a
data set. I want to run this function in a while loop, so I need to be
able to do two things:
(1) I need to be able to have my list of variables in the regression
be based from a variable vector instead of hard code.
(2) I need to be able to collect the
2018 Oct 16
2
Comprobar los nombres de columnas entre varios dataframes
Buenas tardes,
Quiero aplicar la función rbind y necesito tener los mismos nombres de
columnas. Como tengo unas 195 variables en cada dataframe, necesito
hacerlo de una forma rápida. Tengo 9 bases de datos y tengo que fusionar
todas. ¿Como puedo comprobar que los nombres de las variables son los
mismos? Y de lo contrario, ¿como detecto las diferencias?
He probado con
2011 Jan 20
2
Accessing a 'user' variable via. dialplan.
Hi,
I know you can access various sip variables via
'Set(sstatus=${SIPPEER(201,status)})' (for example) to get the status of
the sip user - but what about variables?
I have a user that has setvar=123456 in their users.conf (sip.conf if
you prefer). I can read it with a 'sip show peer 201' - but that gives
everything and parsing that isn't really an option.
Anyone know how
2013 May 15
4
series financieras
Buenos dias,
Tengo la siguiente duda.
Desde una hoja de calculo .xls me descargo un fichero en r as.matrix.
Time VAR_2 VAR_3 VAR_4........ VAR_N
Fechas(n) Precios Precios Precios Precios
Fechas (n-1)
¿como puedo hacer para graficar de forma ordenada (fechas) cada uno del vector columnas (son precios de activos)?
[[alternative HTML
2011 Mar 04
2
Creating a .png with just an expression() in it
Hey,
I'm trying to create an image file with the results of a regression
analysis. In TeX, the line would be something like:
$ size = 0.34 + 4.3 var_1 $
Can I create a plot window with just this line in it? I tried playing
around with plot.new() or dev.new(), but didn't really find something
that worked.
Thanks in advance,
Alex
--
alexx at alexx-fett:~$ vi .emacs
2005 Mar 29
6
Aggregating data (with more than one function)
I have the data similar to the following in a data frame:
LastName Department Salary
1 Johnson IT 56000
2 James HR 54223
3 Howe Finance 80000
4 Jones Finance 82000
5 Norwood IT 67000
6 Benson Sales 76000
7 Smith Sales 65778
8 Baker HR 56778
9 Dempsey HR 78999
10 Nolan
2007 Dec 05
1
Working with "ts" objects
I am relatively new to R and object oriented programming. I have relied on
SAS for most of my data analysis. I teach an introductory undergraduate
forecasting course using the Diebold text and I am considering using R in
addition to SAS and Eviews in the course. I work primarily with univariate
or multivariate time series data. I am having a great deal of difficulty
understanding and working with
2011 Nov 24
2
proper work-flow with 'formula' objects and lm()
Dear all
I have a work-flow issue with lm(). When I use
> lm(y1~x1, anscombe)
Call:
lm(formula = y1 ~ x1, data = anscombe)
Coefficients:
(Intercept) x1
3.0001 0.5001
I get as expected the formula, "y1 ~ x1", in the print()ed results or
summary(). However, if I pass through a formula object
> (form <- formula(y1~x1))
y1 ~ x1
> lm(form, anscombe)
Call:
2020 Oct 15
0
package(moments) issue
moments::anscombe.test(x) does give errors when x has too few values or if
all the values in x are the same
> moments::anscombe.test(c(1,2,6))
Error in if (pval > 1) pval <- 2 - pval :
missing value where TRUE/FALSE needed
> moments::anscombe.test(c(2,2,2,2,2,2,2,2))
Error in if (pval > 1) pval <- 2 - pval :
missing value where TRUE/FALSE needed
You can use tryCatch() to
2020 Oct 15
2
package(moments) issue
Hi all,
While running the anscombe.test in R, I'm getting an error of *Error in if
(pval > 1) pval <- 2 - pval : missing value where TRUE/FALSE needed* for a
few time series columns whereas for most of the series the function is
working fine. I have checked for those specific columns for missing values.
However, there is no NA/NAN value in the dataset.
I have also run kurtosis for
2020 Oct 15
2
package(moments) issue
Hi Bill,
Thanks for prompt reply and letting me know a way around it.
I have more than 1200 observations and not all the values are the same.
However, my data points are quite similar, for example,
0.079275, 0.078867, 0.070716 in millions and etc. I have run the data
without converting it to millions and I still get the same error
message. As I have kurtosis value, it should be fine for the
2006 Aug 16
3
separate row averages for different parts of an array
I have an array with 44800 columns and 24 rows I would like to compute the
row average for the array 100 columns at a time, so I would like to end up
with an array of 24 rows x 448 columns. I have tried using apply(dataset, 1,
function(x) mean(x[])), but I am not sure how to get it to take the average
100 columns at a time. Any ideas would be welcomed.
thanks,
Spencer
[[alternative HTML
2010 Jun 10
2
points marking
Hi,
How to mark points on x axis of a graph keeping x axis as constant and
changing y from y1 to y2 respectively. I want to highlight the area from y1
to y2.
Any suggestions
Thank you
Jeet
[[alternative HTML version deleted]]
2007 Mar 13
2
turn regression coefficients into matrix or...
I don't have much experience with r. What I am trying to do is to turn
regression coefficients (after I run a lm or glm model) into some matrix
such that I can do some post-estimation calculation, for example predicted
probabilities in glm model, etc.. Or, is there any function in r that I can
use to do something along that line? thanks.
Jun Xu, Ph.D.
Department of Sociology
Ball State
2006 Sep 25
1
Rows of a data frame to matrix
useRs,
I have a data frame where four of the columns of the data frame represent the values of a two-by-two
matrix. I'd like to, row-by-row, go through the data frame and use the four columns, in matrix form, to
perform calculations necessary to create new values for variables in the data frame. My first idea was to
use apply:
apply(as.array(data.frame[,1:4]), 1, matrix, nrow=2)
Though
2011 Oct 25
1
alternative option in skewness and kurtosis tests?
I have a question about the D'Agostino skewness test and the Anscombe-Glynn
kurtosis test.
agostino.test(x, alternative = c("two.sided", "less", "greater"))
anscombe.test(x, alternative = c("two.sided", "less", "greater"))
The option "alternative" in those two functions seems to be the null
hypothesis. In the output, the
2007 Aug 26
3
subset using noncontiguous variables by name (not index)
Hi All,
I'm using the subset function to select a list of variables, some of
which are contiguous in the data frame, and others of which are not. It
works fine when I use the form:
subset(mydata,select=c(x1,x3:x5,x7) )
In reality, my list is far more complex. So I would like to store it in
a variable to substitute in for c(x1,x3:x5,x7) but cannot get it to
work. That use of the c function
2020 Oct 15
0
package(moments) issue
Another bad case is
> moments::anscombe.test(rep(c(1,1.1),length=35))
Error in if (pval > 1) pval <- 2 - pval :
missing value where TRUE/FALSE needed
I haven't checked the formulas carefully, but I suspect the problem is from
taking the cube root of a negative number in
z <- (1 - 2/(9 * a) - ((1 - 2/a)/(1 + xx * sqrt(2/(a -
4))))^(1/3))/sqrt(2/(9 * a))
In R, the
2006 Aug 29
2
lattice/xyplot: plotting 4 variables in two panels - can this be done?
Hi,
I would like to create a plot of y1,y2,y3,y4 against x for several subjects such that y1 and y2 are plotted against x in one panel and y3 and y4 against x in another panel. Thus if there are 3 subjects I should end up with 6 panels. Is there a simple way of doing so (i.e. without calling xyplot() several times, and then padding the results together)??
Regards
S?ren