t(df) function does not transpose my data frame anymore

Hey guys,
since I've installed the tidyverse package the t() function won't work anymore. When I use t(df) it displays the data frame in the RStudio console instead of transposing the data frame.

t(MDSIIIges)

        D0 D1 FU1 D2 FU2 D3 FU3

Patient 301 23 29 26 36 30 30 19
Patient 302 17 25 15 21 25 26 21
Patient 303 42 27 26 29 23 24 20
Patient 304 76 61 57 48 29 60 49
Patient 305 NA NA NA NA NA NA NA
Patient 306 14 17 10 21 10 13 9

Also if I want to transform a value item from the workspace to a data frame it is displayed as a data frame in the RStudio console but not added to the workspace as a data frame.

hey <- c(1:10)
as.data.frame(hey)
hey
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10

These problem occured after having used the following code to create a .txt from the output of the summary function:

sink("output.txt")
print(names(df))
print(summary(df))
sink()

Before that I installed the tidyverse package.

I have not been able to fix it by uninstalling R and RStudio (after uninstalling the programms I even deleted the remaining folder in the AppData folder.

R functions do not perform in-place modifications, you have to explicitly assign the output to a variable if you want it to be added to the working environment.

hey <- c(1:10)
hey_df <- as.data.frame(hey)
1 Like

Thank you very much! I was so confused that I forgot the as.data.frame() :smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.