Displaying 20 results from an estimated 1000 matches similar to: "Time intervals in a datframe"
2018 Apr 17
0
Time intervals in a datframe
> On Apr 17, 2018, at 10:10 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
>
> Hi all
>
> I have a list of multiple datframes with the same column headers. The last column in each datframe contains a vector of "Interval" class after I have produced this column using "lubridate" package. I needed to convert my list of dataframes to be in a single
2017 Nov 09
2
Calculating frequencies of multiple values in 200 colomns
Always reply to the list. I am not a free, private consultant!
"For example, if I have the values : 1 , 2 , 3 in each column, applying
Tabulate () would calculate the frequency of 1 and 2 without 3"
Huh??
> x <- sample(1:3,10,TRUE)
> x
[1] 1 3 1 1 1 3 2 3 2 1
> tabulate(x)
[1] 5 2 3
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people
2017 Nov 10
0
Calculating frequencies of multiple values in 200 colomns
Thank you for your effort Bert..,
I knew what is the problem now, the values (1,2,3) were only an example. The values I have are 0 , 1, 2 . Tabulate () function seem to ignore calculating the frequency of 0 values and this is my exact problem as the frequency of 0 values should also be calculated for the maf to be calculated correctly.
________________________________
From: Bert Gunter
2017 Nov 10
2
Calculating frequencies of multiple values in 200 colomns
|> x <- sample(0:2, 10, replace = TRUE)
|> x
[1] 1 0 2 1 0 2 2 0 2 1
|> tabulate(x)
[1] 3 4
|> table(x)
x
0 1 2
3 3 4
B.
> On Nov 10, 2017, at 4:32 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
>
>
> Thank you for your effort Bert..,
>
>
> I knew what is the problem now, the values (1,2,3) were only an example. The values I have are
2017 Nov 18
3
Complicated analysis for huge databases
The loop :
AllMAFs <- list()
for (i in length(SeparatedGroupsofmealsCombs) {
AllMAFs[[i]] <- apply( SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf( tabulate( x+1) ))
}
gives these errors (I tried this many times and I'm sure I copied it entirely) :-
Error in apply(SeparatedGroupsofmealsCombs[[i]], 2, function(x) maf(tabulate(x + :
object 'i' not found
> }
2017 Nov 18
0
Complicated analysis for huge databases
> On Nov 18, 2017, at 1:52 AM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
> Although the loop seems to be formulated correctly I wonder why
> it gives me these errors :
>
> -object 'i' not found
> - unexpected '}' in "}"
You probably did not copy the entire code offered. But we cannot know since you did not "show your code",
2017 Nov 18
2
Complicated analysis for huge databases
Although the loop seems to be formulated correctly I wonder why
it gives me these errors :
-object 'i' not found
- unexpected '}' in "}"
the desired output is expected to be very large as for each dataframe in the list of dataframes I expect to see maf value for each of the 600 columns! and this is only for
for one dataframe in the list .. I have around 150-200
2017 Nov 18
2
Complicated analysis for huge databases
Thanks Boris , this was very helpful but I'm struggling with the last part.
1) I combined the first 2 columns :-
library(tidyr)
SingleMealsCode <-unite(MyData, MealsCombinations, c(MealA, MealB), remove=FALSE)
SingleMealsCode <- SingleMealsCode[,-2]
2) I separated this dataframe into different dataframes based on "MealsCombination"
column so R will recognize each meal
2017 Nov 10
0
Calculating frequencies of multiple values in 200 colomns
Hi,
To clarify the default behavior that Boris is referencing below, note the definition of the 'bin' argument to the tabulate() function:
bin: a numeric vector ***(of positive integers)***, or a factor. Long vectors are supported.
I added the asterisks for emphasis.
This is also noted in the examples used for the function in ?tabulate at the bottom of the help page.
The second
2017 Nov 17
0
Complicated analysis for huge databases
Combine columns 1 and 2 into a column with a single ID like "33.55", "44.66" and use split() on these IDs to break up your dataset. Iterate over the list of data frames split() returns.
B.
> On Nov 17, 2017, at 12:59 PM, Allaisone 1 <allaisone1 at hotmail.com> wrote:
>
>
> Hi all ..,
>
>
> I have a large dataset of around 600,000 rows and 600
2017 Nov 19
1
Complicated analysis for huge databases
Thanks but a new error appeared with the loop :
Error in x + 1 : non-numeric argument to binary operator
I think this can be solved by converting columns (I,II,II,..600) into "numeric" instead of
the current "int" type as shown below in the structure of "33_55" dataframe .
$ 33_55:'data.frame': 256 obs. of 600 variables:
..$ MealsCombinations
2017 Nov 18
0
Complicated analysis for huge databases
On 18/11/2017 4:40 PM, Allaisone 1 wrote:
>
> The loop :
>
>
> AllMAFs <- list()
>
> for (i in length(SeparatedGroupsofmealsCombs) {
> AllMAFs[[i]] <- apply( SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf( tabulate( x+1) ))
> }
>
>
> gives these errors (I tried this many times and I'm sure I copied it entirely) :-
>
> Error in
2017 Nov 17
3
Complicated analysis for huge databases
Hi all ..,
I have a large dataset of around 600,000 rows and 600 columns. The first col is codes for Meal A, the second columns is codes for Meal B. The third column is customers IDs where each customer had a combination of meals. Each column of the rest columns contains values 0,1,or 2. The dataset is organised in a way so that the first group of customers had similar meals combinations, this
2018 Feb 25
4
reshaping column items into rows per unique ID
Hi All
I have a datafram which looks like this :
CustomerID DietType
1 a
1 c
1 b
2 f
2 a
3 j
4 c
4 c
4 f
And I would like to reshape this so I can
2017 Nov 18
0
Complicated analysis for huge databases
Something like the following?
AllMAFs <- list()
for (i in length(SeparatedGroupsofmealsCombs) {
AllMAFs[[i]] <- apply(SeparatedGroupsofmealsCombs[[i]], 2, function(x)maf(tabulate(x+1)))
}
(untested, of course)
Also the solution is a bit generic since I don't know what the output of maf() looks like in your case, and I don't understand why you use tabulate because I would have
2005 Mar 22
1
Question with lattice xyplot
Hi All,
I have a quick question and any help is greatly appreciated. For the following data when I try to produce the image using xyplot function in lattice package, the key has 4 rows instead of 2. Can anyone tell me what I'm doing wrong and what is the way to fix the problem. Here the code that I'm running
studyData <- as.data.frame(t(structure(c(
"A",0,4.477,
2018 Apr 15
4
Adding a new conditional column to a list of dataframes
Hi all ..,
I have a list of 7000 dataframes with similar column headers and I wanted to add a new column to each dataframe based on a certain condition which is the same for all dataframes.
When I extract one dataframe and apply my code it works very well as follows :-
First suppose this is my first dataframe in the list
> OneDF <- Mylist[[1]]
> OneDF
ID Pdate
2010 Jun 24
1
help, bifurcation diagram efficiency
Hello all -
This code will run, but it bogs down my computer when I run it for finer and
finer time increments and more generations. I was wondering if there is a
better way to write my loops so that this wouldn't happen. Thanks!
-Tyler
#################
# Bifurcation diagram
# Using Braaksma system of equations
# We have however used a Fourier analysis
# to get a forcing function
2018 Feb 25
0
reshaping column items into rows per unique ID
Hi Allaisone,
If you want a data frame as the output you will have to put up with a
few NA values unless each Customer has the same number of diet types:
a1df<-read.table(text="CustomerID DietType
1 a
1 c
1 b
2 f
2 a
3 j
4
2017 Nov 24
1
Multiple sets of proportion tests
Thank you for clarifying this point but my main question was about how to modify my code to do the analysis correctly. The code I mentioned :-
MyResults <- apply(Mydata, 2, function(x)prop.test(Mydata,c(200,100))
Results in this error : 'x' and 'n' must have the same length in the prop.test(x,n).
How can I modify "x' or "n" arguments so the analysis