similar to: Data Manipulation, add frequency index

Displaying 20 results from an estimated 10000 matches similar to: "Data Manipulation, add frequency index"

2009 Nov 22
2
Help with indexing
Dear R Helpers, I am missing something very elementary here, and I don't seem to get it from the help pages of the ave, seq and seq_along functions, so I wonder if you could offer a quick help. To use an example from an earlier post on this list, I have a dataframe of this kind: dat = data.frame(name = rep(c("Mary", "Sam", "John"), c(3,2,4))) dat$freq =
2009 Dec 20
2
how to create three new variables? Thanks a lot!
Dear R experts: I have following data structure: student id, exam time and score. I want to create three new columes: 1 st before, 2nd before and 3rd before. For example, for student 1's 4th exam score is assumed to be influenced by his previous three cloest scores, which are 6, 9, and 10 in that order. For student 2's 5th exam score is assumed to be inflenced by her previous cloest
2010 Jan 17
1
how to manipulate this data? Thank you very much!
Hi, R experts: I am asking for helps with manipulating this data: we have different groups: A,B, C, and so on. In each group, we have different students, for example, we have 6 students in A and 5 students in B. Each student gives a rating, which ranges from 1 to 3. We want to manipulate this data and add three more variables called as 1, as 2 and as 3. For example, in group A, for each student,
2012 Mar 08
6
how to modify the tickment of x-axis
hi I plot a series of observation data every minutes in a day as the attachment below plot(wnd,type='l',lty=1,col='red',lwd=1,xlab=xxlab,ylab=yylab,ylim=YY) In the figure, the x-axis tickment is the number of data How can I change it fore example 1h 2h 3h 4h and so on ? -- TANG Jie Email: totangjie at gmail.com Tel: 0086-2154896104 Shanghai Typhoon Institute,China
2010 Apr 26
4
concise syntax for selecting multiple rows
I would like to select rows if a row contains any one of several values. I can do the selection as follows: result[,"Subject"]=="JEFF" | result[,"Subject"]=="BG" But this is very unwieldily if one wishes to select many, many rows as one has to continuously repeat the source: result[,"Subject"]=="JEFF" |
2011 Jun 01
4
subsetting with condition
Dear R Team, I am a new R user and I am currently trying to subset my data under a special condition. I have went through several pages of the subsetting section here on the forum, but I was not able to find an answer. My data is as follows: ID NAME MS Pol. Party 1 John x F 2 Mary s S
2009 Apr 07
2
Frequency table to histogram
I have read a frequency table in to R called "temp." I now want to create a histogram table from it, but I obviously first have to expand the data - to the sample size of 100. I want to use the command rep(), but I'm not sure how to go about it..I tried using the code: temp1<-rep(temp$Chest,100) hist(temp1) But this creates a v. odd histogram so I know it must be wrong!
2013 Jan 15
2
Need some help on Text manipulation.
Dear all, Let say I have following data-frame: Dat <- structure(list(dat = c(-0.387795842956327, -0.23270882099043, -0.89528973290562, 0.95857175595512, 1.61680582493783, -1.17738110289352, 0.210601060411423, -0.827369747447338, -0.36896112964414, 0.440288648776096, 1.28018410608809, -0.897113649961341, 0.342216546981718, -1.17288066266219, -1.57994101992621, -0.913655547602414,
2012 Jan 08
1
mode of frequency distribution table
In a frequency distribution table (bell shaped), how can we find the most frequent range? for example: x = c(1,2, 4,4,4,4, 5,5,5,6,6,5,5,5,5,5,6,6,6,13, 17,17,30,100,300) barplot(table(x)) In the code above, which function do we use to find that the most frequent value range from 4 to 6. Thanks. -- ------------- Mary Kindall Yorktown Heights, NY USA [[alternative HTML version deleted]]
2013 Feb 19
2
how to change the plot from X-axis to Y-axis
hello ,Rusers: I have a dataset for example totdata=c(8.020 7.412 8.110 8.270) plot(totdata[1:4],type='l',pch=1,lty=1,col='blue',lwd=1) and the data could be plotted as the attachment figure. now I want to exchange its x-axis and y-axis in the figure .How could I modify the plot command ? thank you -- TANG Jie
2011 Sep 02
2
how to return back to go on my cycle while read my files
hi ,when i read a lots of files for (i in 1:totnum) { cop_x_data<-read.table(flnm[i],skip=2) if(i==1) {cop_data=cop_x_data} else {cop_data=rbind(cop_data,cop_x_data)} } some of the files are missing . so this loop can not go on .I wonder how can I go on the loop cycle while reading the files just like the command read(unit,err=linenum) in fortran ? thank you . -- TANG Jie [[alternative
2009 Nov 06
2
how can I delete those columes with the same element in every row?
e.g. a= a b c d e 1 1 1 3 1 1 2 1 2 3 4 5 3 1 3 3 8 3 4 1 4 3 3 5 5 1 1 3 1 1 I want to delete colume a and colume c, because they have the same values in every row, then ,I want to get this data.frame . b= b d e 1 1 1 1 2 2 4 5 3 3 8 3 4 4 3 5 5 1 1 1 the following is my code but it's wrong. rm(list=ls()) a=c(1,1,1,1,1); b=c(1,2,3,4,1); c=c(3,3,3,3,3);
2012 Jan 12
1
relative frequency plot using ggplot or other function
Hi I have a data frame in the following form. There are two groups and for each 'width' relative frequency for group1 and group2 is given. How to plot this in R using ggplot or other package. Width relativeFrequency1 relativeFrequency2 1 100 0.0006388783 0.02265428 2 200 0.0022677303 0.02948625 3 300 0.0061182673 0.01739936 4 400 0.0152237225 0.02569902 5 500
2007 Mar 26
1
data-frame adding/deleting column
Hallo, I have got an existing data frame and want to add a new column. The existing data frame was created like this: > df <- rbind( c("Fred", "Mary", 4), c("Fred", "Mary", 7), + c("Fred", "Mary", 9), c("Barney", "Liz", 3), + c("Barney", "Liz", 5) ) > df
2010 Oct 07
3
aggregate text column by a few rows
Hi, R function aggregate can only take summary stats functions, can I aggregate text columns? For example, for the dataframe below, > a <- rbind(data.frame(id=1, name='Tom', hobby='fishing'),data.frame(id=1, name='Tom', hobby='reading'),data.frame(id=2, name='Mary', hobby='reading'),data.frame(id=3, name='John',
2009 Mar 26
2
Analogy for %in% for the whole columns (rather than individual values)
Hello! I have a matrix a with 2 variables (see below) that contain character strings. I need to create a 3rd variable that contains True if the value in column x is equal to the value in column y. The code below does it. a<-data.frame(x=c("john", "mary", "mary", "john"),y=c("mary","mary","john","john"))
2010 Apr 02
2
panel data
Hello, I have an unbalanced panel data set that looks like: ID,YEAR,HEIGHT Tom,2007,65 Tom,2008,66 Mary,2007,45 Mary,2008,50 Harry,2007,62 Harry,2008,62 James,2007,68 Jack,2007,70 Jordan,2008,72 That is, James, Jack, and Jordan are missing a YEAR. Is there any command that will "fill in" the missing YEAR such that the end result will be balanced and look like: ID,YEAR,HEIGHT
2011 Jul 04
1
placing multiple rows in a single row
Dear people from the R help list, I have a question that I can't get my head around to start answering, that is why I am writing to the list. I have data in a format like this (tabs might look weird): John A1 1 0 1 John A2 1 1 1 John A3 1 0 0 Mary A1 1 0 1 Mary A2 0 0 1 Mary A3 1 1 0 Peter A1 1
2007 Oct 09
2
read sas data into R
Hi I am having trouble using read.ssd. Can someone help? The code that I have written is *sashome<-"C:/Mary/Datasets"* *read.ssd(read.ssd(file.path(sashome, "core", "sashelp"), "surv_1v",* *sascmd = file.path(sashome, "sas.exe"))* Here the path that I have given is correct, where the dataset surv_1v.sas7bdat is kept. The message that R gives
2013 Apr 13
1
Reshaping Data for bi-partite Network Analysis [SOLVED]
Wow ! so many thanks Arun and Rui works like a charm problem solved 2013/4/13 arun <smartpink111@yahoo.com> > Hi, > Try this; > library(reshape2) > res<-dcast(Input,people~place,value.var="time") > res[is.na(res)]<-0 > res > # people beach home school sport > #1 Joe 5 3 0 1 > #2 Marc 0 4 2 0 > #3 Mary