Tag Archives: r language

[Solved] R Language Error: duplicate ‘row.names’ are not allowed

This is because the R language default behavior is a unique identifier

Duplicate lines need to be removed

This is very common in differential expression, because different IDs may correspond to the same gene_ symbol

genes_sig <- res_sig %>% 
  arrange(adj.P.Val) %>% #Sort by Pvalue from smallest to largest
  as tibble() %>%
  column_to_rownames(var = "gene_symbol")

report errors

Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘’, ‘ AMY2A ’, ‘ ANKRD20A3 ’, ‘ ANXA8 ’, ‘ AQP12B ’, ‘ AREG ’, ‘ ARHGDIG ’, ‘ CLIC1 ’, ‘ CTRB2 ’, ‘ DPCR1 ’, ‘ FAM72B ’, ‘ FCGR3A ’, ‘ FER1L4 ’, ‘ HBA2 ’, ‘ HIST1H4I ’, ‘ HIST2H2AA4 ’, ‘ KRT17P2 ’, ‘ KRT6A ’, ‘ LOC101059935 ’, ‘ MRC1 ’, ‘ MT-TD ’, ‘ MT-TV ’, ‘ NPR3 ’, ‘ NRP2 ’, ‘ PGA3 ’, ‘ PRSS2 ’, ‘ REEP3 ’, ‘ RNU6-776P ’, ‘ SFTA2 ’, ‘ SLC44A4 ’, ‘ SNORD116-3 ’, ‘ SNORD116-5 ’, ‘ SORBS2 ’, ‘ TNXB ’, ‘ TRIM31 ’, ‘ UGT2B15 ’ 

Try to use the duplicated() function

res_df = res_df[!duplicated(res_df),] %>% as.tibble() %>%
column_to_rownames(var = "gene_symbol") 

Still not?Duplicated removing duplicate values still shows that duplicate values exist

Error in `.rowNamesDF<-`(x, value = value) : 
  duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘ AMY2A ’, ‘ ANKRD20A3 ’, ‘ ANXA8 ’, ‘ AQP12B ’, ‘ AREG ’, ‘ ARHGDIG ’, ‘ CLIC1 ’, ‘ CTRB2 ’, ‘ DPCR1 ’, ‘ FAM72B ’, ‘ FCGR3A ’, ‘ FER1L4 ’, ‘ HIST1H4I ’, ‘ HIST2H2AA4 ’, ‘ KRT17P2 ’, ‘ KRT6A ’, ‘ LOC101059935 ’, ‘ MT-TD ’, ‘ MT-TV ’, ‘ NPR3 ’, ‘ NRP2 ’, ‘ PGA3 ’, ‘ PRSS2 ’, ‘ REEP3 ’, ‘ RNU6-776P ’, ‘ SFTA2 ’, ‘ SORBS2 ’, ‘ TRIM31 ’, ‘ UGT2B15 ’ 

Another way is to use the uniqe function of the dyplr package

res_df = res_df %>% distinct(gene_symbol,.keep_all = T) %>% as.tibble() %>%
  column_to_rownames(var = "gene_symbol") 

Successfully solved

R language: How to Solve DMwR Install Error

If the code is

install.packages("DMwR")

That may be the version of the installation package. Change to

install.packages("DMwR2")

want a go. The same is true when importing

library("DMwR2")

Specific process of error correction:

At first, I thought that the version of rstudio was not new enough. After updating rstudio, I found that it still couldn’t; Download rtools again, or report an error

The installation code of dmwr is as follows

install.packages("DMwR")

Error display

Warning in install.packages :
package ‘DMwR’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing -packages

(in fact, there is another error when downloading rtools and updating rstudio, but there is no screenshot,

Rtools is required to build R packages, but is not currently installed

Then try to change the installed image, Download rtools and update rstudio, and the error message becomes the above one)

I found the dmwr2 package by chance. I tried it and downloaded it successfully.

It is recommended to try dmwr2 first. If not, you can update rstudio and install rtools

Error: Discrete value supplied to continuous scale [How to Solve]

 

#Simulation data

