similar to: Reshaping a dataframe

Displaying 20 results from an estimated 700 matches similar to: "Reshaping a dataframe"

2012 Nov 18
3
Replace <NA> with something else
I am reading some data into R from an Excel spreadsheet using read.csv. Some of the original data that comes into column 1 from the spreadsheet is text that says NA. The NA stands for north america. As it comes in, R converts the NA over to <NA>. What is the cleanest way to change the <NA> values to something else. In other words, get rid of the brackets ? Maybe convert <NA>
2007 Sep 27
1
converting numbers in "YYYYMM" format to last calendar day and last exchange trading day of the month
I have a vector that contains month and year in the format YYYYMM (e.g.“200701”, “200702”) I wish to do to things: 1. I need to convert to a date that is the last calendar day of each month. 2. I need to convert this to a date that is the last U.S. stock-exchange trading day of each month. Any advice is appreciated, mymonths <- c(200701, 200702)
2012 Jan 18
1
Problems with Panel Data estimation
Hi everybody, Got some doubts here. I'm kinda desperate for help, so please ask me if anything isn't clear. I have a database with this structure (panel data structure): > head(dados_2) Tempo Safra Data Resposta Perc_Resg_Acum Alta_Temporada Flexi Promo 1 1 1 200701 0.04223216 0 1 0 0 2 1 2 200702 0.02801536 0
2012 Dec 28
3
help with reshaping wide to long format
Hi, Sorry, but how did you bring it out? Thanks On Fri, Dec 28, 2012 at 8:48 AM, arun kirshna [via R] < ml-node+s789695n4654093h10@n4.nabble.com> wrote: > Hi, > bp.sub<- structure(list(CODEA = c(1L, 3L, 4L, 7L, 8L, 9L, 10L, 11L, 12L, > 13L, 14L, 16L, 17L), C45 = c(NA, 2L, 2L, 2L, 2L, 1L, NA, 1L, > 1L, 2L, 1L, 2L, 1L), ragek = c(3L, 3L, 3L, 4L, 4L, 3L, 3L, 3L, > 3L, 3L,
2012 Oct 17
3
subtotals based on price bands?
I would like to create a subtotal table with custom bands. seq1 = seq(0, 100, by = 5) seq2 = seq(100, 1000, by = 100) Bands = c(seq1, seq2) #Prices Prices = sample(1:1000, 200, replace=F) #corresponding size for the given price above. size = sample(1:1000, 200, replace=F) How would I find the subtotal of the size based on a given price falls within a band? -- View this message in
2012 Nov 10
3
matrix of all difference between rows values
Hello all, i would like to calculate the difference of all row values and the others row values from my matrix (table 1). The output (table 2) would be a matrix with input matrix's row names on row names and colums names, thereby the difference values among two of the row names could be bether found. Could someone help me? Examples: Table 1: a 10 b
2012 Nov 12
3
select different variables from a list of data frames
Hi: How do I select different variables from a list of data frames. I have a list of 13 that looks like below. Each data frame has more variables than I need. How do I go through the list and select the variables that I need. In the example below, I need to get the variables "a", and "q10" and "q14" to be returned to two separate data frames. Thank you. Yours, Simon
2010 Apr 21
5
Xen 4.0 memory overcommitment
Hello, I am running a functional Xen 4.0 platform. The objective is the project I am currently running is to replace 4 VMWare ESX by 4 Xen 4.0 hypervisors. I have been able to reproduce all the core VMWare features in Xen (but better of course =D) except memory overcommitment. I know this feature has been included since Xen 3.3 but I have found almost no information about it. When I try to
2013 Mar 21
2
Displaying median value over the horizontal(median)line in the boxplot
Hi, set.seed(45) test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data apply(test1,2,function(x) sprintf("%.1f",median(x))) #columnA columnB # "44.5"? "10.2" par(mfrow=c(1,2)) lapply(test1,function(x) {b<-
2012 Sep 11
5
Searching from Dataframe.
Hi, i have a dataframe containing some values. for eg:- MyDataFrame<- Name Age Place ------- ------ ----------- Aby 12 USA Raj 25 UK Romi 32 ENG Amy 31 IND My requirement what is, i have a search key word[it should search from all the columns], that i need to find out from this dataframe. If search keyword found , it
2013 Jan 27
1
Removing values containing a specific character
Awesome, thanks Arun, that's exactly what I was looking for! On Sat, Jan 26, 2013 at 9:21 PM, arun kirshna [via R] < ml-node+s789695n4656749h63@n4.nabble.com> wrote: > Hi, > Try this: > df[]<-lapply(df,as.character) > df2<-df > df[,1][grep("@",df$names)]<- "" > df > #names emails > #1 bob bobj@cup.com > #2
2012 Nov 22
4
Using cumsum with 'group by' ?
Hi, First post here. Grateful for any help you can give. I have data which looks like this: id time x 1 12:01 5 1 12:02 14 1 12:03 6 1 12:04 3 2 12:01 98 2 12:02 23 2 12:03 1 2 12:04 4 3 12:01 5 3 12:02 65 3 12:03 23 3 12:04 23 But I want to add a column which is the cumulative sum of X, but only by id. I've used cumsum before, but not
2012 Oct 12
7
ifelse reformulation
Hi, i'm trying to simplify some R code but i got stucked in this: test<-data.frame(cbind(id,x1,x2,x3,x4,x5,x6,x7)) test > test id x1 x2 x3 x4 x5 x6 x7 1 1 36 26 21 32 31 27 31 2 2 45 21 46 50 22 36 29 3 3 49 47 35 44 33 31 46 4 4 42 32 38 28 39 45 32 5 5 29 42 39 48 25 35 34 6 6 39 31 30 37 46 43 44 7 7 41 40 25 23 42 40 24 8 8 27 29 47 34 26 38 28 9 9 25 35 29 36
2013 Jan 20
1
applying a formula from text
Dear Arun, I am a novice in R bu some my friends that use R for a long time were not able to help me. Thank you really. Concerning your question why I need it, I think that it can be situations where the condition, that I have to apply, depends on the data. May be you can advice me a good text to learn programming in R. Thank you again. Ilya Novikov Sat, Jan 19, 2013 at 8:02 PM, arun kirshna [via
2013 Feb 01
29
cumulative sum by group and under some criteria
Thank you very much for your reply. Your code work well with this example. I modified a little to fit my real data, I got an error massage. Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : Group length is 0 but data length > 0 On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] < ml-node+s789695n4657196h87@n4.nabble.com> wrote: > Hi, > Try this: >
2013 Mar 21
1
plot and save as png
Hi A.K This is working layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() but if I add this line png(filename = "fname.png", width = 900, height = 600, units = 'px') no plot is generated. where is the problem?. thanks veepsirtt > png(filename = "fname.png", width =
2010 Jul 21
2
Issues reshaping data
Hello All, I'm having some trouble reshaping my data from wide to long format. I have tried using both the reshape function and package. Although I haven't worked much with the reshape function, I have found the reshape package useful and intuitive for reshaping data from long to wide format. However, going the other way has me stumped with this type of data. My data is set up, roughly,
2008 Mar 10
1
state space model for poisson distribution
Hi Rers, I have a poission time series model with 5 parameters. I just wanted to remove two of the lag on response in the model and put it as a system model. I am not sure about the codes to combine these two on R. If anybody has any R example (code), please post it. My original model: log(Y(t))~constant+b1*Y(t-1)+b2*Y(t-2)+b3*(variable1)+b4*(variable2)+e I would like to construct a
2010 Mar 29
2
Reshaping a data frame with a series of factors and 23 repeated measures
I have a data frame that I created using read.table on a csv spreadsheet. The data look like the following: Steer.ID stocker.trt Finish.trt Date Days Wt ...... Steer.Id, stocker.trt, Finish.trt are factors------ Date, Days, Wt are data that are repeated 23 times (wide format). I want to reshape the data such that I have the correct Steer.ID, stocker.trt, Finish.trt identifying all of
2012 Jun 09
2
Reshaping columns
Dear all, I have a data frame with 2 columns and 102500 rows. The data looks like below V1 V2 8098 110000....... 9099 001100....... 0023 110011....... 6545 111111....... . . . . . . . . . . I want to split the colums like this ; V1 V2 V3 V4 V5 V6 v7 8098 1 1 0 0 0 0 ...... 9099