[R] understanding the no-label concept

2014-10-11 Thread moonkid
I am new to R but a bit familiar with Stata and SPSS and a software dev.

As I understand it right, there is no possibility to give variables or
values a lable. Is that right?

Just for example. "x" need a name. And the four values (1, 2, 3, 4)
need it to.

[code]
> table(x)

1  2  3  4
17  6  6  2 
[/code]

I understand that R itself is powerful and well developed. So I try to
understand why it doesn't support labels.

And in the next step I try to understand how do you work with your data
and publish (e.g. with *TeX) it without using labels? R can put out
*TeX-code, right? I don't want to modify the outputted code manually. It
would waste my time and decreases my efficiency.

__
R-help@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.


Re: [R] understanding the no-label concept

2014-10-16 Thread moonkid
On 2014-10-11 14:16 David Winsemius  wrote:
> Hmisc...

Tried but has no effect on table() calls.

__
R-help@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.


Re: [R] understanding the no-label concept

2014-10-16 Thread moonkid
On 2014-10-11 15:14 William Dunlap  wrote:
> You can use 'factors' to assign labels to small integer values.  E.g.,
>> x <- c(1,2,3,4,3)
>> fx <- factor(x, levels=1:5,
>> labels=c("One","Two","Three","Four","Five")) table(fx)
>fx
>  One   Two Three  Four  Five
>1 1 2 1 0

Looks nice. It works! Thanks.

Now I will refere (going back) to the doc to try to understand the
concept behind it.

Reading the introduction before that had no effect on my
understanding. ;)

__
R-help@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.


Re: [R] understanding the no-label concept

2014-10-16 Thread moonkid
> aa <- 1:5
> names(aa) <- c("Eins", "Zwei", "Drei", "Vier", "Fünf")
> aa
Eins Zwei Drei Vier Fünf
   12345
> table(aa)
1 2 3 4 5
1 1 1 1 1

You see? It didn't work.

> aa <- c(aa, 1, 2)
> aa
Eins Zwei Drei Vier Fünf
   1234512

This is no solution for my case.

But...

> bb <- matrix(1:12, 3, 4, dimnames=list(letters[1:3], LETTERS[1:4]))

Nice. But look dam complex for a simple task. I see I have to change a
lot of the concepts in my mind and my workflows.

__
R-help@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.


[R] [Sweave] doesn't accept unicode?

2014-10-21 Thread moonkid
Of course I manage and write my tex-files in unicode (utf-8) (running 
XeTeX). That is why my R-output need to be in unicode, too.


But Sweave doesn't accept unicode files.

[R]

Sweave("analy.Snw")

Fehler: ‘analy.Snw’ is not ASCII and does not declare an encoding
[/R]

[analy.Snw]
<<>>=
x <- ü

table(x)
@
[/analy.Snw]

How should I "declare an encoding". I can not find an option for the 
<<>>.


I don't have to declare any of my tex-files explicite because XeTeX use 
the files like they come. It knows for itself the encoding.


__
R-help@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.


Re: [R] [Sweave] doesn't accept unicode?

2014-10-22 Thread moonkid

Maybe your answers are solutions, but not in my case.
As I indicated with my code-sample I don't have a complete tex-file 
(with usepackage, document-env, etc). I only generate a piece of a tex 
file to \input it later in my puplication tex-file.


So there is no way to specifiy an encoding with a \usepackage. Btw: 
XeTeX don't need any specification for the encoding. Loading xunicode 
explicite is not needed.


The answer for Sweave is simple and in the help-page (I should have read 
more carefully before - but it was 3 oclock in the morning).



Sweave("analy.Snw", encoding="bytes")


Now Sweave don't care about the encoding.

__
R-help@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.