search for: df_new

Displaying 10 results from an estimated 10 matches for "df_new".

2012 Jul 19
3
Maintaining Column names while writing csv file.
...df1 and df2 which I am reading from two different csv files. df1 has column names as date, r1, r2, r3 while the dataframe df2 has column names as date, 1w, 2w. (the dates in both the date frames are identical also no of elements in each column are equal say = 10). I merge these dataframes as df_new = merge(df1, df2, by = "date", all = T) So my new data frame has columns as date, r1, r2, r3, 1w, 2w However, if I try to write this new dataframe as a csv file as write.csv(data.frame(df_new), 'df_new.csv', row.names = FALSE) The file gets written, but when I open the csv...
2011 Jan 25
4
Subtracting elements of data.frame
...aving dataframe having multiple columns. I am just giving an example. I need to subtract all the rows of df by the first row of df i.e. I need to subtract each element of 'x' column by 1. Likewise I need to subtract all elements of column 'y' by 11. Thus I need an output like > df_new    x   y 1  0   0 2 13 398 3  2 -62 4 20  -1 5 10  87 As I had mentioned above, I have number of columns in reality and thus I can't use the command say df_new = data.frame(x = df$x-df$x[1], y = df$y-df$y[1]) Kindly guide Thanking you all in advance Regards Vincy [[alternative HTML v...
2018 Jan 03
0
HOW TO FILTER DATA
Try the code below: df <- read_delim("C:/Users/lruan1/Desktop/1112.csv", "|", escape_double = FALSE, trim_ws = TRUE) df_new <- subset(df,df$IPC == 'H04M001/02'| df$IPC == 'C07K016/26' ) You can add more condition with "|" in the subset function. Good luck! On Wed, Jan 3, 2018 at 2:53 PM, Saptorshee Kanto Chakraborty < chkstr at unife.it> wrote: > Hello, > > I have a data of...
2018 Jan 03
3
HOW TO FILTER DATA
Hello, I have a data of Patents from OECD in delimited text format with IPC being one column, I want to filter the data by selecting only certain IPC in that column and delete other rows which do not have my required IPCs. Please, can anybody guide me doing it, also the IPC codes are string variables. The data is somewhat like below, but its a huge dataset containing more than 11 million rows
2016 Apr 11
2
Query about use of format in strptime
..."POSIXlt" "POSIXt" Because of some days (or part of them) might be missing, given a time interval I want to create a new data frame with all time-steps and then merge the new data frame with the old one. In order to create a new data frame with all time-steps, I thought to use df_new <- data.frame(data_strptime=seq(init_day, fin_day, by="30 mins")) and then Snow_all <- merge(df_new, Snow, by=("data_strptime"), all.x=TRUE) My problem is in dealing with init_day and fin_day, respectively for example "200711190000" and "200711210000&quot...
2016 Apr 11
0
Query about use of format in strptime
Hi Stefano, As the help page says: "The default for the format methods is "%Y-%m-%d %H:%M:%S" if any element has a time component which is not midnight, and "%Y-%m-%d" otherwise. This is because when the result is printed, it uses the default format. If you want a specified output representation: format(strptime(init_day, format="%Y-%m-%d-%H-%M"),"%Y-%M-%d
2013 Apr 23
0
Error with function
...____ # libor_tenor_labels can be anything and need not be 15. Also, df need not be consisting of only 4 record. Basically, I can't HARD CODE anything. In df, first tenor is 2w. So I need to define a previous tenor as "1w" and nest tenor as "1m" i.e. I need the output > df_new    tran tenor prev_tenor nxt_tenor 1 tran1    2w         1w        1m 2 tran2    1m         2w        2m 3 tran3    7m         6m        8m 4 tran4    3m         2m        4m # _______________________________________ # I have two special cases also. If the tenor is "o_n" or "12m&qu...
2013 Apr 23
0
Fw: Error with function - USING library(plyr)
...____ # libor_tenor_labels can be anything and need not be 15. Also, df need not be consisting of only 4 record. Basically, I can't HARD CODE anything. In df, first tenor is 2w. So I need to define a previous tenor as "1w" and nest tenor as "1m" i.e. I need the output > df_new    tran tenor prev_tenor nxt_tenor 1 tran1    2w         1w        1m 2 tran2    1m         2w        2m 3 tran3    7m         6m        8m 4 tran4    3m         2m        4m # _______________________________________ # I have two special cases also. If the tenor is "o_n" or "12m&qu...
2013 Apr 23
0
Fw: " PROBLEM SOLVED" - Error with function
...____ # libor_tenor_labels can be anything and need not be 15. Also, df need not be consisting of only 4 record. Basically, I can't HARD CODE anything. In df, first tenor is 2w. So I need to define a previous tenor as "1w" and nest tenor as "1m" i.e. I need the output > df_new    tran tenor prev_tenor nxt_tenor 1 tran1    2w         1w        1m 2 tran2    1m         2w        2m 3 tran3    7m         6m        8m 4 tran4    3m         2m        4m # _______________________________________ # I have two special cases also. If the tenor is "o_n" or "12m&qu...
2016 Apr 11
3
Query about use of format in strptime
Dear R-list users, I need to use strptime because I have to deal with date with hours and minutes. I read the manual for strptime and I also looked at many examples, but when I try to apply it to my code, I always encounter some problems. I try to change the default format, with no success. Why? How can I change the format? 1. init_day <- as.factor("2015-02-24-00-30")