R markdown

17 views
Skip to first unread message

Tom Haber

unread,
Apr 30, 2015, 4:44:31 AM4/30/15
to israel-r-...@googlegroups.com
שלום , 

r markdown   בעזרת  pfd  אני מנסה ליצור קובץ 

pfd הביעה היא שבחלק מהפלטים שלי ציר איקס כתוב בחודשים בעברית ולא ניתן לייצא כקובץ
 
pfd אלא רק כוורד מכיוון שבפלטים יש כיתוב בערבית , האם יש דרך להתגבר על הבעיה כך שאוכל לייצא   

תודה רבה ,

תום

Jonathan Rosenblatt

unread,
May 3, 2015, 1:48:22 AM5/3/15
to israel-r-user-group
האם תוכל לצרף קוד לדוגמה?

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jonathan Rosenblatt
www.john-ros.com

Tom Haber

unread,
May 3, 2015, 7:46:11 AM5/3/15
to israel-r-...@googlegroups.com
שלום, כמובן הנה הקוד לדוגמה , 

---
title: "r"
output:
  pdf_document:
    latex_engine: xelatex
---


```{r}
getwd()
x<-read.table("C:/Users/Tom/Downloads/dow_jones_index.data",header=T,sep=",")
y <- x$stock
y <- as.data.frame(y)
y$date <- x$date
y$open <- x$open 
y$close <- x$close 
names(y)[1] <- "stock"
head(y)
```

```{r}
r<- c(seq(y$stock)[y$stock=="KO"],seq(y$stock)[y$stock=="KRFT"],
       seq(y$stock)[y$stock=="MCD"],seq(y$stock)[y$stock=="T"],
       seq(y$stock)[y$stock=="CSCO"],seq(y$stock)[y$stock=="VZ"],
       seq(y$stock)[y$stock=="JNJ"],seq(y$stock)[y$stock=="MRK"],
       seq(y$stock)[y$stock=="PFE"])

w <- y[r,]
w$catagory <- ""
head(w)
w$catagory[which(w$stock=="KO")] <- "beverage&drinks"
w$catagory[which(w$stock=="KRFT")] <- "beverage&drinks"
w$catagory[which(w$stock=="MCD")] <- "beverage&drinks"
w$catagory[which(w$stock=="T")] <- "communication"
w$catagory[which(w$stock=="CSCO")] <- "communication"
w$catagory[which(w$stock=="VZ")] <- "communication"
w$catagory[which(w$stock=="JNJ")] <- "medicine"
w$catagory[which(w$stock=="MRK")] <- "medicine"
w$catagory[which(w$stock=="PFE")] <- "medicine"
head(w)
```


```{r,fig.width=13,fig.height=5}
library(ggplot2)
p <- ggplot(w,aes(x=date,y=open))
p +geom_point()
w$open <- as.numeric(substr(w$open,2,max(nchar(as.character(w$open))))) 
w$date <- as.Date(w$date,"%m/%d/%Y") 
head(w)
p <- ggplot(w,aes(x=date,y=open)) + geom_point()

אם אנסה להריץ ב-markdown  כקובץ וורד הוא יריץ רגיל ללא שגיאות וייתן את ציר x  עם חודשים בעברית , להריץ כpdf  הוא לא נותן , השאלה היא איך מגדירים לו שיכול גם להריץ בעברית ללא שגיאות ,
תודה 

תום 


Jonathan Rosenblatt

unread,
May 3, 2015, 7:53:42 AM5/3/15
to israel-r-user-group
האם תוכל לצרף את הנתונים? או לחלופין, דוגמה שאפשר להריץ ללא הנתונים הספציפיים שלך?

יונתן

--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jonathan Rosenblatt
www.john-ros.com

Tom Haber

unread,
May 3, 2015, 8:01:28 AM5/3/15
to israel-r-...@googlegroups.com
האמת לא חושב שאני יכול , הדרך היחידה זה לבנות סט נתונים כזה מאפס ,

זה פשוט לקוח מתוך אתר של מניות דאו-ג'ונס , https://archive.ics.uci.edu/ml/datasets/Dow+Jones+Index

האם יש משהו אחר שניתן לעשות ? 

Tom Haber

unread,
May 3, 2015, 8:22:45 AM5/3/15
to israel-r-...@googlegroups.com

יצרתי קובץ נתונים מאפס כדי להראות את הבעיה שלא נותן לייצא pdf עם ציר x בעברית אך כוורד נותן ,

---
title: "Untitled"
output:
  pdf_document:
    latex_engine: xelatex
---

```{r,fig.width=18,fig.height=9}
y <- c("ko","ko","T","T","vz","VZ")
y <- as.data.frame(y)
y$date <- c("1/7/2011","1/14/2011","1/21/2011", "1/28/2011", "2/4/2011",  "2/11/2011")
y$catagory <- ""
y[1,3] <- "beverage&drinks"
y[2,3] <- "beverage&drinks"
y[3,3] <- "medicene"
y[4,3] <- "medicene"
y[5,3] <- "communication"
y[6,3] <- "communication"
y$open <- c(15.82,16.71,16.19,15.87,16.18,17.33)
library(ggplot2)
p <- ggplot(y,aes(x=date,y=open))
p +geom_point()
y$date <- as.Date(y$date,"%m/%d/%Y") 
head(y)
p <- ggplot(y,aes(x=date,y=open)) + geom_point()
```

Jonathan Rosenblatt

unread,
May 3, 2015, 8:28:21 AM5/3/15
to israel-r-user-group
Try this chunk header:

```{r,fig.width=13,fig.height=5, dev = 'cairo_pdf'}



--
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jonathan Rosenblatt
www.john-ros.com

Tom Haber

unread,
May 3, 2015, 9:00:20 AM5/3/15
to israel-r-...@googlegroups.com

כן זה באמת מראה את ציר x בעברית , תודה רבה ,

אך זה עדיין נותן אזהרת השגיאות בpdf עצמה, יש אפשרות שהשגיאות גם לא יופיעו ?  
Reply all
Reply to author
Forward
0 new messages