2016-04-29 1 views
-2

Ich erhalte den folgenden Fehler beim Konvertieren eines SignInDate Vektors in Datumswerte. Ich betreibe es online unter Tutorialspoint.Datum Vektor in R

Fehler in charToDate (x):
Zeichenkette nicht in einem Standard-Format eindeutig
Anrufe: as.Date -> as.Date.character -> charToDate
Ausführung gestoppt

Code:

SignInDate <- c("8-Apr-14","9-Apr-14","10-Apr-14","11-Apr-14","14-Apr-14","15-Apr-14","16-Apr-14","17-Apr-14","18-Apr-14","21-Apr-14","22-Apr-14","23-Apr-14","24-Apr-14","25-Apr-14","28-Apr-14","29-Apr-14","2-May-14","5-May-14","6-May-14","7-May-14","8-May-14","9-May-14","12-May-14","13-May-14","14-May-14","15-May-14","16-May-14","19-May-14","20-May-14","21-May-14","22-May-14","23-May-14","26-May-14","27-May-14","28-May-14","29-May-14","30-May-14","2-Jun-14","3-Jun-14","4-Jun-14","5-Jun-14","6-Jun-14","9-Jun-14","10-Jun-14","11-Jun-14","12-Jun-14","13-Jun-14","16-Jun-14","17-Jun-14","18-Jun-14","19-Jun-14","20-Jun-14","23-Jun-14","24-Jun-14","25-Jun-14","26-Jun-14","27-Jun-14","30-Jun-14","1-Jul-14","2-Jul-14","3-Jul-14","4-Jul-14","7-Jul-14","8-Jul-14","9-Jul-14","10-Jul-14","11-Jul-14","14-Jul-14","15-Jul-14","16-Jul-14","17-Jul-14","18-Jul-14","21-Jul-14","22-Jul-14","23-Jul-14","24-Jul-14","25-Jul-14","4-Aug-14","5-Aug-14","6-Aug-14","7-Aug-14","8-Aug-14","11-Aug-14","12-Aug-14","13-Aug-14","14-Aug-14","18-Aug-14","20-Aug-14","21-Aug-14","22-Aug-14","23-Aug-14","25-Aug-14","26-Aug-14","27-Aug-14","28-Aug-14","1-Sep-14","3-Sep-14","4-Sep-14","5-Sep-14","8-Sep-14","9-Sep-14","10-Sep-14","11-Sep-14","12-Sep-14","15-Sep-14","16-Sep-14","17-Sep-14","18-Sep-14","19-Sep-14","22-Sep-14","23-Sep-14","24-Sep-14","25-Sep-14","26-Sep-14","29-Sep-14","30-Sep-14","1-Oct-14","6-Oct-14","7-Oct-14","8-Oct-14","9-Oct-14","10-Oct-14","13-Oct-14","14-Oct-14","15-Oct-14","16-Oct-14","17-Oct-14","20-Oct-14","21-Oct-14","22-Oct-14","27-Oct-14","28-Oct-14","29-Oct-14","30-Oct-14","31-Oct-14","3-Nov-14","4-Nov-14","5-Nov-14","6-Nov-14","7-Nov-14","10-Nov-14","11-Nov-14","12-Nov-14","13-Nov-14","14-Nov-14","17-Nov-14","18-Nov-14","19-Nov-14","20-Nov-14","21-Nov-14","24-Nov-14","27-Nov-14","28-Nov-14","1-Dec-14","2-Dec-14","3-Dec-14","4-Dec-14","5-Dec-14","8-Dec-14","9-Dec-14","10-Dec-14","11-Dec-14","12-Dec-14","15-Dec-14","16-Dec-14","17-Dec-14","18-Dec-14","19-Dec-14","22-Dec-14","23-Dec-14","24-Dec-14","26-Dec-14","5-Jan-15","6-Jan-15","7-Jan-15","8-Jan-15","9-Jan-15","12-Jan-15","13-Jan-15","15-Jan-15","16-Jan-15","19-Jan-15","20-Jan-15","21-Jan-15","22-Jan-15","23-Jan-15","27-Jan-15","28-Jan-15","29-Jan-15","30-Jan-15","2-Feb-15","3-Feb-15","6-Feb-15","9-Feb-15","10-Feb-15","11-Feb-15","12-Feb-15","13-Feb-15","16-Feb-15","17-Feb-15","18-Feb-15","19-Feb-15","20-Feb-15","23-Feb-15","24-Feb-15","25-Feb-15","26-Feb-15","27-Feb-15","2-Mar-15","3-Mar-15","4-Mar-15","5-Mar-15","6-Mar-15","9-Mar-15","10-Mar-15","11-Mar-15","12-Mar-15","13-Mar-15","16-Mar-15","17-Mar-15","18-Mar-15","19-Mar-15","20-Mar-15","23-Mar-15","25-Mar-15","26-Mar-15","27-Mar-15","30-Mar-15","31-Mar-15","2-Apr-15","3-Apr-15","7-Apr-15","8-Apr-15","9-Apr-15","10-Apr-15","13-Apr-15","14-Apr-15","15-Apr-15","16-Apr-15","17-Apr-15","20-Apr-15","21-Apr-15","22-Apr-15","23-Apr-15","24-Apr-15","29-Apr-15","30-Apr-15","4-May-15","5-May-15","6-May-15","7-May-15","8-May-15","11-May-15","12-May-15","13-May-15","14-May-15","15-May-15","18-May-15","19-May-15","20-May-15","21-May-15","22-May-15","25-May-15","26-May-15","27-May-15","28-May-15","29-May-15","1-Jun-15","3-Jun-15","4-Jun-15","5-Jun-15","9-Jun-15","10-Jun-15","11-Jun-15","12-Jun-15","15-Jun-15","16-Jun-15","17-Jun-15","18-Jun-15","19-Jun-15","23-Jun-15","24-Jun-15","25-Jun-15","26-Jun-15","29-Jun-15","30-Jun-15","1-Jul-15","2-Jul-15","3-Jul-15","6-Jul-15","7-Jul-15","8-Jul-15","9-Jul-15","10-Jul-15","13-Jul-15","14-Jul-15","15-Jul-15","16-Jul-15","17-Jul-15","27-Jul-15","28-Jul-15","29-Jul-15","30-Jul-15","31-Jul-15","3-Aug-15","4-Aug-15","5-Aug-15","6-Aug-15","7-Aug-15","10-Aug-15","11-Aug-15","12-Aug-15","13-Aug-15","14-Aug-15","17-Aug-15","18-Aug-15","19-Aug-15","20-Aug-15","21-Aug-15","24-Aug-15","25-Aug-15","26-Aug-15","27-Aug-15","28-Aug-15","31-Aug-15","1-Sep-15","2-Sep-15","3-Sep-15","4-Sep-15","7-Sep-15","8-Sep-15","9-Sep-15","10-Sep-15","11-Sep-15","14-Sep-15","15-Sep-15","16-Sep-15","18-Sep-15","21-Sep-15","22-Sep-15","23-Sep-15","28-Sep-15","29-Sep-15","30-Sep-15","1-Oct-15","6-Oct-15","7-Oct-15","8-Oct-15","9-Oct-15","12-Oct-15","13-Oct-15","14-Oct-15","15-Oct-15","16-Oct-15","19-Oct-15","20-Oct-15","21-Oct-15","23-Oct-15","26-Oct-15","27-Oct-15","28-Oct-15","29-Oct-15","30-Oct-15","2-Nov-15","3-Nov-15","4-Nov-15","5-Nov-15","6-Nov-15","9-Nov-15","10-Nov-15","12-Nov-15","13-Nov-15","16-Nov-15","17-Nov-15","18-Nov-15","19-Nov-15","20-Nov-15","23-Nov-15","24-Nov-15","25-Nov-15","26-Nov-15","27-Nov-15","30-Nov-15","1-Dec-15","2-Dec-15","3-Dec-15","4-Dec-15","7-Dec-15","8-Dec-15","9-Dec-15","10-Dec-15","11-Dec-15","14-Dec-15","15-Dec-15","16-Dec-15","17-Dec-15","18-Dec-15","28-Dec-15","29-Dec-15","30-Dec-15","31-Dec-15","1-Jan-16","4-Jan-16","5-Jan-16","6-Jan-16","7-Jan-16","8-Jan-16","11-Jan-16","12-Jan-16","13-Jan-16","14-Jan-16","15-Jan-16","18-Jan-16","19-Jan-16","20-Jan-16","21-Jan-16","22-Jan-16","25-Jan-16","28-Jan-16","29-Jan-16","1-Feb-16","2-Feb-16","3-Feb-16","4-Feb-16","5-Feb-16","8-Feb-16","9-Feb-16","10-Feb-16","11-Feb-16","12-Feb-16","15-Feb-16","16-Feb-16","17-Feb-16","18-Feb-16","19-Feb-16","22-Feb-16","23-Feb-16","24-Feb-16","25-Feb-16","26-Feb-16","29-Feb-16","1-Mar-16","2-Mar-16","3-Mar-16","4-Mar-16","7-Mar-16","8-Mar-16","9-Mar-16","10-Mar-16","11-Mar-16","14-Mar-16","15-Mar-16","16-Mar-16","17-Mar-16","18-Mar-16","21-Mar-16","22-Mar-16","23-Mar-16","24-Mar-16","28-Mar-16","29-Mar-16","30-Mar-16","31-Mar-16") 

