similar to: split date and time

Displaying 20 results from an estimated 10000 matches similar to: "split date and time"

2013 May 07
4
create unique ID for each group
Hey All, I have a dataset(dat1) like this: ObsNumber ID Weight 1 0001 12 2 0001 13 3 0001 14 4 0002 16 5 0002 17 And another dataset(dat2) like this: ID Height 0001 3.2 0001 2.6 0001
2013 Apr 18
6
count each answer category in each column
Hey, Is it possible that R can calculate each options under each column and return a summary table? Suppose I have a table like this: Gender Age Rate Female 0-10 Good Male 0-10 Good Female 11-20 Bad Male 11-20 Bad Male >20 N/A I want to have a summary table including the information that how many answers in each category, sth like this: X
2013 Apr 10
3
how to calculate average of each column
Hey All, I have a large dataset and I want to calculate the average of each column then return a new dataset. Here is my question: I dont know if there is a function that can allow me to calculate the average every 60 records of data in the whole dataset, and return a new data frame. Not sure if I have to divide the dataset first for every 60, then do the mean or can i directly do that. thanks
2013 May 03
3
color by group in ggplot
Hey, I have a dataset like this: ID Var1 Var2 Group A1 1 1 BB A2 1 2 AA B1 2 1 CC B2 1 3 DD C1 1 2 EE I would like to plot the points of Var1 and Var2, use "ID" as X-axis, but color the points by "Group". I can
2013 Apr 16
2
plot 2 y axis
Hi, I want to plot two variables on the same graph but with two y axis just like what you can do in Excel. I searched online that seems like you can not achieve that in ggplot. So is there anyway I can do it in a nice way in basic plot? Suppose my data looks like this: Weight Height Date 0.1 0.3 1 0.2 0.4 2 0.3 0.8 3 0.6 1
2013 May 21
3
add identifier column by row
I want to add identifier column (Date) to a time series data frame. I want to name the "Date" column be from 1 to 30 every 1440 rows. Say I have a data like this (I simply my actual data here): $dat ID Var 1 1 2 4 3 6 4 7 5 7 6 8 How can I add identifier column (Date) from 1 to 3 every 2 rows and have output like this: ID
2013 Jan 04
2
Can you help me please
HI Fares, You could try this: dat1<- read.table(text=" date????? donation 3jan2003?? 20235 4jan2003?? 25655 5jan2003?? 225860 6jan2003?? 289658 7jan2003?? 243889 8jan2003?? 244338 9jan2003?? 243889 ",sep="",header=TRUE,stringsAsFactors=FALSE) The post is not very specific as to what you need.? I hope this works for you. library(xts)
2013 Mar 27
9
conditional Dataframe filling
Hi everyone: This may be trivial but I just have not been able to figure it out. Imagine the following dataframe: a b c d TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE I would like to create a new dataframe, in which TRUE gets 0 but if false then add 1 to the cell to the left. So the results for the example above should be something like: a b c
2013 Apr 29
4
expanding a presence only dataset into presence/absence
Hello, I'm working with a very large dataset (250,000+ lines in its' current form) that includes presence only data on various species (which is nested within different sites and sampling dates). I need to convert this into a dataset with presence/absence for each species. For example, I would like to expand "My current data" to "Desired data": My current data
2013 Feb 17
6
histogram
HI Elisa, You could use ?cut() vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2012 Jul 24
5
First value in a row
Hi. This is likely a trivial problem but have not found a solution. Imagine the following dataframe: Lat Lon x1 x2 x3 01 10 NA NA .1 01 11 NA .2 .3 01 12 .4 .5 .6 I want to generate another column that consist of the first value in each row from columns x1 to x3. That is NewColumn .1 .2 .4 Any input greatly appreciated, Thanks, Camilo Camilo Mora, Ph.D.
2012 Aug 13
4
if else elseif for data frames
Hi all, It seems like I cannot use normal 'if' for data frames. What would be the best way to do the following. if data$col1='high' data$col2='H' else if data$col1='Neutral' data$col2='N' else if data$col='low' data$col2='L' else #chuch a warning? Note that col2 was not an existing column and was newly assigned for this
2013 Jun 10
4
Combining CSV data
Hello R community, I am trying to combine two CSV files that look like this: File A Row_ID_CR, Data1, Data2, Data3 1, aa, bb, cc 2, dd, ee, ff File B Row_ID_N, Src_Row_ID, DataN1 1a, 1, This is comment 1 2a, 1, This is comment 2 3a,
2013 Mar 22
3
Distance calculation
Hi Elisa, I hope this is what you wanted. dat1<-read.csv("peaks.csv",sep=",") #Subset dat2<-dat1[1:5,] res1<-do.call(cbind,lapply(seq_len(nrow(dat2)),function(i) do.call(rbind,lapply(split(rbind(dat2[i,],dat2[-i,]),1:nrow(rbind(dat2[i,],dat2[-i,]))), function(x) {x1<-rbind(dat2[i,],x);
2013 May 07
4
how to calculate the mean in a period of time?
Hi, Your question is still not clear. May be this helps: dat2<- read.table(text=" patient_id????? t???????? scores 1????????????????????? 0??????????????? 1.6 1????????????????????? 1??????????????? 2.6 1????????????????????? 2???????????????? 2.2 1????????????????????? 3???????????????? 1.8 2????????????????????? 0????????????????? 2.3 2?????????????????????? 2???????????????? 2.5
2013 Apr 11
2
group data
Hey, I have a dataset and I want to identify the records by groups for further use in ggplot. Here is a sample data: ID Value AL1 1 AL2 2 CA1 3 CA4 4 I want to identify all the records that in the same state (AL1 AND A2), group them as "AL", and do the same for CA1 and CA4. How can I have an output like: ID Value State AL1 1 AL AL2 2 AL CA1 3 CA CA4 4
2013 Mar 19
4
Copying rows in data frames
Hi, I'm trying to copy the first row of one data frame to another. This is the statement I am using : df2[1,]<-df1[1,]; I have printed them out separately: df1[1,] = A C D E F But after copying: df2[1,] = 96 29 88 122 68 Why isn't it copying? They are both data frames, and "as.character" isn't working either. Thanks for your input :) [[alternative HTML version
2013 Jan 18
3
longitudinal study
Hello R user, I have a data set from a longitudinal study ( sample below) where subjects are followed over time. Second column (status) contains info about if subject is dead or still in the study and third column is time measured in the week. Here is what I need: if status is not dead or unknown take the last week, if status is dead or unknown I need to have corresponding week. Desired resulst:
2012 Aug 07
5
summing and combining rows
Hello, I have a data set that needs to be combined so that rows are summed by a group based on a certain variable. I'm pretty sure rowsum() or rowsums() can do this but it's difficult for me to figure out how it will work for my data based on the examples I've read. My data are structured like this: Plot SizeClass Stems 12 Class3 1 12 Class4
2012 Sep 01
5
R_closest date
Hi, I have encountered an issue about finding a date closest to another date So this is how the data frame looks like: PT_ID IDX_DT OBS_DATE DAYS_DIFF OBS_VALUE CATEGORY 13 4549 2002-08-21 2002-08-20 -1 183 2 14 4549 2002-08-21 2002-11-14 85 91 1 15 4549 2002-08-21 2003-02-18 181 89 1 16 4549 2002-08-21 2003-05-15