[R] special character encoding problem
Huidong TIAN
tienhuitung at gmail.com
Sun Mar 31 21:34:29 CEST 2013
Thanks a lot! Here is the information you asked:
> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_2.15.3
# Optional parameters for the console and the pager
# The system-wide copy is in R_HOME/etc.
# A user copy can be installed in `R_USER'.
## Style
# This can be `yes' (for MDI) or `no' (for SDI).
# MDI = yes
MDI = no
# the next two are only relevant for MDI
toolbar = yes
statusbar = no
## Font.
# Please use only fixed width font.
# If font=FixedFont the system fixed font is used; in this case
# points and style are ignored. If font begins with "TT ", only
# True Type fonts are searched for.
font = TT Courier New
points = 10
style = normal # Style can be normal, bold, italic
# Dimensions (in characters) of the console.
rows = 25
columns = 80
# Dimensions (in characters) of the internal pager.
pgrows = 25
pgcolumns = 80
# should options(width=) be set to the console width?
setwidthonresize = yes
# memory limits for the console scrolling buffer, in chars and lines
# NB: bufbytes is in bytes for R < 2.7.0, chars thereafter.
bufbytes = 250000
buflines = 8000
# Initial position of the console (pixels, relative to the workspace for MDI)
# xconsole = 0
# yconsole = 0
# Dimension of MDI frame in pixels
# Format (w*h+xorg+yorg) or use -ve w and h for offsets from right bottom
# This will come up maximized if w==0
# MDIsize = 0*0+0+0
# MDIsize = 1000*800+100+0
# MDIsize = -50*-50+50+50 # 50 pixels space all round
# The internal pager can displays help in a single window
# or in multiple windows (one for each topic)
# pagerstyle can be set to `singlewindow' or `multiplewindows'
pagerstyle = multiplewindows
## Colours for console and pager(s)
# (see rwxxxx/etc/rgb.txt for the known colours).
background = White
normaltext = NavyBlue
usertext = Red
highlight = DarkRed
## Initial position of the graphics window
## (pixels, <0 values from opposite edge)
xgraphics = -25
ygraphics = 0
## Language for messages
language =
## Default setting for console buffering: 'yes' or 'no'
buffered = yes
On Sun, Mar 31, 2013 at 3:31 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 13-03-30 5:07 PM, Huidong TIAN wrote:
>>
>> Hi,
>> I have a question about special character: when I create a data
>> frame including some special characters, like 'ø', it displayed as
>> '<U+00F8>'. I understand that it's one encoding code for 'ø'. but I
>> want to display the letter as 'ø' on my screen. And more, when I save
>> the data frame to a local position, it was also save as the encoding
>> code instead of the special characters, anybody give some practical
>> tips, I have little knowledge about encoding stuff. My operate system
>> is windows 7 Simple Chinese, I use R 2.15.3 64-bit.
>
>
> You might be able to display more by using different language settings. The
> problem is that R doesn't think your system knows how to display those
> characters, so rather than displaying ? or similar, it displays the Unicode
> encoding.
>
> I don't have any experience working with a Chinese locale, so I can't give
> specific advice on how to fix this, but the general advice is to use a font
> which contains the characters you need. R won't switch fonts in the middle
> of a word to handle special characters.
>
> Showing us the result of sessionInfo() might be informative, but you
> probably also need to tell us which font R is using. You can see that in
> your Rconsole file, displayed by example(Rconsole).
>
> Duncan Murdoch
>
>>
>>
>>> x <- data.frame(part = c("målløs", "ny"))
>>> head(x)
>>
>> part
>> 1 m<U+00E5>ll<U+00F8>s
>> 2 ny
>>>
>>> x$part
>>
>> [1] målløs ny
>> Levels: m<U+00E5>ll<U+00F8>s ny
>>
>> Thanks!
>>
>> --
>> Huidong Tian, Postdoc
>>
>> Swedish University of Agricultural Sciences
>> Department of Aquatic Resources
>> Institute of Marine Research
>> Turistgatan 5,
>> 45330 Lysekil, Sweden
>>
>> Phone: +47 40624112
>> Email: tienhuitung at gmail.com
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
--
Huidong Tian, Postdoc
Swedish University of Agricultural Sciences
Department of Aquatic Resources
Institute of Marine Research
Turistgatan 5,
45330 Lysekil, Sweden
Phone: +47 40624112
Email: tienhuitung at gmail.com
More information about the R-help
mailing list