similar to: Converting factor into date

Displaying 20 results from an estimated 20000 matches similar to: "Converting factor into date"

2011 Aug 30
3
Simulating distribution of max of two die
Hallo I am teaching a very elementary intro course about R, and want to show the students how to find the distribution of the maximum of rolling two balanced die. Is there perhaps a more elegant way to do this, other than the way I am using below? (I would like to show them two ways - the one shown here, and perhaps and improved/elegant approach (showing off the "beauty" of R.
2011 Oct 24
2
Date column in downloaded date
Hi All: If I download yahoo data by getSymbols() in R, the date column gets accompanied along with the downloaded data. There is no column header for the date column to access separately. What is the way to eliminate the date column? If I want to draw a xy scatter plot with the downloaded price (suppose AAPL vs NASDAQ), I think the date column is creating problem and the plot function is not
2011 Aug 18
2
Selecting subset of factor levels
Dear r-help, I would like to select a subset of levels from a factor variable in a data frame and return a data frame. The data set consists of 3 variables, 2 of which are factors (Site, Fish) and one numeric (Datavalue) as follows: Site Fish Datavalue AB 2-1 2.3 AB 2-1 2.4 AB 2-1 2.2 AB 2-2 2.6 AB 2-2 2.5 AB 2-2 2.7 AB 2-3
2013 Feb 19
5
Converting the data in year month day hour and minutes to date
Hi , I am trying to convert the date as factor to date using "as.date" function in R. I have the date in the following format 2008-01-01 02:30 I tried to use the following command : as.Date(mydata$Date, format="%y-%m-%d ") Can somebody help me with this ? I was able to convert the format with no hour but getting difficulty with hour included. Thank you.
2011 Aug 15
3
write.table extra column
In the following data.frame there are 6 columns, but 7 are written to the CSV file. install.packages("pmlr") library(pmlr) data(enzymes) write.table(enzymes, sep=",", eol="\n",file="albert.csv")
2018 Mar 27
5
unable to move temporary installation of package
Thanks, Here's the error, for example: > install.packages("mgcv") Installing package into 'C:/Users/pl39/Documents/R/win-library/3.4' (as 'lib' is unspecified) trying URL 'https://mirrors.nics.utk.edu/cran/bin/windows/contrib/3.4/mgcv_1.8-23.zip' Content type 'application/zip' length 2775362 bytes (2.6 MB) downloaded 2.6 MB package 'mgcv'
2012 May 02
3
Numeric data not numeric in .csv file
I am a raw novice to R, playing around with a mini .csv dataset created in Excel. I can read it in and the data looks OK in Excel and upon initial inspection in R: hikes <- read.csv("/Users/eproper/Desktop/hikes.csv", header=TRUE) print(hikes) does exactly what it is supposed to do. Two of the variables are genuine strings, but the others ought to be numeric, and R will calculate
2011 Jul 19
3
How to get predicted values of y for different x values?
Here is my model with interaction terms and control variables (I changed variables names for easy read): reg1 <- lm(y ~ x1*x2*x3 +control1 + control2 + control3) x1 ranges from 0 to 6; x2 from 0 to 5; and x3 from 0 to 4. All three are discrete ordinal variables; but I will treat them as continuous variables. (a) How can I see the predicted values of y for each of these scenarios (210
2017 Jun 29
0
Different date formats in one column
I doubt your actual file looks like the mess that made it to my email software (below) because you posted HTML-format email. Read the Posting Guide, and in particular figure out how to send plain text email. You might try the "anytime" contributed package, though I suspect it too will choke on your mess. Otherwise, that will pretty much leave only a brute-force series of regular
2011 May 23
2
days between dates
Hello, I have some unbalanced panel data that is measured on weekdays only (i.e., excluding Saturday and Sunday). I would like to get the number of days between dates such that the number of days between a Friday and a Monday is 1 (and not 3). Here is some code to illustrate my problem: library('Hmisc'); DATE <-
2018 Mar 27
0
unable to move temporary installation of package
Do you have other instances of R open at the time you are doing this? Did you already have mgcv installed in your personal library when you tried installing it again? There is clearly something preventing you from writing to your library, or at least to specific packages in your library. On Tue, 27 Mar 2018, Paul Lantos wrote: > Thanks, > > Here's the error, for example: >
2018 Mar 27
2
unable to move temporary installation of package
I deleted my library, reinstalled R, and had the same issue -- couldn't install anything into its newly created library. -----Original Message----- From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.ca.us] Sent: Tuesday, March 27, 2018 2:26 PM To: Paul Lantos <paul.lantos at duke.edu> Cc: r-help at r-project.org Subject: RE: [R] unable to move temporary installation of package Do you
2011 Aug 02
1
My R code is not efficient
Dear R users, I have two n*1 integer vectors, y1 and y2, where n is very very large. I'd like to compute elbp = 4^(y1) * 5^(y2) * sum_{i=0}^{max(y1, y2)} [{ (y1-i)! * (i)! * (y2-i)! }^(-1)]; that is, I need to compute "elbp" for each (y1, y2) pair. So I made R code like below, but I don't think it's efficient Would you plz tell me how to avoid this "for"
2017 Jun 28
4
Different date formats in one column
Hi,? I have a data set with various date formats in one column and not sure how to unify it.Here is a few formats: 02091702/22/170221201703/17/160015-08-239/2/1500170806May-2-201522-March-2014 I tried parse_date_time from lubridate library but it failed.Thanks so much.?Best,Farnoosh [[alternative HTML version deleted]]
2012 Dec 07
2
Converting character to numeric: Error: (list) object cannot be coerced to type 'double'
Dear R users, I am facing a pretty a unusual problem while converting character to numeric. Any input would be appreciated. Below is the code and error faced: --------------------------------------- *> str(cmie.dts)* *'data.frame': 4397 obs. of 1 variable:* * $ INE001A01036: chr "1482181740.000000" "1482181740.000000" "1482181740.000000"
2011 Oct 25
2
difftime producing NA values in R 2.12.2
R-listers, I have noticed several posts on issues with difftime producing NA's but they have been for older versions of R. Here's the issue associated with difftime that I am dealing with in R 2.12.2. > preciptime = strptime("01/10/2007 14:00",format="%m/%d/%Y %H:%M") > class(preciptime) [1] "POSIXlt" "POSIXt" > # Now using difftime, this
2011 Jul 04
1
R CMD SHLIB with ifort
Hi, I am running Linux (64 bit) R, compiled under gnu compilers. I am looking to compile a Fortran program with the ifort (the intel compiler) and then be able to import that as a library into my version of R. I am using the flags FC=ifort and SHLIB_FCLD=ifort, however ifort does not seem to recognize the libR.so file. Does any one have experience with this/know of a a way to load an ifort
2011 Nov 11
1
rbind.data.frame drops attributes for factor variables
Hi all, When I use rbind() or rbind.data.frame() to add a row to an existing dataframe, it appears that attributes for the column of type "factor" are dropped. I see the following post with same problem. However i did not see any reply to the following posting offering a solution. Could someone please help.
2012 Nov 18
1
dealing with Date vars
Hi all, I'm writing a function that summarizes objects, however, when a Date variable is present in the objects it doesn't work. How can I handle with this problem? D
2012 Dec 26
3
Working with date
Hi, Let say I have a date variable: > ?asd <- as.Date("2012-01-03") > asd [1] "2012-01-03" Now, I want to express this date like 3/1/2012. can somebody help me how to achieve that? Thanks,