AttendanceHours <- c(7.2,10.8,11.3,8,11.55,10.12,10.8,9.2,12.05,11.77,9.88,9.88,11.73,11.4,9.78,10.88,10.58,10.45,11.72,10.17,10.28,9.58,10.45,11.2,9.87,10.8,10.33,9.23,10.35,9.73,9.45,8.7,9.1,8.35,9.47,10.1,10.37,9.9,10,8.78,10.2,10.83,10.63,10.17,11.17,12.13,9.73,8.48,12.8,9.8,10.58,9.37,10.1,9.82,11.73,10.28,10.07,8.67,10.4,10.3,9.02,8.17,9.1,9.23,11.45,9.8,10.78,9,8.42,8.88,9.08,9.98,9.35,9.03,9.6,10.45,4.87,7.23,10.05,9.22,9.93,9.3,9.85,9.55,8.85,9.38,10.52,9.82,9.2,10.18,5.5,10.15,9.72,9.87,8.27,11.18,10.53,10.02,10.85,10.03,8.4,10.08,8.93,11.05,10.05,10.63,10.6,10.55,11.48,10.32,11.45,12.12,12.08,12.07,10.35,9.58,9.5,7.47,8.78,8.48,9.58,9.42,9.13,9.05,8.75,12.62,13.87,9.27,9.95,8.23,10.35,8.72,8.85,9.15,9.48,9.67,9.42,9.25,8.52,8.67,9.25,9.4,8.6,8.48,9.83,8.82,10.22,8.52,9.13,8.9,10.33,10,10.18,9.92,9.55,9.18,9.18,8.52,8.82,9.07,9.8,10.77,8.35,8.9,8.47,8.2,8.17,8.58,9.03,9.5,8.83,3.77,4.72,11.55,9.08,9.95,8.68,9.62,8.85,10.28,10.3,9.45,9.57,9.12,9.73,8.35,9.05,9.83,8.9,9.2,9.32,8.57,10.17,9.63,8.8,8.98,9.1,9.97,9.65,9.35,10.15,8.75,10.08,8.57,9.67,10.52,8.5,8.25,10.65,10.15,11.13,9.47,9.38,9.87,9.55,10.3,10.08,8.45,9.63,9.73,8.53,9.18,9.83,9.8,9.2,9.67,8.32,8.57,8.67,8,8.47,9.85,9.2,10.25,9.07,10.03,8.12,10.32,10.58,10.65,10.38,9.03,10.43,10.55,11.92,11.52,9.73,9.17,9.95,9.67,9.3,9.5,9.62,10.77,9.15,8.35,9.97,9.35,9.7,10.02,9.43,9.77,9.68,8.35,8.48,8.6,8.55,9.33,8.77,8.32,9.15,9.58,11.27,8.35,10.18,9.83,9.03,6.18,9.53,9.65,8.5,8.68,9.07,9.92,7.8,9.4,9.35,8.18,8.95,10.1,9.23,7.75,9.27,10.33,9.6,10.02,10.17,8.88,8.17,3.92,8.92,10.87,8.95,8.3,8.07,9.07,8.8,8.45,7.4,8.15,9.17,9.57,7.9,9.4,10.32,11.27,9.02,9.73,7.98,9.3,10.05,9.78,8.57,9.35,8.7,9.03,10.53,10.38,9.3,9.22,9.3,9.45,8.75,9.27,9.77,9.5,9.02,7.88,9.75,8.93,9.92,10.1,8.38,10.28,8.42,11.12,8.28,10.1,10.83,8.75,7.18,10.48,10.57,7.25,9.12,8.6,7.93,7.57,9.82,9.28,8.55,9.38,11.2,8.3,6.9,7.57,11.2,7.15,9.78,9.42,10.32,8.95,9.77,9.05,10.38,7.35,8.65,10.12,6.67,12.62,8.68,11.5,10.27,8.03,10.85,12.92,10.42,9.72,9.27,9.08,8.87,11.78,9.72,6.7,8.95,8.83,4.3,6.38,4.85,9.43,10.47,11.78,6.25,10.27,9.22,9.93,9.83,9.4,10.02,10.78,11.22,12.08,11.7,14.22,13.18,14.57,9.87,7.82,9.32,10.77,10.47,9.5,9.7,9.5,10.22,7.75,7.48,10.48,7.55,8.55,11.62,9.87,8.73,10.13,11.45,10.72,11.57,9.57,9.78,9.03,10.62,9.77,10.25,10.38,7.95,8.72,7.72,8.13,9.22,8,12.13,11.32,10.62,11.8,11.12,9.4,11.72,9.98,11.52,7.37,11.87,9.32,12.6) 

    SignInDate <- as.Date(SignInDate) 
    class(SignInDate)  
    AttendanceData <- c(SignInDate, AttendanceHours) 
    plot(AttendanceHours, SignInDate) 

Antwort

1

Sie müssen die format bereitzustellen und t zuweisen er Ergebnis zurück (as.Date als grundsätzlich jede andere R-Funktion nicht durch Bezugnahme handelt). Versuchen:

SignInDate<-as.Date(SignInDate,format="%d-%b-%y") 
0

<center> 
 
<table border="1"> 
 
<tr><td>Code</td><td>Value</td></tr> 
 
<tr><td><tt>%d</tt></td><td>Day of the month (decimal number)</td></tr> 
 
<tr><td><tt>%m</tt></td><td>Month (decimal number)</td></tr> 
 
<tr><td><tt>%b</tt></td><td>Month (abbreviated)</td></tr> 
 
<tr><td><tt>%B</tt></td><td>Month (full name)</td></tr> 
 
<tr><td><tt>%y</tt></td><td>Year (2 digit)</td></tr> 
 
<tr><td><tt>%Y</tt></td><td>Year (4 digit)</td></tr></table> 
 

 
</center>

Dies wird in dem Formatparameter in As.Date verwendet() in R