factors Questions

1

Solved

I have the following data.frame and I want to perform some calculations on the 2nd column. > test code age 1 101 15 2 102 25 3 103 16 4 104 u1 5 105 u1 6 106 u2 7 107 27 8 108 27 As you ca...
Circinus asked 29/5, 2015 at 8:55

4

Solved

Is there an efficient algorithm to enumerate the factors of a number n, in ascending order, without sorting? By “efficient” I mean: The algorithm avoids a brute-force search for divisors by start...
Bolte asked 1/5, 2015 at 18:35

2

Solved

Based on this question, I order a date.frame dd with two factors b and x dd <- data.frame(b = factor(c("Hi", "Med", "Hi", "Low"), levels = c("Low", "Med", "Hi"), ordered = TRUE), x = factor(c(...
Liu asked 2/8, 2014 at 18:23

1

Solved

I am trying something that should be simple, any hint on what is going on is very welcomed. I have a large data frame with country imports from some municipalities. For some countries I have 2 ent...
Vivanvivarium asked 21/10, 2013 at 11:25

1

Solved

I wrote a small function to partition my dataset into training and testing sets. However, I am running into trouble when dealing with factor variables. In the model validation phase of my code, I g...
Yellowknife asked 11/5, 2013 at 5:1

1

I have written this block of code but it is consuming lots of time to calculate... Can you help me finding out an efficient way to do it? int tag; int* factors(int n) { int a[1000000]; for...
Aliunde asked 29/3, 2013 at 4:7

3

Solved

I'm trying to do some machine learning stuff that involves a lot of factor-type variables (words, descriptions, times, basically non-numeric stuff). I usually rely on randomForest but it doesn't wo...
Mulvaney asked 21/12, 2011 at 20:44

2

Solved

While solving a problem, I had to calculate the divisors of a number. I have two implementations that produce all divisors > 1 for a given number. The first is using simple recursion: divisors ::...
Clintonclintonia asked 21/8, 2012 at 9:37

2

Solved

Let's create some factors first: F1 <- factor(c(1,2,20,10,25,3)) F2 <- factor(paste0(F1, " years")) F3 <- F2 levels(F3) <- paste0(sort(F1), " years") F4 <- factor(paste0(F1, " years...
Diller asked 20/7, 2012 at 21:23

1

Here is the link to the problem. The problem asks the number of solutions to the Diophantine equation of the form 1/x + 1/y = 1/z (where z = n!). Rearranging the given equation clearly tells...
Commutual asked 16/4, 2012 at 18:48

2

Solved

An example of a non-settable function would be labels. You can only set factor labels when they are created with the factor() function. There is no labels<- function. Not that 'labels' and 'leve...
Chrissychrist asked 19/8, 2011 at 23:27

1

Solved

I would like to create a new variable,litter, to indicate each sow or litter in different farrowing dates (fdate). Each litter is to be numbered from 1 to N with an increament of 1 as shown in the ...
Telegram asked 27/4, 2011 at 1:4

2

Solved

Why does this code return the sum of factors of a number? In several Project Euler problems, you are asked to compute the sum of factors as a part of the problem. On one of the forums there, someo...
Weatherspoon asked 17/12, 2010 at 2:25

2

Solved

I have a data frame where one particular column has a set of specific values (let's say, 1, 2, ..., 23). What I would like to do is to convert from this layout to the one, where the frame would hav...
Electronic asked 8/3, 2010 at 19:27

© 2022 - 2024 — McMap. All rights reserved.