similar to: query about counting rows of a dataframe

Displaying 20 results from an estimated 1000 matches similar to: "query about counting rows of a dataframe"

2009 Oct 29
1
Basic question ( too broad for help topics).
I have searched help topics but don't know exactly what to search for. Need to use my_num to find any matching STREPs in my_df my_num <- c("101","102","103","104","105","107","108","112","113","114","115") ## "my_df" has 8,000 different STREPS in it. ## I have a
2006 Nov 09
1
POSIXlt converted to POSIXct in as.data.frame()
In trying to use as.Date(), I've come across the conversion of POSIXlt to POSIXct when a POSIXlt variable is included in a data frame: my_POSIX <- strptime(c("11-09-2006", "11-10-2006", "11-11-2006", "11-12-2006", "11-13-2006"), "%m-%d-%Y") str(my_POSIX) my_Date <- as.Date(my_POSIX) str(my_Date) data <- format(my_Date)
2013 Mar 20
3
summarize dataframe based on multiple cols, not their combinations
Hi folks, I'm trying to figure out how to get summarized data based on multiple columns. However, instead of giving summaries for every combination of categorical columns, I want it for each value of each categorical column regardless of the other columns. I could do this with three different commands, but i'm wondering if there's a more elegant way that I'm missing. Thanks!
2008 Jan 22
2
contingency table on data frame
I am sorry if this is a faq or tutorial somewhere, but I am unable to solve this one. What I am looking for is a count of how many different categories(numbers in this case) that appears for a given factor. Example: > l <- c("Yes", "No", "Perhaps") > x <- factor( sample(l, 10, replace=T), levels=l ) > m <- c(1:5) > y <- factor( sample(m, 10,
2010 Oct 25
2
extracting characteristics of datasets from data()
I can use data() to find the available datasets in a package, but I'd like to extract and display some additional information for each dataset than what is provided by data(), e.g., class() and dim() for datasets for which these are available. I'm stuck on using using lapply properly with objects, rather than the names of objects that I get from data() Example: > DS <-
2012 Sep 13
1
remove all terms with interaction factor in formula
Hi Folks, I'm trying to find a way to remove all terms in a formula that contain a particular interaction. For example, in the formula below, I'd like to remove all terms that contain the b:c interaction. > attributes(terms( ~ a*b*c*d))$term.labels [1] "a" "b" "c" "d" "a:b" "a:c" [7]
2013 Apr 09
1
sorting the VAR model output according to variable names??
I was wondering if one can have the coefficients of VAR model sorted according to variable names rather than lags. If you notice below, the output is sorted according to lags. >VAR(cbind(fossil,labour),p=2,type="const") VAR Estimation Results: ======================= Estimated coefficients for equation fossil: =========================================== Call: fossil = fossil.l1
2009 Jan 19
1
reference category for factor in regression
Hi all, I am struggling with a strange issue in R that I have not encountered before and I am not sure how to resolve this. The model looks like this, with all irrelevant variables left out: LABOUR - a dummy variable NONLABOUR = 1 - LABOUR AGE - a categorical variable / factor VOTE - a dummy variable glm(VOTE ~ 0 + LABOUR + NONLABOUR + LABOUR : AGE + NONLABOUR : AGE,
2023 Jun 04
2
Adding a numeric class to a data.frame
R-Help Community How do I add a numeric class to a data .frame. For example, I have calculated the following probabilities 1 2 3 0.0011566127 0.0009267028 0.0081623324 How would I add them back into my data.frame for example My_df <- data.frame(col_1 = c('A', 'B', 'C')) such that I end up with col_1
2007 Dec 06
3
using "eval(parse(text)) " , gsub(pattern, replacement, x) , to process "code" within a loop/custom function
R-help users, Thanks in advance for any assistance ... I truly appreciate your expertise. I searched help and could not figure this out, and think you can probably offer some helpful tips. I apologize if I missed something, which I'm sure I probably did. I have data for many "samples". (e.g. 1950, 1951, 1952, etc.) For each "sample", I have many data-frames.
2005 Dec 24
8
Prototype OOP example
Hi, Here is what I want to do: Labour = Class.create(); Labour.prototype = { initialize:function(name){ this.name = name; } } What I want to do is create a class called "Worker" which will inherit from "Labour", and the signature of "initialize" is "function(name, position)". May I ask what should do? Thank you all very much for the
2010 Jul 19
2
Grouping and stacking bar plot for categorical variables
Hi all, I have a series of cateogiral variables that look just like this: welfare=sample(c("less", "same", "more"), 1000, replace=TRUE) education=sample(c("less", "same", "more"), 1000, replace=TRUE) defence=sample(c("less", "same", "more"), 1000, replace=TRUE) egp=sample(c("salariat",
2012 Dec 04
4
partial analisys of a time series
Dear list members I want to analyze separately the months of a time series. In other words, I want to plot and fit models for each month separately. Taking the example of http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html births <- scan("http://robjhyndman.com/tsdldata/data/nybirths.dat") birthstimeseries <- ts(births, frequency=12,
2011 Mar 31
1
Cluster analysis, factor variables, large data set
Dear R helpers, I have a large data set with 36 variables and about 50.000 cases. The variabels represent labour market status during 36 months, there are 8 different variable values (e.g. Full-time Employment, Student,...) Only cases with at least one change in labour market status is included in the data set. To analyse sub sets of the data, I have used daisy in the cluster-package to create
2008 Mar 31
5
[LLVMdev] Additional Optimization I'm Missing?
Hello, I'm working on using the LLVM JIT for a little project of mine, amazing work first off! I have a question about optimization passes. I initially have this function I've created, in python it looks like this: OS_end = 50OS_start = 0OS_timestep = 1birth_rate = .3population = 30.0for time in range(OS_start, OS_end, OS_timestep): births = birth_rate * population deaths = 0.1
2019 Feb 19
2
Cambiar el formato de datos
Después del "gather()" puedes hacer un "arrange()" que es una ordenación. Y dentro de "arrange()" le indicas la variable por la que ordenas (no hacen falta comillas)... Lo ordenará alfabéticamente. Saludos, Carlos Ortega www.qualityexcellence.es El mar., 19 feb. 2019 a las 13:47, Antonio Rodriguez Andres (< antoniorodriguezandres70 en gmail.com>) escribió:
2019 Mar 06
2
Crear una variable tipo factor a partir de un vector de caracteres
Si lo que quiero es crear una variable llamada por ejemplo region (del tipo factor) con esos 5 valores On Wed, 6 Mar 2019 at 15:41, Xavier-Andoni Tibau Alberdi < xavitibau en gmail.com> wrote: > No, No. Fíjate en el Ifelse(condición, valor si positivo, valor si > negativo). > > Si, x %in% ca entonces el valor devuelto es "ca", un factor. En caso > negativo, vamos
2007 Oct 26
1
finding birth position
Hi All, I have data on the sequence of births for families with completed fertility cycle (in a data frame); the relevant variables are called b1, b2, b3, b4, b5, b6 and record the birth of the first, second, ..., sixth child. So, b1=1 if the first birth is male, b1=2 if the first birth is female, and b1=NA if the family did not record any first birth. Similarly for b2, b3, b4, b5 and b6. I
2019 Sep 04
2
Plot. window error- Usando R base. Gráfico
No me sale error pero no me imprime la linea, ni ningun gráfico por pais. On Wed, 4 Sep 2019 at 18:42, neo <ericconchamunoz en gmail.com> wrote: > podría ser el problema el tipo de dato en X y el tipo de gráfico que > intentas hacer ? > > si Year es entero y estas pidiendo que el gráfico sea tipo "I", podría > ser que quizá eso te produce el error ? > > si
2019 Sep 04
2
Plot. window error- Usando R base. Gráfico
Lo que obtengo es dim(currcty) = NULL lo que hice es crear una lista de paises countrylist <- unique(length(eco_freedom2$Countries) Los datos son de esta forma head(eco_freedom2, 5) Year ISO_Code Countries SUMMARY.INDEX X1..Size.of.Government 641 2000 AGO Angola NA NA 601 2001 AGO Angola NA NA 561 2002