df <- structure(list(`10` = c(0, 0, 0, 0, 0, 0), `33.95` = c(0, 0, 
0, 0, 0, 0), `58.66` = c(0, 0, 0, 0, 0, 0), `84.42` = c(0, 0, 
0, 0, 0, 0), `110.21` = c(0, 0, 0, 0, 0, 0), `134.16` = c(0, 
0, 0, 0, 0, 0), `164.69` = c(0, 0, 0, 0, 0, 0), `199.1` = c(0, 
0, 0, 0, 0, 0), `234.35` = c(0, 0, 0, 0, 0, 0), `257.19` = c(0, 
0, 0, 0, 0, 0), `361.84` = c(0, 0, 0, 0, 0, 0), `432.74` = c(0, 
0, 0, 0, 0, 0), `506.34` = c(1, 0, 0, 0, 0, 0), `581.46` = c(0, 
0, 0, 0, 0, 0), `651.71` = c(0, 0, 0, 0, 0, 0), `732.59` = c(0, 
0, 0, 0, 0, 1), `817.56` = c(0, 0, 0, 1, 0, 0), `896.24` = c(0, 
0, 0, 0, 0, 0), `971.77` = c(0, 1, 1, 1, 0, 1), `1038.91` = c(0, 
0, 0, 0, 0, 0), MW = c(3.9, 6.4, 7.4, 8.1, 9, 9.4)), .Names = c("10", 
"33.95", "58.66", "84.42", "110.21", "134.16", "164.69", "199.1", 
"234.35", "257.19", "361.84", "432.74", "506.34", "581.46", "651.71", 
"732.59", "817.56", "896.24", "971.77", "1038.91", "MW"), row.names = c("Merc", 
"Peug", "Fera", "Fiat", "Opel", "Volv"
), class = "data.frame")


df

Question:

library(reshape)

## Plotting
meltDF = melt(df, id.vars = 'MW')
ggplot(meltDF[meltDF$value == 1,]) + geom_point(aes(x = MW, y = variable)) +
  scale_x_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, 1200)) +
  scale_y_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, 1200))

Solution:

After the meltdf variable is defined, the factor variable can be transformed into numerical white energy;

If x is a numeric value, add scale_x_continual(); If x is a character/factor, add scale_x_discreate().

meltDF$variable=as.numeric(levels(meltDF$variable))[meltDF$variable]


ggplot(meltDF[meltDF$value == 1,]) + geom_point(aes(x = MW, y =   variable)) +
     scale_x_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, 1200)) +
     scale_y_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, 1200))

Full Error Messages:
> library(reshape)
>
> ## Plotting
> meltDF = melt(df, id.vars = ‘MW’)
> ggplot(meltDF[meltDF$value == 1,]) + geom_point(aes(x = MW, y = variable)) +
+     scale_x_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, 1200)) +
+     scale_y_continuous(limits=c(0, 1200), breaks=c(0, 400, 800, 1200))
Error: Discrete value supplied to continuous scale
>

ERROR: configuration failed for package ‘openssl’ [How to Solve]

ERROR: configuration failed for package ‘openssl’
removing ‘/usr/local/lib/R/site-library/openssl’
The ubuntu system lacks openssl:

apt-get install openssl
apt-get install openssl-devel

Or:

wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz

tar -xvf  openssl-1.1.1i.tar.gz

cd openssl-1.1.1i/

./config 

make && make install

./config shared 

make clean

make  && make install

ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’

ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
removing ‘/usr/local/lib/R/site-library/httr’

apt-get install openssl
apt-get install openssl-devel

apt-get install libcurl

Or:

wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz

tar -xvf  openssl-1.1.1i.tar.gz

cd openssl-1.1.1i/

./config 

make && make install

./config shared 

make clean

make  && make install

‘curl’:

wget  http://curl.haxx.se/download/curl-7.38.0.tar.gz

tar -xzvf curl-7.38.0.tar.gz

cd curl-7.38.0

./configure

make

make install

[Solved] Hbase Error: ERROR: KeeperErrorCode = NoNode for /hbase/master

