similar to: Keeping the attributes of an observation

Displaying 20 results from an estimated 70000 matches similar to: "Keeping the attributes of an observation"

2008 May 21
0
rbind.data.frame drops attributes for factor variables
Dear R-devel - I noticed that when I rbind two data.frames together, factor variables lose their attributes in the resulting data.frame while numeric variables do not. As an example, create two data.frames, t1 and t2, with two variables each. Give each variable an attribute called "label", and then perform the rbind and look at the resulting structure. #### EXAMPLE R CODE #####
2016 Apr 24
0
assign color to subsets
now after this: df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command)) I use factor to apply the subset to df but then the Command level becomes 0 df_both$Command=factor(df_both$Command) str(df_both) $ Protocol : Factor w/ 0 levels: Do you know what is the reason? Thanks for replying On Sunday, April 24, 2016 12:18 PM, jim
2016 Apr 24
0
assign color to subsets
my problem is that in Command I have 2229 levels and I want to do subsets based on the names I have in Command. for example if the name has t1 or t2 in it or if it has both of them.and then I need to plot in a way that colors are names with t1,names with t2 and names with both. But now even the grepl I use for the subsets does not work correct! :((( hast1=grepl("t1", df$Command,
2016 Apr 24
1
assign color to subsets
'grepl' returns a logical vector; you have to use this to get your subset. You can use: df_tq <- subset(df, grepl("t1", Command)) df_t2 <- subset(df, grepl("t2", Command)) # if you want to also get a subset that has both, use df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command)) Jim Holtman Data Munger Guru What is
2010 Apr 11
1
Matrix is not symmetric under lme4
Dear all, My code is presented as the following. library(MASS) library(rmutil) library(repeated) library(lme4) library(arm) #install.packages("Zelig", repos = "http://gking.harvard.edu") library(Zelig) rm(list = ls()) beta0<-2.5 beta1<--0.3 sigs2<-0.5 I<-4 #numberpatients<-c(40,100,160,200,400,600) numberpatients<-c(1000) #numberpatients<-3 times<-1
2013 Jan 19
0
import data (txt) separated by many blank spaces and lines with variable names that correspond to multiple observations.
Hello, I have read other posts and in part I tried to solve my problem. I have a txt file but the values ??as well as being separated by many blank spaces and lines eg. var_a var_b var_c 1 2 4 5 2 6 2 have an encoding problem in the header, let me
2012 Jul 27
1
How to run regressions over increasing time series
Hello, I would like to run a series of regressions on my data (response variable over time): 1) regression from T1 to T2 2) regressions from T1 through T3 3) regression from T1 through T4, etc. I have been struggling to find a way to do this through commands, as opposed to cutting up the data manually (my dataset has over 6000 rows/observations). An illustrative dataset can be created thusly:
2010 Dec 13
1
Wrong contrast matrix for nested factors in lm(), rlm(), and lmRob()
This message also reports wrong estimates produced by lmRob.fit.compute() for nested factors when using the correct contrast matrix. And in these respects, I have found that S-Plus behaves the same way as R. Using the three available contrast types (sum, treatment, helmert) with lm() or lm.fit(), but just contr.sum with rlm() and lmRob(), and small examples, I generated contrast matrices for
2016 Apr 23
4
assign color to subsets
Hi I have the following df and I created two subsets but I don't know how to use these subsets as the colors of my plot. data.frame': 36919 obs. of 162 variables $TE :int 38,41,11,52,48,75,..... $TR :int 100,210,548,546,..... $Command :factor W/2229 levels
2011 May 12
1
(no subject)
#subject: type III sum of squares - anova() Anova() AnovaM() #R-version: 2.12.2 #Hello everyone, #I am currently evaluating experimental data of a two factor experiment. to illustrate de my problem I will use following #dummy dataset: Factor "T1" has 3 levels ("A","B","C") and factor "T2" has 2 levels "E" and "F". The
2016 Apr 22
0
subset by multiple letters condition
You can use the grepl() function to give you logicals for each criterion, then combine them as needed. For example: # example version of Command Command <- paste0("_localize_", c("PD","t2","t1_seq", "abc", "xyz", "PD_t1")) hasPD <- grepl("PD", Command, fixed=TRUE) hast1 <- grepl("t1", Command,
2016 Apr 23
1
subset by multiple letters condition
Thanks Jean, Does anyone know how to set these [hast1] and [hast2] as the colors of a plot? On Friday, April 22, 2016 7:39 AM, "Adams, Jean" <jvadams at usgs.gov> wrote: You can use the grepl() function to give you logicals for each criterion, then combine them as needed. For example: # example version of Command Command <- paste0("_localize_",
2017 Jun 04
0
New var
# read.table is NOT part of the data.table package #library(data.table) DFM <- read.table( text= 'obs start end 1 2/1/2015 1/1/2017 2 4/11/2010 1/1/2011 3 1/4/2006 5/3/2007 4 10/1/2007 1/1/2008 5 6/1/2011 1/1/2012 6 10/5/2004 12/1/2004 ',header = TRUE, stringsAsFactors = FALSE) # cleaner way to compute D DFM$start <- as.Date( DFM$start, format="%m/%d/%Y" ) DFM$end
2017 Jun 04
0
New var
Since the number of choices is small (6), how about this? Starting with Jeff's initial DFM: DFM <- structure(list(obs = 1:6, start = structure(c(16467, 14710, 13152, 13787, 15126, 12696), class = "Date"), end = structure(c(17167, 14975, 13636, 13879, 15340, 12753), class = "Date"), D = c(700, 265, 484, 92, 214, 57), bin = structure(c(6L, 3L, 5L, 1L, 3L, 1L), .Label
2010 Dec 03
2
subset of a dataframe
HI, I have a dataframe like this: name type A t1 B t2 C t1 D t1 E t3 F t2 how can I have a "sub dataframe" based with the column "type" like this: (for type = t1) name type A t1 C t1 D t1 (for type = t2) name type B t2 F t2 Thanks -- View this message
2006 Jan 31
0
Help with boot()
Dear List: I'm trying to use the boot function to estimate some standard errors. I actually programmed a bootstrap using some homebrew code and it worked fine. But, I am trying to use the more efficient boot function. I have placed some sample data for replication of my problem at the bottom of this email. For the sample problem, I have 10 subjects each with 5 observations Y_t = (t_1, ...,
2017 Jun 03
0
New var
Ii is difficult to provide useful help, because you have failed to read and follow the posting guide. In particular: 1. Plain text, not HTML. 2. Use dput() or provide code to create your example. Text printouts such as that which you gave require some work to wrangle into into an example that we can test. Specifically: 3. Have you gone through any R tutorials?-- it sure doesn't look like
2013 Jan 09
1
How to estate the correlation between two autocorrelated variables
Dear R users, In my data, there are two variables t1 and t2. For each observation of t1 and t2, two location indicators (x, y) were provided. The data format is # x y t1 t2 Since the both t1 and t2 are depended on x and y, t1 and t2 are autocorrelated variables. My question is how to calculate the correlation between t1 and t2 by taking into account the structure of residual variance
2016 Apr 22
2
subset by multiple letters condition
Hi all, I have a data frame df and I want to do subset based on several conditions of letters of the names in Command.1)if the names contain PD 2)if the names contain t1 3)if the names contain t2 4)if the names contain t1 and PD 5)if the names contain t2 and PD 6)otherwise the names would be unknown. I don't know how to use grep for all these conditions. 'data.frame': 36919
2009 Jul 30
0
randomized block design analysis PROBLEM
Dear All user, Hello, I'm a student and I have some trouble with the experimental (columns-experiments) design of my project. I use a randomized block design with 4 treatments including a control. For each treatment, I use 3 replicates and 3 blocks. The treatments are: -T1 = COD (300 mg/Lit) COD=chemical oxygen demand -T2 = COD (200 mg/Lit) -T3 = COD (100 mg/Lit) -T4 = COD (0 mg/Lit) as