data-management

Android App Updating Without Losing Data

我怕爱的太早我们不能终老 提交于 2019-12-04 03:37:12
问题 I'm new to Android development, so I'm trying to do an app that stores information about a warehouse. However, I'm afraid that if I perform an update, the user data will get lost. Do I have to manage which data should remain unchanged upon updating? Also, I would like to know if it would make any difference to use a serializable class or to use an SQL database if I want to keep the data safe. Thanks a lot :) 回答1: When you update the app, SharedPreferences and SQLite will not lose data. So you

What is the best way to manage metadata in R? [duplicate]

空扰寡人 提交于 2019-12-03 16:16:28
This question already has answers here : Closed last year . How to create, structure, maintain and update data codebooks in R? (4 answers) In analyzing data the metadata about variables is extremely important. How do you manage this information in R? For example, is there a way to specify a label that will be printed instead of the variable name? What facilities are there in R for this? Quick suggestions that come to mind are attributes to store data along with an object (as Frank Harrell has championed for a long time) the comment() function can do parts of this the whole gamut of object

Realm migrations in Swift

倾然丶 夕夏残阳落幕 提交于 2019-12-03 11:56:14
问题 I have a Realm Object modeled as so class WorkoutSet: Object { // Schema 0 dynamic var exerciseName: String = "" dynamic var reps: Int = 0 // Schema 0 + 1 dynamic var setCount: Int = 0 } I am trying to perform a migration. Within my AppDelegate I have imported RealmSwift . Within the function didFinishLaunchWithOptions I call Migrations().checkSchema() Migrations is a class declared in another file. Within that file there is a struct declared as so. func checkSchema() { Realm.Configuration( /

R: create a data frame out of a rolling window

谁说胖子不能爱 提交于 2019-11-30 14:07:20
Lets say I have a data frame with the following structure: DF <- data.frame(x = 0:4, y = 5:9) > DF x y 1 0 5 2 1 6 3 2 7 4 3 8 5 4 9 what is the most efficient way to turn 'DF' into a data frame with the following structure: w x y 1 0 5 1 1 6 2 1 6 2 2 7 3 2 7 3 3 8 4 3 8 4 4 9 Where w is a length 2 window rolling through the dataframe 'DF.' The length of the window should be arbitrary, i.e a length of 3 yields w x y 1 0 5 1 1 6 1 2 7 2 1 6 2 2 7 2 3 8 3 2 7 3 3 8 3 4 9 I am a bit stumped by this problem, because the data frame can also contain an arbitrary number of columns, i.e. w,x,y,z etc.

NSCoding VS Core data

帅比萌擦擦* 提交于 2019-11-28 04:24:05
I've been searching for an article that explains NSCoding (NSKeyedArchiver...) advantages and disadvantages over use of CoreData (SQLite....). There's a lot of options, I can implement my own custom binary reader/writer, or use plists/xml/json... or use SQLite or NSCoding. I'm kind of lost right now. Can any body explain what's the difference between the MAIN features? It depends which kind of data you want to save and whether you will use it only internally or you have to exchange the data with an external service. NSCoding is generally speaking a data serializer. A lot of built-in objects

how to insert missing observations on a data frame

柔情痞子 提交于 2019-11-28 01:42:51
I have a data that are observations over time. Unfortunately, some large gaps of time points are missing on a treatment. They are not coded as NA and if I make a plot out of them it becomes apparent. My data frame looks like this. The number of samples per time points are irregular. (edit: sorry for not making the example reproducible)s structure(list(A = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

Quickly remove zero variance variables from a data.frame

北城以北 提交于 2019-11-27 20:08:22
问题 I have a large data.frame that was generated by a process outside my control, which may or may not contain variables with zero variance (i.e. all the observations are the same). I would like to build a predictive model based on this data, and obviously these variables are of no use. Here's the function I'm currently using to remove such variables from the data.frame. It's currently based on apply , and I was wondering if there are any obvious ways to speed this function up, so that it works

Quickly remove zero variance variables from a data.frame

空扰寡人 提交于 2019-11-27 18:34:22
I have a large data.frame that was generated by a process outside my control, which may or may not contain variables with zero variance (i.e. all the observations are the same). I would like to build a predictive model based on this data, and obviously these variables are of no use. Here's the function I'm currently using to remove such variables from the data.frame. It's currently based on apply , and I was wondering if there are any obvious ways to speed this function up, so that it works quickly on very large datasets, with a large number (400 or 500) of variables? set.seed(1) dat <- data

How to create, structure, maintain and update data codebooks in R?

▼魔方 西西 提交于 2019-11-27 17:21:23
In the interest of replication I like to keep a codebook with meta data for each data frame. A data codebook is: a written or computerized list that provides a clear and comprehensive description of the variables that will be included in the database. Marczyk et al ( 2010 ) I like to document the following attributes of a variable: name description (label, format, scale, etc) source (e.g. World bank) source media (url and date accessed, CD and ISBN, or whatever) file name of the source data on disk (helps when merging codebooks) notes For example, this is what I am implementing to document the

Create a variable capturing the most frequent occurence by group

人走茶凉 提交于 2019-11-27 03:32:08
问题 Define: df1 <-data.frame( id=c(rep(1,3),rep(2,3)), v1=as.character(c("a","b","b",rep("c",3))) ) s.t. > df1 id v1 1 1 a 2 1 b 3 1 b 4 2 c 5 2 c 6 2 c I want to create a third variable freq that contains the most frequent observation in v1 by id s.t. > df2 id v1 freq 1 1 a b 2 1 b b 3 1 b b 4 2 c c 5 2 c c 6 2 c c 回答1: You can do this using ddply and a custom function to pick out the most frequent value: myFun <- function(x){ tbl <- table(x$v1) x$freq <- rep(names(tbl)[which.max(tbl)],nrow(x))