Reason: power failure (including computer sleep, etc.) caused Hmaster to fail to connect, and no master node could be found in zookeeper

Solution: delete the hbase node in zookeeper, open hbase will automatically create this node
1) log in to the zookeeper client: zkCli.sh
2) delete the hbase node: deleteall /hbase

The most critical step: restart hbase, restart zookeeper
1) close zookeeper: my_zk.sh stop This is my script to start zk, don’t copy
2) close hbase: stop-hbase.sh is invalid, use the jps command to find each in the cluster The port number of the hmaster and hregionserver of the machine, kill -9 + port number one by one kills the hbase process, which is equivalent to manually closing hbase
3) Open zookeeper and hbase, my_zk.sh start start-hbase.sh
hdfs does not need to be moved, If yours doesn’t work, hdfs can also be restarted.

Manifest merger failed with multiple errors, see logs [How to Solve]

Today, when accessing an Android SDK, I reported a problem of manifest merge failed with multiple errors, see logs. Google said that this problem often occurs when introducing a third-party SDK. In fact, it is a dependency conflict
you can see the specific error information above the error, as shown below

it indicates that there is a com.tencent.mid conflict. Just exclude

Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for m

Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for migration version 700013

When spring boot integrates flyway for database version management, the startup service reports an error org.flywaydb.core.api.flywayexception: validate failed: detected failed migration to version 1.1 (fixusername)

reason:

Because I modified SQL in the original version, this error is mainly due to flyway_ schema_ The recorded data in history affects the startup and needs to be checked

Solution 1:

If you don’t want to recreate a version,
you need to find the relevant table in the database, delete the data related to this version, modify and restore the fields related to this version, and then reload it

Solution 2

Create a new version, write the relevant data changes to the version, and restart the project

Failed to read artifact descriptor for xxx:jar Missing

Background

I’ve been looking at HBase recently, introducing

        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase-client</artifactId>
            <version>2.1.3</version>
        </dependency>

Abnormal

Exception thrown: failed to read artifact descriptor for XXX: jar missing

Solution

Delete the org.apache.hbase related files under the local repository to solve the problem

reference resources

https://blog.csdn.net/weixin_ 42204641/article/details/80768905

Project Startup Error: Error running ‘xxxApplication‘;Command line is too long, Shoerten command line for……..

Springboot startup project error

When you start a project, you can’t start it all the time. The name of the startup class is too long. As shown in the figure below

Error running'XxxApplication';
Command line i stoo long. Shorten command line for XxxApplication or also for Spring Boot default configuration?

Modify idea configuration information

Enter the startup class configuration, click eidt configurations, and find the startup class:
in the short command line option, select the jar manifest option, because the default is the first none,

Explanation:

none :

 This is the default option and idea will not shorten the command line. If the command line exceeds the OS limit, the idea will not run your application, but the tooltip will suggest configuring a shortener.

JAR manifest:

idea passes long class paths through a temporary classpath.jar. The original class path is defined in MANIFEST.MF as the class path property in classpath.jar.

classpath file:

idea writes a long class path to a text file.

Online advice is to choose the third option, classpath file. You can choose according to your project needs

Error: could not find function … in R [How to Solve]

Error: could not find function … in R

Question:

solve:

Full error:


Question:

> mytest.ax(lable,prediction)
Error in mytest.ax(lable, prediction) :
could not find function “mytest.ax”

Solution:

First, is the function name written correctly?R language function names are case sensitive.

Second, is the package containing the function installed?install.packages(“package_name”)

Third,

require(package_name)

library(package)

Require (package_name) (and check its return value) or library (package) (this should be done every time you start a new R session)

Fourth, are you using an old r version that does not yet exist?Or the version of R package; Or after the version is updated, some functions are removed from the original package;

Fifth, functions are added and removed over time, and the referenced code may expect an updated or older version than the package you installed. Or it’s too new. Cran doesn’t contain the latest version;

Full error:

> mytest.ax(lable,prediction)
Error in mytest.ax(lable, prediction) :
could not find function "mytest.ax"